| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Interface for wrapping different Android MediaCodec implementations. For | 41 // Interface for wrapping different Android MediaCodec implementations. For |
| 42 // more information on Android MediaCodec, check | 42 // more information on Android MediaCodec, check |
| 43 // http://developer.android.com/reference/android/media/MediaCodec.html | 43 // http://developer.android.com/reference/android/media/MediaCodec.html |
| 44 // Note: MediaCodec is only available on JB and greater. | 44 // Note: MediaCodec is only available on JB and greater. |
| 45 class MEDIA_EXPORT MediaCodecBridge { | 45 class MEDIA_EXPORT MediaCodecBridge { |
| 46 public: | 46 public: |
| 47 virtual ~MediaCodecBridge(); | 47 virtual ~MediaCodecBridge(); |
| 48 | 48 |
| 49 // Resets both input and output, all indices previously returned in calls to | |
| 50 // DequeueInputBuffer() and DequeueOutputBuffer() become invalid. | |
| 51 // Please note that this clears all the inputs in the media codec. In other | |
| 52 // words, there will be no outputs until new input is provided. | |
| 53 // Returns MEDIA_CODEC_ERROR if an unexpected error happens, or MEDIA_CODEC_OK | |
| 54 // otherwise. | |
| 55 virtual MediaCodecStatus Reset() = 0; | |
| 56 | |
| 57 // Calls start() against the media codec instance. Returns whether media | 49 // Calls start() against the media codec instance. Returns whether media |
| 58 // codec was successfully started. | 50 // codec was successfully started. |
| 59 virtual bool Start() = 0; | 51 virtual bool Start() = 0; |
| 60 | 52 |
| 61 // Finishes the decode/encode session. The instance remains active | 53 // Finishes the decode/encode session. The instance remains active |
| 62 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy | 54 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy |
| 63 // vendor's implementation , b/8125974, Stop() -> StartAudio/Video() may not | 55 // vendor's implementation , b/8125974, Stop() -> StartAudio/Video() may not |
| 64 // work on some devices. For reliability, Stop() -> delete and recreate new | 56 // work on some devices. For reliability, Stop() -> delete and recreate new |
| 65 // instance -> StartAudio/Video() is recommended. | 57 // instance -> StartAudio/Video() is recommended. |
| 66 virtual void Stop() = 0; | 58 virtual void Stop() = 0; |
| 67 | 59 |
| 60 // Calls flush() on the MediaCodec. All indices previously returned in calls |
| 61 // to DequeueInputBuffer() and DequeueOutputBuffer() become invalid. Please |
| 62 // note that this clears all the inputs in the media codec. In other words, |
| 63 // there will be no outputs until new input is provided. Returns |
| 64 // MEDIA_CODEC_ERROR if an unexpected error happens, or MEDIA_CODEC_OK |
| 65 // otherwise. |
| 66 virtual MediaCodecStatus Flush() = 0; |
| 67 |
| 68 // Used for getting the output size. This is valid after DequeueInputBuffer() | 68 // Used for getting the output size. This is valid after DequeueInputBuffer() |
| 69 // returns a format change by returning INFO_OUTPUT_FORMAT_CHANGED. | 69 // returns a format change by returning INFO_OUTPUT_FORMAT_CHANGED. |
| 70 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. | 70 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. |
| 71 virtual MediaCodecStatus GetOutputSize(gfx::Size* size) = 0; | 71 virtual MediaCodecStatus GetOutputSize(gfx::Size* size) = 0; |
| 72 | 72 |
| 73 // Used for checking for new sampling rate after DequeueInputBuffer() returns | 73 // Used for checking for new sampling rate after DequeueInputBuffer() returns |
| 74 // INFO_OUTPUT_FORMAT_CHANGED | 74 // INFO_OUTPUT_FORMAT_CHANGED |
| 75 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. | 75 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise. |
| 76 virtual MediaCodecStatus GetOutputSamplingRate(int* sampling_rate) = 0; | 76 virtual MediaCodecStatus GetOutputSamplingRate(int* sampling_rate) = 0; |
| 77 | 77 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool FillInputBuffer(int index, | 182 bool FillInputBuffer(int index, |
| 183 const uint8_t* data, | 183 const uint8_t* data, |
| 184 size_t data_size) WARN_UNUSED_RESULT; | 184 size_t data_size) WARN_UNUSED_RESULT; |
| 185 | 185 |
| 186 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); | 186 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 } // namespace media | 189 } // namespace media |
| 190 | 190 |
| 191 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 191 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| OLD | NEW |