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 | |
palmer
2013/04/02 18:01:08
NIT: Capitalization and article: "...to call Java
| |
17 // android MediaCodec class. For more information on android MediaCodec, check | |
18 // http://developer.android.com/reference/android/media/MediaCodec.html. | |
19 class MEDIA_EXPORT WebAudioMediaCodecBridge { | |
20 public: | |
21 // Create the bridge with the given file descriptors. We read from | |
22 // |input_fd| to get the encoded audio data. Audio file information | |
23 // and decoded pcm samples are written to |output_fd|. We also take | |
palmer
2013/04/02 18:01:08
NIT: Capitalize initialisms: PCM.
| |
24 // ownership of |output_fd|. | |
25 WebAudioMediaCodecBridge(base::SharedMemoryHandle input_fd, | |
palmer
2013/04/02 18:01:08
Use the same variable names for these objects here
| |
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, | |
palmer
2013/04/02 18:01:08
NIT: |channel_count| is more concise.
| |
42 jint sample_rate, | |
43 jlong duration_us, | |
44 jboolean is_vorbis); | |
45 | |
46 private: | |
47 // The encoded audio data is read from this file descriptor for the | |
48 // shared memory that holds the encoded data. | |
49 int input_fd_; | |
50 | |
51 // The audio file information and decoded pcm data are written to | |
52 // this file descriptor. Owned. | |
53 int output_fd_; | |
54 }; | |
55 | |
56 } // namespace media | |
57 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ | |
OLD | NEW |