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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy | 100 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy |
101 // vendor's implementation , b/8125974, Stop() -> StartAudio/Video() may not | 101 // vendor's implementation , b/8125974, Stop() -> StartAudio/Video() may not |
102 // work on some devices. For reliability, Stop() -> delete and recreate new | 102 // work on some devices. For reliability, Stop() -> delete and recreate new |
103 // instance -> StartAudio/Video() is recommended. | 103 // instance -> StartAudio/Video() is recommended. |
104 void Stop(); | 104 void Stop(); |
105 | 105 |
106 // Used for getting output format. This is valid after DequeueInputBuffer() | 106 // Used for getting output format. This is valid after DequeueInputBuffer() |
107 // returns a format change by returning INFO_OUTPUT_FORMAT_CHANGED | 107 // returns a format change by returning INFO_OUTPUT_FORMAT_CHANGED |
108 void GetOutputFormat(int* width, int* height); | 108 void GetOutputFormat(int* width, int* height); |
109 | 109 |
110 // Used for checking for new sampling rate after DequeueInputBuffer() returns | |
111 // INFO_OUTPUT_FORMAT_CHANGED | |
112 void GetOutputSamplingRate(int* sampling_rate); | |
qinmin
2015/01/21 02:04:13
why not int GetOutputSamplingRate() as there is on
kjoswiak
2015/01/21 03:21:18
Done.
| |
113 | |
110 // Submits a byte array to the given input buffer. Call this after getting an | 114 // Submits a byte array to the given input buffer. Call this after getting an |
111 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the | 115 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the |
112 // input buffer has already been populated (but still obey |size|). | 116 // input buffer has already been populated (but still obey |size|). |
113 // |data_size| must be less than kint32max (because Java). | 117 // |data_size| must be less than kint32max (because Java). |
114 MediaCodecStatus QueueInputBuffer(int index, | 118 MediaCodecStatus QueueInputBuffer(int index, |
115 const uint8* data, | 119 const uint8* data, |
116 size_t data_size, | 120 size_t data_size, |
117 const base::TimeDelta& presentation_time); | 121 const base::TimeDelta& presentation_time); |
118 | 122 |
119 // Similar to the above call, but submits a buffer that is encrypted. Note: | 123 // Similar to the above call, but submits a buffer that is encrypted. Note: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 | 179 |
176 // Returns an input buffer's base pointer and capacity. | 180 // Returns an input buffer's base pointer and capacity. |
177 void GetInputBuffer(int input_buffer_index, uint8** data, size_t* capacity); | 181 void GetInputBuffer(int input_buffer_index, uint8** data, size_t* capacity); |
178 | 182 |
179 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into | 183 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into |
180 // |*dst|. | 184 // |*dst|. |
181 bool CopyFromOutputBuffer(int index, size_t offset, void* dst, int dst_size); | 185 bool CopyFromOutputBuffer(int index, size_t offset, void* dst, int dst_size); |
182 | 186 |
183 static bool RegisterMediaCodecBridge(JNIEnv* env); | 187 static bool RegisterMediaCodecBridge(JNIEnv* env); |
184 | 188 |
189 // Returns true if reconfigure is successful, false otherwise | |
190 bool ReconfigureAudioTrack(); | |
191 | |
185 protected: | 192 protected: |
186 // Returns true if |mime_type| is known to be unaccelerated (i.e. backed by a | 193 // Returns true if |mime_type| is known to be unaccelerated (i.e. backed by a |
187 // software codec instead of a hardware one). | 194 // software codec instead of a hardware one). |
188 static bool IsKnownUnaccelerated(const std::string& mime_type, | 195 static bool IsKnownUnaccelerated(const std::string& mime_type, |
189 MediaCodecDirection direction); | 196 MediaCodecDirection direction); |
190 | 197 |
191 MediaCodecBridge(const std::string& mime, | 198 MediaCodecBridge(const std::string& mime, |
192 bool is_secure, | 199 bool is_secure, |
193 MediaCodecDirection direction); | 200 MediaCodecDirection direction); |
194 | 201 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 VideoCodecBridge(const std::string& mime, | 294 VideoCodecBridge(const std::string& mime, |
288 bool is_secure, | 295 bool is_secure, |
289 MediaCodecDirection direction); | 296 MediaCodecDirection direction); |
290 | 297 |
291 int adaptive_playback_supported_for_testing_; | 298 int adaptive_playback_supported_for_testing_; |
292 }; | 299 }; |
293 | 300 |
294 } // namespace media | 301 } // namespace media |
295 | 302 |
296 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 303 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
OLD | NEW |