OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_GPU_MEDIA_ACCELERATED_VIDEO_DECODER_ | |
6 #define CONTENT_COMMON_GPU_MEDIA_ACCELERATED_VIDEO_DECODER_ | |
7 | |
8 #include "base/callback_forward.h" | |
9 #include "base/callback_helpers.h" | |
10 #include "base/memory/ref_counted.h" | |
Owen Lin
2015/01/08 15:42:06
not used for the above includes?
Pawel Osciak
2015/01/12 07:18:18
Done.
| |
11 #include "content/common/content_export.h" | |
12 #include "ui/gfx/geometry/size.h" | |
13 | |
14 namespace content { | |
15 | |
16 // An AcceleratedVideoDecoder is a video decoder that requires support from an | |
17 // external accelerator (typically a hardware accelerator) to partially offload | |
18 // the decode process after parsing stream headers, and performing reference | |
19 // frame and state management. | |
20 class CONTENT_EXPORT AcceleratedVideoDecoder { | |
21 public: | |
22 AcceleratedVideoDecoder() {} | |
23 virtual ~AcceleratedVideoDecoder() {} | |
24 | |
25 virtual void SetStream(const uint8* ptr, size_t size) = 0; | |
26 | |
27 // Have the decoder flush its state and trigger output of all previously | |
28 // decoded surfaces. Return false on failure. | |
29 virtual bool Flush() WARN_UNUSED_RESULT = 0; | |
30 | |
31 // To be called during decoding. | |
32 // Stop (pause) decoding, discarding all remaining inputs and outputs, | |
kcwu
2015/01/09 10:07:47
Make this first line.
Pawel Osciak
2015/01/12 07:18:18
Done.
| |
33 // but do not flush decoder state, so that the playback can be resumed later, | |
34 // possibly from a different location. | |
35 virtual void Reset() = 0; | |
36 | |
37 // Decode result codes. | |
38 enum DecResult { | |
Owen Lin
2015/01/08 15:42:06
Use a full name, e.g., DecodeResult ?
Pawel Osciak
2015/01/12 07:18:18
Done.
| |
39 kDecodeError, // Error while decoding. | |
40 // TODO posciak: unsupported streams are currently treated as error | |
kcwu
2015/01/09 10:07:47
TODO(posciak):
Pawel Osciak
2015/01/12 07:18:18
Done.
| |
41 // in decoding; in future it could perhaps be possible to fall back | |
42 // to software decoding instead. | |
43 // kStreamError, // Error in stream. | |
44 kAllocateNewSurfaces, // Need a new set of surfaces to be allocated. | |
45 kRanOutOfStreamData, // Need more stream data to proceed. | |
46 kRanOutOfSurfaces, // Waiting for the client to free up output surfaces. | |
47 }; | |
48 | |
49 // Try to decode more of the stream, returning decoded frames asynchronously. | |
50 // Return when more stream is needed, when we run out of free surfaces, when | |
51 // we need a new set of them, or when an error occurs. | |
52 virtual DecResult Decode() WARN_UNUSED_RESULT = 0; | |
Owen Lin
2015/01/08 15:42:06
How is the decoded frames be returned?
Owen Lin
2015/01/08 15:42:06
Is this a blocking call?
How many frame will be d
Pawel Osciak
2015/01/09 13:50:31
As many as there are in the buffer. The frames wil
Pawel Osciak
2015/01/09 13:50:31
Via a separate callback. I don't have a generalize
| |
53 | |
54 // Return dimensions/required number of output surfaces that client should | |
55 // be ready to provide for the decoder to function properly. | |
56 // To be used after Decode() returns kNeedNewSurfaces. | |
57 virtual gfx::Size GetPicSize() = 0; | |
Owen Lin
2015/01/08 15:42:06
return "const gfx::Size&" ?
kcwu
2015/01/09 10:07:47
GetPicSize() const = 0;
Pawel Osciak
2015/01/12 07:18:18
Done.
Pawel Osciak
2015/01/12 07:18:19
Done.
| |
58 virtual size_t GetRequiredNumOfPictures() = 0; | |
kcwu
2015/01/09 10:07:47
...() const = 0;
Pawel Osciak
2015/01/12 07:18:18
Done.
| |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(AcceleratedVideoDecoder); | |
Owen Lin
2015/01/08 15:42:06
You have put this under private: to make it works.
Pawel Osciak
2015/01/12 07:18:18
Done.
| |
61 }; | |
62 | |
63 } // namespace content | |
64 | |
65 #endif // CONTENT_COMMON_GPU_MEDIA_ACCELERATED_VIDEO_DECODER_ | |
OLD | NEW |