| 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 <stdint.h> |
| 9 |
| 8 #include <set> | 10 #include <set> |
| 9 #include <string> | 11 #include <string> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 13 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 14 #include "media/base/android/media_codec_util.h" | 16 #include "media/base/android/media_codec_util.h" |
| 15 #include "media/base/media_export.h" | 17 #include "media/base/media_export.h" |
| 16 | 18 |
| 17 namespace media { | 19 namespace media { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Used for checking for new sampling rate after DequeueInputBuffer() returns | 69 // Used for checking for new sampling rate after DequeueInputBuffer() returns |
| 68 // INFO_OUTPUT_FORMAT_CHANGED | 70 // INFO_OUTPUT_FORMAT_CHANGED |
| 69 virtual int GetOutputSamplingRate() = 0; | 71 virtual int GetOutputSamplingRate() = 0; |
| 70 | 72 |
| 71 // Submits a byte array to the given input buffer. Call this after getting an | 73 // Submits a byte array to the given input buffer. Call this after getting an |
| 72 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the | 74 // available buffer from DequeueInputBuffer(). If |data| is NULL, assume the |
| 73 // input buffer has already been populated (but still obey |size|). | 75 // input buffer has already been populated (but still obey |size|). |
| 74 // |data_size| must be less than kint32max (because Java). | 76 // |data_size| must be less than kint32max (because Java). |
| 75 virtual MediaCodecStatus QueueInputBuffer( | 77 virtual MediaCodecStatus QueueInputBuffer( |
| 76 int index, | 78 int index, |
| 77 const uint8* data, | 79 const uint8_t* data, |
| 78 size_t data_size, | 80 size_t data_size, |
| 79 const base::TimeDelta& presentation_time) = 0; | 81 const base::TimeDelta& presentation_time) = 0; |
| 80 | 82 |
| 81 // Similar to the above call, but submits a buffer that is encrypted. Note: | 83 // Similar to the above call, but submits a buffer that is encrypted. Note: |
| 82 // NULL |subsamples| indicates the whole buffer is encrypted. If |data| is | 84 // NULL |subsamples| indicates the whole buffer is encrypted. If |data| is |
| 83 // NULL, assume the input buffer has already been populated (but still obey | 85 // NULL, assume the input buffer has already been populated (but still obey |
| 84 // |data_size|). |data_size| must be less than kint32max (because Java). | 86 // |data_size|). |data_size| must be less than kint32max (because Java). |
| 85 MediaCodecStatus QueueSecureInputBuffer( | 87 MediaCodecStatus QueueSecureInputBuffer( |
| 86 int index, | 88 int index, |
| 87 const uint8* data, | 89 const uint8_t* data, |
| 88 size_t data_size, | 90 size_t data_size, |
| 89 const std::string& key_id, | 91 const std::string& key_id, |
| 90 const std::string& iv, | 92 const std::string& iv, |
| 91 const std::vector<SubsampleEntry>& subsamples, | 93 const std::vector<SubsampleEntry>& subsamples, |
| 92 const base::TimeDelta& presentation_time); | 94 const base::TimeDelta& presentation_time); |
| 93 | 95 |
| 94 // Same QueueSecureInputBuffer overriden for the use with MediaSourcePlayer | 96 // Same QueueSecureInputBuffer overriden for the use with MediaSourcePlayer |
| 95 // and MediaCodecPlayer. | 97 // and MediaCodecPlayer. |
| 96 // TODO(timav): remove this method and keep only the one above after we | 98 // TODO(timav): remove this method and keep only the one above after we |
| 97 // switch to the Spitzer pipeline. | 99 // switch to the Spitzer pipeline. |
| 98 virtual MediaCodecStatus QueueSecureInputBuffer( | 100 virtual MediaCodecStatus QueueSecureInputBuffer( |
| 99 int index, | 101 int index, |
| 100 const uint8* data, | 102 const uint8_t* data, |
| 101 size_t data_size, | 103 size_t data_size, |
| 102 const std::vector<char>& key_id, | 104 const std::vector<char>& key_id, |
| 103 const std::vector<char>& iv, | 105 const std::vector<char>& iv, |
| 104 const SubsampleEntry* subsamples, | 106 const SubsampleEntry* subsamples, |
| 105 int subsamples_size, | 107 int subsamples_size, |
| 106 const base::TimeDelta& presentation_time) = 0; | 108 const base::TimeDelta& presentation_time) = 0; |
| 107 | 109 |
| 108 // Submits an empty buffer with a EOS (END OF STREAM) flag. | 110 // Submits an empty buffer with a EOS (END OF STREAM) flag. |
| 109 virtual void QueueEOS(int input_buffer_index) = 0; | 111 virtual void QueueEOS(int input_buffer_index) = 0; |
| 110 | 112 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Returns the number of output buffers used by the codec. | 144 // Returns the number of output buffers used by the codec. |
| 143 // TODO(qinmin): this call is deprecated in Lollipop. | 145 // TODO(qinmin): this call is deprecated in Lollipop. |
| 144 virtual int GetOutputBuffersCount(); | 146 virtual int GetOutputBuffersCount(); |
| 145 | 147 |
| 146 // Returns the capacity of each output buffer used by the codec. | 148 // Returns the capacity of each output buffer used by the codec. |
| 147 // TODO(qinmin): this call is deprecated in Lollipop. | 149 // TODO(qinmin): this call is deprecated in Lollipop. |
| 148 virtual size_t GetOutputBuffersCapacity(); | 150 virtual size_t GetOutputBuffersCapacity(); |
| 149 | 151 |
| 150 // Returns an input buffer's base pointer and capacity. | 152 // Returns an input buffer's base pointer and capacity. |
| 151 virtual void GetInputBuffer(int input_buffer_index, | 153 virtual void GetInputBuffer(int input_buffer_index, |
| 152 uint8** data, | 154 uint8_t** data, |
| 153 size_t* capacity) = 0; | 155 size_t* capacity) = 0; |
| 154 | 156 |
| 155 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into | 157 // Copy |dst_size| bytes from output buffer |index|'s |offset| onwards into |
| 156 // |*dst|. | 158 // |*dst|. |
| 157 virtual bool CopyFromOutputBuffer(int index, | 159 virtual bool CopyFromOutputBuffer(int index, |
| 158 size_t offset, | 160 size_t offset, |
| 159 void* dst, | 161 void* dst, |
| 160 int dst_size) = 0; | 162 int dst_size) = 0; |
| 161 | 163 |
| 162 protected: | 164 protected: |
| 163 MediaCodecBridge(); | 165 MediaCodecBridge(); |
| 164 | 166 |
| 165 // Fills a particular input buffer; returns false if |data_size| exceeds the | 167 // Fills a particular input buffer; returns false if |data_size| exceeds the |
| 166 // input buffer's capacity (and doesn't touch the input buffer in that case). | 168 // input buffer's capacity (and doesn't touch the input buffer in that case). |
| 167 bool FillInputBuffer(int index, | 169 bool FillInputBuffer(int index, |
| 168 const uint8* data, | 170 const uint8_t* data, |
| 169 size_t data_size) WARN_UNUSED_RESULT; | 171 size_t data_size) WARN_UNUSED_RESULT; |
| 170 | 172 |
| 171 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); | 173 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); |
| 172 }; | 174 }; |
| 173 | 175 |
| 174 } // namespace media | 176 } // namespace media |
| 175 | 177 |
| 176 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | 178 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| OLD | NEW |