Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: media/base/android/sdk_media_codec_bridge.h

Issue 1499423004: Remove kint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint9
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SDK_MEDIA_CODEC_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h>
10
9 #include <set> 11 #include <set>
10 #include <string> 12 #include <string>
11 13
12 #include "base/android/scoped_java_ref.h" 14 #include "base/android/scoped_java_ref.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/time/time.h" 16 #include "base/time/time.h"
15 #include "media/base/android/media_codec_bridge.h" 17 #include "media/base/android/media_codec_bridge.h"
16 #include "media/base/audio_decoder_config.h" 18 #include "media/base/audio_decoder_config.h"
17 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
18 #include "media/base/video_decoder_config.h" 20 #include "media/base/video_decoder_config.h"
19 #include "ui/gfx/geometry/size.h" 21 #include "ui/gfx/geometry/size.h"
20 22
21 namespace media { 23 namespace media {
22 24
23 // This class implements MediaCodecBridge using android MediaCodec SDK APIs. 25 // This class implements MediaCodecBridge using android MediaCodec SDK APIs.
24 class MEDIA_EXPORT SdkMediaCodecBridge : public MediaCodecBridge { 26 class MEDIA_EXPORT SdkMediaCodecBridge : public MediaCodecBridge {
25 public: 27 public:
26 ~SdkMediaCodecBridge() override; 28 ~SdkMediaCodecBridge() override;
27 29
28 // MediaCodecBridge implementations. 30 // MediaCodecBridge implementations.
29 MediaCodecStatus Reset() override; 31 MediaCodecStatus Reset() override;
30 bool Start() override; 32 bool Start() override;
31 void Stop() override; 33 void Stop() override;
32 void GetOutputFormat(int* width, int* height) override; 34 void GetOutputFormat(int* width, int* height) override;
33 int GetOutputSamplingRate() override; 35 int GetOutputSamplingRate() override;
34 MediaCodecStatus QueueInputBuffer( 36 MediaCodecStatus QueueInputBuffer(
35 int index, 37 int index,
36 const uint8* data, 38 const uint8_t* data,
37 size_t data_size, 39 size_t data_size,
38 const base::TimeDelta& presentation_time) override; 40 const base::TimeDelta& presentation_time) override;
39 using MediaCodecBridge::QueueSecureInputBuffer; 41 using MediaCodecBridge::QueueSecureInputBuffer;
40 MediaCodecStatus QueueSecureInputBuffer( 42 MediaCodecStatus QueueSecureInputBuffer(
41 int index, 43 int index,
42 const uint8* data, 44 const uint8_t* data,
43 size_t data_size, 45 size_t data_size,
44 const std::vector<char>& key_id, 46 const std::vector<char>& key_id,
45 const std::vector<char>& iv, 47 const std::vector<char>& iv,
46 const SubsampleEntry* subsamples, 48 const SubsampleEntry* subsamples,
47 int subsamples_size, 49 int subsamples_size,
48 const base::TimeDelta& presentation_time) override; 50 const base::TimeDelta& presentation_time) override;
49 void QueueEOS(int input_buffer_index) override; 51 void QueueEOS(int input_buffer_index) override;
50 MediaCodecStatus DequeueInputBuffer(const base::TimeDelta& timeout, 52 MediaCodecStatus DequeueInputBuffer(const base::TimeDelta& timeout,
51 int* index) override; 53 int* index) override;
52 MediaCodecStatus DequeueOutputBuffer(const base::TimeDelta& timeout, 54 MediaCodecStatus DequeueOutputBuffer(const base::TimeDelta& timeout,
53 int* index, 55 int* index,
54 size_t* offset, 56 size_t* offset,
55 size_t* size, 57 size_t* size,
56 base::TimeDelta* presentation_time, 58 base::TimeDelta* presentation_time,
57 bool* end_of_stream, 59 bool* end_of_stream,
58 bool* key_frame) override; 60 bool* key_frame) override;
59 void ReleaseOutputBuffer(int index, bool render) override; 61 void ReleaseOutputBuffer(int index, bool render) override;
60 int GetOutputBuffersCount() override; 62 int GetOutputBuffersCount() override;
61 size_t GetOutputBuffersCapacity() override; 63 size_t GetOutputBuffersCapacity() override;
62 void GetInputBuffer(int input_buffer_index, 64 void GetInputBuffer(int input_buffer_index,
63 uint8** data, 65 uint8_t** data,
64 size_t* capacity) override; 66 size_t* capacity) override;
65 bool CopyFromOutputBuffer(int index, 67 bool CopyFromOutputBuffer(int index,
66 size_t offset, 68 size_t offset,
67 void* dst, 69 void* dst,
68 int dst_size) override; 70 int dst_size) override;
69 71
70 static bool RegisterSdkMediaCodecBridge(JNIEnv* env); 72 static bool RegisterSdkMediaCodecBridge(JNIEnv* env);
71 73
72 protected: 74 protected:
73 SdkMediaCodecBridge(const std::string& mime, 75 SdkMediaCodecBridge(const std::string& mime,
(...skipping 24 matching lines...) Expand all
98 // pointer otherwise. 100 // pointer otherwise.
99 static AudioCodecBridge* Create(const AudioCodec& codec); 101 static AudioCodecBridge* Create(const AudioCodec& codec);
100 102
101 // See MediaCodecUtil::IsKnownUnaccelerated(). 103 // See MediaCodecUtil::IsKnownUnaccelerated().
102 static bool IsKnownUnaccelerated(const AudioCodec& codec); 104 static bool IsKnownUnaccelerated(const AudioCodec& codec);
103 105
104 // Start the audio codec bridge. 106 // Start the audio codec bridge.
105 bool ConfigureAndStart(const AudioCodec& codec, 107 bool ConfigureAndStart(const AudioCodec& codec,
106 int sample_rate, 108 int sample_rate,
107 int channel_count, 109 int channel_count,
108 const uint8* extra_data, 110 const uint8_t* extra_data,
109 size_t extra_data_size, 111 size_t extra_data_size,
110 int64 codec_delay_ns, 112 int64_t codec_delay_ns,
111 int64 seek_preroll_ns, 113 int64_t seek_preroll_ns,
112 bool play_audio, 114 bool play_audio,
113 jobject media_crypto) WARN_UNUSED_RESULT; 115 jobject media_crypto) WARN_UNUSED_RESULT;
114 116
115 // Plays the output buffer right away or save for later playback if |postpone| 117 // Plays the output buffer right away or save for later playback if |postpone|
116 // is set to true. This call must be called after DequeueOutputBuffer() and 118 // is set to true. This call must be called after DequeueOutputBuffer() and
117 // before ReleaseOutputBuffer. The data is extracted from the output buffers 119 // before ReleaseOutputBuffer. The data is extracted from the output buffers
118 // using |index|, |size| and |offset|. Returns the playback head position 120 // using |index|, |size| and |offset|. Returns the playback head position
119 // expressed in frames. 121 // expressed in frames.
120 // When |postpone| is set to true, the next PlayOutputBuffer() should have 122 // When |postpone| is set to true, the next PlayOutputBuffer() should have
121 // postpone == false, and it will play two buffers: the postponed one and 123 // postpone == false, and it will play two buffers: the postponed one and
122 // the one identified by |index|. 124 // the one identified by |index|.
123 int64 PlayOutputBuffer(int index, 125 int64_t PlayOutputBuffer(int index,
124 size_t size, 126 size_t size,
125 size_t offset, 127 size_t offset,
126 bool postpone = false); 128 bool postpone = false);
127 129
128 // Set the volume of the audio output. 130 // Set the volume of the audio output.
129 void SetVolume(double volume); 131 void SetVolume(double volume);
130 132
131 private: 133 private:
132 explicit AudioCodecBridge(const std::string& mime); 134 explicit AudioCodecBridge(const std::string& mime);
133 135
134 // Configure the java MediaFormat object with the extra codec data passed in. 136 // Configure the java MediaFormat object with the extra codec data passed in.
135 bool ConfigureMediaFormat(jobject j_format, 137 bool ConfigureMediaFormat(jobject j_format,
136 const AudioCodec& codec, 138 const AudioCodec& codec,
137 const uint8* extra_data, 139 const uint8_t* extra_data,
138 size_t extra_data_size, 140 size_t extra_data_size,
139 int64 codec_delay_ns, 141 int64_t codec_delay_ns,
140 int64 seek_preroll_ns); 142 int64_t seek_preroll_ns);
141 }; 143 };
142 144
143 // Class for handling video encoding/decoding using android MediaCodec APIs. 145 // Class for handling video encoding/decoding using android MediaCodec APIs.
144 // TODO(qinmin): implement the logic to switch between NDK and SDK 146 // TODO(qinmin): implement the logic to switch between NDK and SDK
145 // MediaCodecBridge. 147 // MediaCodecBridge.
146 class MEDIA_EXPORT VideoCodecBridge : public SdkMediaCodecBridge { 148 class MEDIA_EXPORT VideoCodecBridge : public SdkMediaCodecBridge {
147 public: 149 public:
148 // See MediaCodecUtil::IsKnownUnaccelerated(). 150 // See MediaCodecUtil::IsKnownUnaccelerated().
149 static bool IsKnownUnaccelerated(const VideoCodec& codec, 151 static bool IsKnownUnaccelerated(const VideoCodec& codec,
150 MediaCodecDirection direction); 152 MediaCodecDirection direction);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 VideoCodecBridge(const std::string& mime, 189 VideoCodecBridge(const std::string& mime,
188 bool is_secure, 190 bool is_secure,
189 MediaCodecDirection direction); 191 MediaCodecDirection direction);
190 192
191 int adaptive_playback_supported_for_testing_; 193 int adaptive_playback_supported_for_testing_;
192 }; 194 };
193 195
194 } // namespace media 196 } // namespace media
195 197
196 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ 198 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_
OLDNEW
« no previous file with comments | « media/base/android/ndk_media_codec_bridge.cc ('k') | media/base/android/sdk_media_codec_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698