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..ca190c95282a9700961ee3ea5971a522937c9fec |
--- /dev/null |
+++ b/media/base/android/webaudio_media_codec_bridge.h |
@@ -0,0 +1,57 @@ |
+// 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 |
palmer
2013/04/02 18:01:08
NIT: Capitalization and article: "...to call Java
|
+// android MediaCodec class. For more information on android MediaCodec, check |
+// http://developer.android.com/reference/android/media/MediaCodec.html. |
+class MEDIA_EXPORT WebAudioMediaCodecBridge { |
+public: |
+ // Create the bridge with the given file descriptors. We read from |
+ // |input_fd| to get the encoded audio data. Audio file information |
+ // and decoded pcm samples are written to |output_fd|. We also take |
palmer
2013/04/02 18:01:08
NIT: Capitalize initialisms: PCM.
|
+ // ownership of |output_fd|. |
+ WebAudioMediaCodecBridge(base::SharedMemoryHandle input_fd, |
palmer
2013/04/02 18:01:08
Use the same variable names for these objects here
|
+ 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, |
palmer
2013/04/02 18:01:08
NIT: |channel_count| is more concise.
|
+ jint sample_rate, |
+ jlong duration_us, |
+ jboolean is_vorbis); |
+ |
+private: |
+ // The encoded audio data is read from this file descriptor for the |
+ // shared memory that holds the encoded data. |
+ int input_fd_; |
+ |
+ // The audio file information and decoded pcm data are written to |
+ // this file descriptor. Owned. |
+ int output_fd_; |
+}; |
+ |
+} // namespace media |
+#endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ |