Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | |
| 7 | |
| 8 #include <jni.h> | |
| 9 | |
| 10 #include "base/file_descriptor_posix.h" | |
| 11 #include "base/shared_memory.h" | |
| 12 #include "media/base/media_export.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 // This class serves as a bridge for native code to call java functions inside | |
| 17 // android mediaplayer class. For more information on android mediaplayer, check | |
| 18 // http://developer.android.com/reference/android/media/MediaPlayer.html | |
| 19 // The actual android mediaplayer instance is created lazily when Start(), | |
| 20 // Pause(), SeekTo() gets called. As a result, media information may not | |
| 21 // be available until one of those operations is performed. After that, we | |
| 22 // will cache those information in case the mediaplayer gets released. | |
| 23 class MEDIA_EXPORT WebAudioMediaCodecBridge { | |
| 24 public: | |
| 25 WebAudioMediaCodecBridge(base::SharedMemoryHandle input_fd, | |
| 26 base::FileDescriptor output_fd); | |
| 27 ~WebAudioMediaCodecBridge(); | |
| 28 | |
| 29 bool DecodeInMemoryAudioFile(); | |
| 30 static bool RegisterWebAudioMediaCodecBridge(JNIEnv* env); | |
| 31 static void RunWebAudioMediaCodec(base::SharedMemoryHandle input_fd, | |
| 32 base::FileDescriptor output_fd); | |
| 33 | |
| 34 void OnChunkDecoded(JNIEnv* env, | |
| 35 jobject /*java object*/, | |
| 36 jobject buf, | |
| 37 jint buf_size); | |
| 38 | |
| 39 void InitializeDestination(JNIEnv* env, | |
| 40 jobject /*java object*/, | |
| 41 jint number_of_channels, | |
| 42 jint sample_rate, | |
| 43 jlong duration_us, | |
| 44 jboolean is_vorbis); | |
| 45 | |
| 46 private: | |
| 47 JNIEnv* env_; | |
| 48 jobject j_context_; | |
|
bulach
2013/03/28 13:39:25
nit: better not cache these two... JNIEnv* should
| |
| 49 | |
| 50 int input_fd_; | |
| 51 int output_fd_; | |
| 52 }; | |
| 53 | |
| 54 } // namespace media | |
| 55 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | |
| OLD | NEW |