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

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

Issue 23517002: MediaSourcePlayer implements IsTypeSupported(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 3 months 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 | Annotate | Revision Log
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_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 21 matching lines...) Expand all
32 INFO_TRY_AGAIN_LATER = -1, 32 INFO_TRY_AGAIN_LATER = -1,
33 INFO_MEDIA_CODEC_ERROR = -1000, 33 INFO_MEDIA_CODEC_ERROR = -1000,
34 }; 34 };
35 35
36 static const base::TimeDelta kTimeOutInfinity; 36 static const base::TimeDelta kTimeOutInfinity;
37 static const base::TimeDelta kTimeOutNoWait; 37 static const base::TimeDelta kTimeOutNoWait;
38 38
39 // Returns true if MediaCodec is available on the device. 39 // Returns true if MediaCodec is available on the device.
40 static bool IsAvailable(); 40 static bool IsAvailable();
41 41
42 // Returns if MediaCodecBridge can decode |mime| type in |secure| mode.
43 static bool IsDecoderSupported(const std::string& mime, bool secure);
44
42 virtual ~MediaCodecBridge(); 45 virtual ~MediaCodecBridge();
43 46
44 // Resets both input and output, all indices previously returned in calls to 47 // Resets both input and output, all indices previously returned in calls to
45 // DequeueInputBuffer() and DequeueOutputBuffer() become invalid. 48 // DequeueInputBuffer() and DequeueOutputBuffer() become invalid.
46 // Please note that this clears all the inputs in the media codec. In other 49 // Please note that this clears all the inputs in the media codec. In other
47 // words, there will be no outputs until new input is provided. 50 // words, there will be no outputs until new input is provided.
48 void Reset(); 51 void Reset();
49 52
50 // Finishes the decode/encode session. The instance remains active 53 // Finishes the decode/encode session. The instance remains active
51 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy 54 // and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // when configuring this video decoder you can optionally render the buffer. 96 // when configuring this video decoder you can optionally render the buffer.
94 void ReleaseOutputBuffer(int index, bool render); 97 void ReleaseOutputBuffer(int index, bool render);
95 98
96 // Gets output buffers from media codec and keeps them inside the java class. 99 // Gets output buffers from media codec and keeps them inside the java class.
97 // To access them, use DequeueOutputBuffer(). 100 // To access them, use DequeueOutputBuffer().
98 void GetOutputBuffers(); 101 void GetOutputBuffers();
99 102
100 static bool RegisterMediaCodecBridge(JNIEnv* env); 103 static bool RegisterMediaCodecBridge(JNIEnv* env);
101 104
102 protected: 105 protected:
103 explicit MediaCodecBridge(const char* mime); 106 explicit MediaCodecBridge(const std::string& mime);
104 107
105 // Calls start() against the media codec instance. Used in StartXXX() after 108 // Calls start() against the media codec instance. Used in StartXXX() after
106 // configuring media codec. 109 // configuring media codec.
107 void StartInternal(); 110 void StartInternal();
108 111
109 jobject media_codec() { return j_media_codec_.obj(); } 112 jobject media_codec() { return j_media_codec_.obj(); }
110 113
111 private: 114 private:
112 // Fills a particular input buffer and returns the size of copied data. 115 // Fills a particular input buffer and returns the size of copied data.
113 size_t FillInputBuffer(int index, const uint8* data, int data_size); 116 size_t FillInputBuffer(int index, const uint8* data, int data_size);
(...skipping 16 matching lines...) Expand all
130 bool play_audio, jobject media_crypto); 133 bool play_audio, jobject media_crypto);
131 134
132 // Play the output buffer. This call must be called after 135 // Play the output buffer. This call must be called after
133 // DequeueOutputBuffer() and before ReleaseOutputBuffer. 136 // DequeueOutputBuffer() and before ReleaseOutputBuffer.
134 void PlayOutputBuffer(int index, size_t size); 137 void PlayOutputBuffer(int index, size_t size);
135 138
136 // Set the volume of the audio output. 139 // Set the volume of the audio output.
137 void SetVolume(double volume); 140 void SetVolume(double volume);
138 141
139 private: 142 private:
140 explicit AudioCodecBridge(const char* mime); 143 explicit AudioCodecBridge(const std::string& mime);
141 144
142 // Configure the java MediaFormat object with the extra codec data passed in. 145 // Configure the java MediaFormat object with the extra codec data passed in.
143 bool ConfigureMediaFormat(jobject j_format, const AudioCodec codec, 146 bool ConfigureMediaFormat(jobject j_format, const AudioCodec codec,
144 const uint8* extra_data, size_t extra_data_size); 147 const uint8* extra_data, size_t extra_data_size);
145 }; 148 };
146 149
147 class MEDIA_EXPORT VideoCodecBridge : public MediaCodecBridge { 150 class MEDIA_EXPORT VideoCodecBridge : public MediaCodecBridge {
148 public: 151 public:
149 // Returns an VideoCodecBridge instance if |codec| is supported, or a NULL 152 // Returns an VideoCodecBridge instance if |codec| is supported, or a NULL
150 // pointer otherwise. 153 // pointer otherwise.
151 static VideoCodecBridge* Create(const VideoCodec codec); 154 static VideoCodecBridge* Create(const VideoCodec codec);
152 155
153 // Start the video codec bridge. 156 // Start the video codec bridge.
154 // TODO(qinmin): Pass codec specific data if available. 157 // TODO(qinmin): Pass codec specific data if available.
155 bool Start(const VideoCodec codec, const gfx::Size& size, jobject surface, 158 bool Start(const VideoCodec codec, const gfx::Size& size, jobject surface,
156 jobject media_crypto); 159 jobject media_crypto);
157 160
158 private: 161 private:
159 explicit VideoCodecBridge(const char* mime); 162 explicit VideoCodecBridge(const std::string& mime);
160 }; 163 };
161 164
162 } // namespace media 165 } // namespace media
163 166
164 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ 167 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
165 168
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698