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

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

Issue 12457043: Android implementation of WebAudio audio file decoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
OLDNEW
(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
17 // functions in the Android MediaCodec class. See
18 // http://developer.android.com/reference/android/media/MediaCodec.html.
19 class MEDIA_EXPORT WebAudioMediaCodecBridge {
20 public:
palmer 2013/04/10 00:57:53 NIT: public and private get indented by 1 space in
21 // Create the bridge with the given file descriptors. We read from
22 // |encoded_audio_handle| to get the encoded audio data. Audio file
23 // information and decoded PCM samples are written to |pcm_output|.
24 // We also take ownership of |pcm_output|.
25 WebAudioMediaCodecBridge(base::SharedMemoryHandle encoded_audio_handle,
26 base::FileDescriptor pcm_output);
27 ~WebAudioMediaCodecBridge();
28
29 bool DecodeInMemoryAudioFile();
30 static bool RegisterWebAudioMediaCodecBridge(JNIEnv* env);
31 static void RunWebAudioMediaCodec(
32 base::SharedMemoryHandle encoded_audio_handle,
33 base::FileDescriptor pcm_output);
34
35 void OnChunkDecoded(JNIEnv* env,
36 jobject /*java object*/,
37 jobject buf,
38 jint buf_size);
39
40 void InitializeDestination(JNIEnv* env,
41 jobject /*java object*/,
42 jint channel_count,
43 jint sample_rate,
44 jlong duration_us,
45 jboolean is_vorbis);
46
47 private:
48 // The encoded audio data is read from this file descriptor for the
49 // shared memory that holds the encoded data.
50 int encoded_audio_handle_;
51
52 // The audio file information and decoded pcm data are written to
53 // this file descriptor. Owned.
54 int pcm_output_;
55 };
56
57 } // namespace media
58 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698