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