| 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 MEDIA_BASE_ANDROID_NDK_MEDIA_CODEC_BRIDGE_H_ |
| 6 #define MEDIA_BASE_ANDROID_NDK_MEDIA_CODEC_BRIDGE_H_ |
| 7 |
| 8 #include <media/NdkMediaCodec.h> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time/time.h" |
| 14 #include "media/base/android/media_codec_bridge.h" |
| 15 #include "media/base/media_export.h" |
| 16 |
| 17 namespace media { |
| 18 |
| 19 class MEDIA_EXPORT NdkMediaCodecBridge : public MediaCodecBridge { |
| 20 public: |
| 21 ~NdkMediaCodecBridge() override; |
| 22 |
| 23 // MediaCodecBridge implementation. |
| 24 MediaCodecStatus Reset() override; |
| 25 bool Start() override; |
| 26 void Stop() override; |
| 27 void GetOutputFormat(int* width, int* height) override; |
| 28 int GetOutputSamplingRate() override; |
| 29 MediaCodecStatus QueueInputBuffer( |
| 30 int index, |
| 31 const uint8_t* data, |
| 32 size_t data_size, |
| 33 const base::TimeDelta& presentation_time) override; |
| 34 using MediaCodecBridge::QueueSecureInputBuffer; |
| 35 MediaCodecStatus QueueSecureInputBuffer( |
| 36 int index, |
| 37 const uint8_t* data, |
| 38 size_t data_size, |
| 39 const std::vector<char>& key_id, |
| 40 const std::vector<char>& iv, |
| 41 const SubsampleEntry* subsamples, |
| 42 int subsamples_size, |
| 43 const base::TimeDelta& presentation_time) override; |
| 44 void QueueEOS(int input_buffer_index); |
| 45 MediaCodecStatus DequeueInputBuffer(const base::TimeDelta& timeout, |
| 46 int* index) override; |
| 47 MediaCodecStatus DequeueOutputBuffer(const base::TimeDelta& timeout, |
| 48 int* index, |
| 49 size_t* offset, |
| 50 size_t* size, |
| 51 base::TimeDelta* presentation_time, |
| 52 bool* end_of_stream, |
| 53 bool* key_frame) override; |
| 54 void ReleaseOutputBuffer(int index, bool render) override; |
| 55 void GetInputBuffer(int input_buffer_index, |
| 56 uint8_t** data, |
| 57 size_t* capacity) override; |
| 58 bool CopyFromOutputBuffer(int index, |
| 59 size_t offset, |
| 60 void* dst, |
| 61 int dst_size) override; |
| 62 |
| 63 protected: |
| 64 NdkMediaCodecBridge(const std::string& mime, |
| 65 bool is_secure, |
| 66 MediaCodecDirection direction); |
| 67 |
| 68 private: |
| 69 struct AMediaCodecDeleter { |
| 70 inline void operator()(AMediaCodec* ptr) const { AMediaCodec_delete(ptr); } |
| 71 }; |
| 72 |
| 73 scoped_ptr<AMediaCodec, AMediaCodecDeleter> media_codec_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(NdkMediaCodecBridge); |
| 76 }; |
| 77 |
| 78 } // namespace media |
| 79 |
| 80 #endif // MEDIA_BASE_ANDROID_NDK_MEDIA_CODEC_BRIDGE_H_ |
| OLD | NEW |