Chromium Code Reviews| Index: media/base/android/webaudio_media_codec_bridge.h |
| diff --git a/media/base/android/webaudio_media_codec_bridge.h b/media/base/android/webaudio_media_codec_bridge.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..52d210234f7176467047a9133c522aa1c499706c |
| --- /dev/null |
| +++ b/media/base/android/webaudio_media_codec_bridge.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| +#define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |
| + |
| +#include <jni.h> |
| + |
| +#include "base/file_descriptor_posix.h" |
| +#include "base/shared_memory.h" |
| +#include "media/base/media_export.h" |
| + |
| +namespace media { |
| + |
| +// This class serves as a bridge for native code to call java functions inside |
| +// android mediaplayer class. For more information on android mediaplayer, check |
| +// http://developer.android.com/reference/android/media/MediaPlayer.html |
| +// The actual android mediaplayer instance is created lazily when Start(), |
| +// Pause(), SeekTo() gets called. As a result, media information may not |
| +// be available until one of those operations is performed. After that, we |
| +// will cache those information in case the mediaplayer gets released. |
| +class MEDIA_EXPORT WebAudioMediaCodecBridge { |
| +public: |
| + WebAudioMediaCodecBridge(base::SharedMemoryHandle input_fd, |
| + base::FileDescriptor output_fd); |
| + ~WebAudioMediaCodecBridge(); |
| + |
| + bool DecodeInMemoryAudioFile(); |
| + static bool RegisterWebAudioMediaCodecBridge(JNIEnv* env); |
| + static void RunWebAudioMediaCodec(base::SharedMemoryHandle input_fd, |
| + base::FileDescriptor output_fd); |
| + |
| + void OnChunkDecoded(JNIEnv* env, |
| + jobject /*java object*/, |
| + jobject buf, |
| + jint buf_size); |
| + |
| + void InitializeDestination(JNIEnv* env, |
| + jobject /*java object*/, |
| + jint number_of_channels, |
| + jint sample_rate, |
| + jlong duration_us, |
| + jboolean is_vorbis); |
| + |
| +private: |
| + JNIEnv* env_; |
| + jobject j_context_; |
|
bulach
2013/03/28 13:39:25
nit: better not cache these two... JNIEnv* should
|
| + |
| + int input_fd_; |
| + int output_fd_; |
| +}; |
| + |
| +} // namespace media |
| +#endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |