Index: media/base/android/media_codec_bridge.h |
diff --git a/media/base/android/media_codec_bridge.h b/media/base/android/media_codec_bridge.h |
index dd315917779db1dd689f6a57c62f0744318e2e69..848304cb1556fa052c307139732dcdd3be1c576f 100644 |
--- a/media/base/android/media_codec_bridge.h |
+++ b/media/base/android/media_codec_bridge.h |
@@ -8,14 +8,11 @@ |
#include <stddef.h> |
#include <stdint.h> |
-#include <set> |
#include <string> |
#include <vector> |
-#include "base/compiler_specific.h" |
#include "base/macros.h" |
#include "base/time/time.h" |
-#include "media/base/android/media_codec_direction.h" |
#include "media/base/media_export.h" |
#include "ui/gfx/geometry/size.h" |
@@ -32,20 +29,15 @@ enum MediaCodecStatus { |
MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER, |
MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED, |
MEDIA_CODEC_OUTPUT_FORMAT_CHANGED, |
- MEDIA_CODEC_INPUT_END_OF_STREAM, |
- MEDIA_CODEC_OUTPUT_END_OF_STREAM, |
MEDIA_CODEC_NO_KEY, |
- MEDIA_CODEC_ABORT, |
MEDIA_CODEC_ERROR |
}; |
-// Interface for wrapping different Android MediaCodec implementations. For |
-// more information on Android MediaCodec, check |
-// http://developer.android.com/reference/android/media/MediaCodec.html |
-// Note: MediaCodec is only available on JB and greater. |
+// An interface for a bridge to an Android MediaCodec. |
class MEDIA_EXPORT MediaCodecBridge { |
public: |
- virtual ~MediaCodecBridge(); |
+ MediaCodecBridge() = default; |
+ virtual ~MediaCodecBridge() = default; |
// Calls start() against the media codec instance. Returns whether media |
// codec was successfully started. |
@@ -91,11 +83,9 @@ class MEDIA_EXPORT MediaCodecBridge { |
size_t data_size, |
base::TimeDelta presentation_time) = 0; |
- // Similar to the above call, but submits a buffer that is encrypted. Note: |
- // NULL |subsamples| indicates the whole buffer is encrypted. If |data| is |
- // NULL, assume the input buffer has already been populated (but still obey |
- // |data_size|). |data_size| must be less than kint32max (because Java). |
- MediaCodecStatus QueueSecureInputBuffer( |
+ // As above but for encrypted buffers. NULL |subsamples| indicates the |
+ // whole buffer is encrypted. |
+ virtual MediaCodecStatus QueueSecureInputBuffer( |
int index, |
const uint8_t* data, |
size_t data_size, |
@@ -103,44 +93,23 @@ class MEDIA_EXPORT MediaCodecBridge { |
const std::string& iv, |
const std::vector<SubsampleEntry>& subsamples, |
const EncryptionScheme& encryption_scheme, |
- base::TimeDelta presentation_time); |
- |
- // Same QueueSecureInputBuffer overriden for the use with |
- // AndroidVideoDecodeAccelerator and MediaCodecAudioDecoder. TODO(timav): |
- // remove this method and keep only the one above after we switch to the |
- // Spitzer pipeline. |
- virtual MediaCodecStatus QueueSecureInputBuffer( |
- int index, |
- const uint8_t* data, |
- size_t data_size, |
- const std::vector<char>& key_id, |
- const std::vector<char>& iv, |
- const SubsampleEntry* subsamples, |
- int subsamples_size, |
- const EncryptionScheme& encryption_scheme, |
base::TimeDelta presentation_time) = 0; |
- // Submits an empty buffer with a EOS (END OF STREAM) flag. |
+ // Submits an empty buffer with the END_OF_STREAM flag set. |
virtual void QueueEOS(int input_buffer_index) = 0; |
// Returns: |
// MEDIA_CODEC_OK if an input buffer is ready to be filled with valid data, |
// MEDIA_CODEC_ENQUEUE_INPUT_AGAIN_LATER if no such buffer is available, or |
// MEDIA_CODEC_ERROR if unexpected error happens. |
- // Note: Never use infinite timeout as this would block the decoder thread and |
- // prevent the decoder job from being released. |
virtual MediaCodecStatus DequeueInputBuffer(base::TimeDelta timeout, |
int* index) = 0; |
- // Dequeues an output buffer, block at most timeout_us microseconds. |
+ // Dequeues an output buffer, block for up to |timeout|. |
// Returns the status of this operation. If OK is returned, the output |
// parameters should be populated. Otherwise, the values of output parameters |
// should not be used. Output parameters other than index/offset/size are |
// optional and only set if not NULL. |
- // Note: Never use infinite timeout as this would block the decoder thread and |
- // prevent the decoder job from being released. |
- // TODO(xhwang): Can we drop |end_of_stream| and return |
- // MEDIA_CODEC_OUTPUT_END_OF_STREAM? |
virtual MediaCodecStatus DequeueOutputBuffer( |
base::TimeDelta timeout, |
int* index, |
@@ -159,36 +128,18 @@ class MEDIA_EXPORT MediaCodecBridge { |
uint8_t** data, |
size_t* capacity) = 0; |
- // Gives the access to buffer's data which is referenced by |index| and |
- // |offset|. The size of available data for reading is written to |*capacity| |
- // and the address is written to |*addr|. |
- // Returns MEDIA_CODEC_ERROR if a error occurs, or MEDIA_CODEC_OK otherwise. |
- virtual MediaCodecStatus GetOutputBufferAddress(int index, |
- size_t offset, |
- const uint8_t** addr, |
- size_t* capacity) = 0; |
- |
// Copies |num| bytes from output buffer |index|'s |offset| into the memory |
// region pointed to by |dst|. To avoid overflows, the size of both source |
// and destination must be at least |num| bytes, and should not overlap. |
// Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. |
- MediaCodecStatus CopyFromOutputBuffer(int index, |
- size_t offset, |
- void* dst, |
- size_t num); |
+ virtual MediaCodecStatus CopyFromOutputBuffer(int index, |
+ size_t offset, |
+ void* dst, |
+ size_t num) = 0; |
// Gets the component name. Before API level 18 this returns an empty string. |
virtual std::string GetName() = 0; |
- protected: |
- MediaCodecBridge(); |
- |
- // Fills a particular input buffer; returns false if |data_size| exceeds the |
- // input buffer's capacity (and doesn't touch the input buffer in that case). |
- bool FillInputBuffer(int index, |
- const uint8_t* data, |
- size_t data_size) WARN_UNUSED_RESULT; |
- |
DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); |
}; |