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

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 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,
felipeg 2013/03/29 17:18:29 Add a comment saying that this class takes ownersh
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 // The encoded audio data is read from this file descriptor for the
48 // shared memory that holds the encoded data.
49 int input_fd_;
felipeg 2013/03/29 17:18:29 // Owned.
50
51 // The audio file information and decoded pcm data are written to
52 // this file descriptor.
53 int output_fd_;
54 };
55
56 } // namespace media
57 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698