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 <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // when configuring this video decoder you can optionally render the buffer. | 114 // when configuring this video decoder you can optionally render the buffer. |
115 void ReleaseOutputBuffer(int index, bool render); | 115 void ReleaseOutputBuffer(int index, bool render); |
116 | 116 |
117 // Gets output buffers from media codec and keeps them inside the java class. | 117 // Gets output buffers from media codec and keeps them inside the java class. |
118 // To access them, use DequeueOutputBuffer(). | 118 // To access them, use DequeueOutputBuffer(). |
119 void GetOutputBuffers(); | 119 void GetOutputBuffers(); |
120 | 120 |
121 static bool RegisterMediaCodecBridge(JNIEnv* env); | 121 static bool RegisterMediaCodecBridge(JNIEnv* env); |
122 | 122 |
123 protected: | 123 protected: |
124 explicit MediaCodecBridge(const std::string& mime); | 124 MediaCodecBridge(const std::string& mime, bool is_secure); |
125 | 125 |
126 // Calls start() against the media codec instance. Used in StartXXX() after | 126 // Calls start() against the media codec instance. Used in StartXXX() after |
127 // configuring media codec. | 127 // configuring media codec. |
128 void StartInternal(); | 128 void StartInternal(); |
129 | 129 |
130 jobject media_codec() { return j_media_codec_.obj(); } | 130 jobject media_codec() { return j_media_codec_.obj(); } |
131 | 131 |
132 private: | 132 private: |
133 // Fills a particular input buffer and returns the size of copied data. | 133 // Fills a particular input buffer and returns the size of copied data. |
134 size_t FillInputBuffer(int index, const uint8* data, int data_size); | 134 size_t FillInputBuffer(int index, const uint8* data, int data_size); |
(...skipping 27 matching lines...) Expand all Loading... |
162 | 162 |
163 // Configure the java MediaFormat object with the extra codec data passed in. | 163 // Configure the java MediaFormat object with the extra codec data passed in. |
164 bool ConfigureMediaFormat(jobject j_format, const AudioCodec codec, | 164 bool ConfigureMediaFormat(jobject j_format, const AudioCodec codec, |
165 const uint8* extra_data, size_t extra_data_size); | 165 const uint8* extra_data, size_t extra_data_size); |
166 }; | 166 }; |
167 | 167 |
168 class MEDIA_EXPORT VideoCodecBridge : public MediaCodecBridge { | 168 class MEDIA_EXPORT VideoCodecBridge : public MediaCodecBridge { |
169 public: | 169 public: |
170 // Returns an VideoCodecBridge instance if |codec| is supported, or a NULL | 170 // Returns an VideoCodecBridge instance if |codec| is supported, or a NULL |
171 // pointer otherwise. | 171 // pointer otherwise. |
172 static VideoCodecBridge* Create(const VideoCodec codec); | 172 static VideoCodecBridge* Create(const VideoCodec codec, bool is_secure); |
173 | 173 |
174 // Start the video codec bridge. | 174 // Start the video codec bridge. |
175 // TODO(qinmin): Pass codec specific data if available. | 175 // TODO(qinmin): Pass codec specific data if available. |
176 bool Start(const VideoCodec codec, const gfx::Size& size, jobject surface, | 176 bool Start(const VideoCodec codec, const gfx::Size& size, jobject surface, |
177 jobject media_crypto); | 177 jobject media_crypto); |
178 | 178 |
179 private: | 179 private: |
180 explicit VideoCodecBridge(const std::string& mime); | 180 VideoCodecBridge(const std::string& mime, bool is_secure); |
181 }; | 181 }; |
182 | 182 |
183 } // namespace media | 183 } // namespace media |
184 | 184 |
185 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 185 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
186 | 186 |
OLD | NEW |