Index: content/common/gpu/media/accelerated_video_decoder.h |
diff --git a/content/common/gpu/media/accelerated_video_decoder.h b/content/common/gpu/media/accelerated_video_decoder.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c906e818c21d47464c66a3b1fd630bcfdc050e9d |
--- /dev/null |
+++ b/content/common/gpu/media/accelerated_video_decoder.h |
@@ -0,0 +1,65 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_GPU_MEDIA_ACCELERATED_VIDEO_DECODER_ |
+#define CONTENT_COMMON_GPU_MEDIA_ACCELERATED_VIDEO_DECODER_ |
+ |
+#include "base/callback_forward.h" |
+#include "base/callback_helpers.h" |
+#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.
|
+#include "content/common/content_export.h" |
+#include "ui/gfx/geometry/size.h" |
+ |
+namespace content { |
+ |
+// An AcceleratedVideoDecoder is a video decoder that requires support from an |
+// external accelerator (typically a hardware accelerator) to partially offload |
+// the decode process after parsing stream headers, and performing reference |
+// frame and state management. |
+class CONTENT_EXPORT AcceleratedVideoDecoder { |
+ public: |
+ AcceleratedVideoDecoder() {} |
+ virtual ~AcceleratedVideoDecoder() {} |
+ |
+ virtual void SetStream(const uint8* ptr, size_t size) = 0; |
+ |
+ // Have the decoder flush its state and trigger output of all previously |
+ // decoded surfaces. Return false on failure. |
+ virtual bool Flush() WARN_UNUSED_RESULT = 0; |
+ |
+ // To be called during decoding. |
+ // 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.
|
+ // but do not flush decoder state, so that the playback can be resumed later, |
+ // possibly from a different location. |
+ virtual void Reset() = 0; |
+ |
+ // Decode result codes. |
+ 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.
|
+ kDecodeError, // Error while decoding. |
+ // 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.
|
+ // in decoding; in future it could perhaps be possible to fall back |
+ // to software decoding instead. |
+ // kStreamError, // Error in stream. |
+ kAllocateNewSurfaces, // Need a new set of surfaces to be allocated. |
+ kRanOutOfStreamData, // Need more stream data to proceed. |
+ kRanOutOfSurfaces, // Waiting for the client to free up output surfaces. |
+ }; |
+ |
+ // Try to decode more of the stream, returning decoded frames asynchronously. |
+ // Return when more stream is needed, when we run out of free surfaces, when |
+ // we need a new set of them, or when an error occurs. |
+ 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
|
+ |
+ // Return dimensions/required number of output surfaces that client should |
+ // be ready to provide for the decoder to function properly. |
+ // To be used after Decode() returns kNeedNewSurfaces. |
+ 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.
|
+ virtual size_t GetRequiredNumOfPictures() = 0; |
kcwu
2015/01/09 10:07:47
...() const = 0;
Pawel Osciak
2015/01/12 07:18:18
Done.
|
+ |
+ 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.
|
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_MEDIA_ACCELERATED_VIDEO_DECODER_ |