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

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

Issue 11973010: AndroidVDA by using Android's MediaCodec API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 11 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 #include <string>
10
11 #include "base/android/scoped_java_ref.h"
12 //#include "base/callback.h"
13 //#include "base/memory/ref_counted.h"
14
15 // This class serves as a bridge for native code to call java functions inside
16 // Android MediaCodec class. For more information on Android MediaCodec, check
17 // http://developer.android.com/reference/android/media/MediaCodec.html
18
19 namespace media {
20
21 class MediaCodecBridge {
22 public:
23 explicit MediaCodecBridge(const std::string& type);
24
25 ~MediaCodecBridge();
26
27 void ConfigureAudio(const std::string& mime, int sample_rate,
28 int channel_count, const uint8* csd0, int csd0_size, const uint8* csd1,
29 int csd1_size, int encoder_delay, int encoder_padding,
30 int max_input_size);
31 void ConfigureVideo(const std::string& mime, int width, int height,
32 const uint8* csd0, int csd0_size, const uint8* csd1, int csd1_size,
33 jobject surface);
34
35 void Start();
36 void Flush();
37 void Stop();
38 void Release();
39
40 void GetOutputFormat(int* format, int* width, int* height);
41
42 void QueueInputBuffer(int index, int offset, int size,
43 int64 presentation_time_us, int flags);
44 int DequeueInputBuffer(int64 timeout_us);
45 int DequeueOutputBuffer(
46 int64 timeout_us, int* offset, int* size, int64* presentation_time_us,
47 int* flags);
48 void ReleaseOutputBuffer(int index, bool render);
49
50 int GetInputBuffers();
51 int GetOutputBuffers();
52
53 void PutToInputBuffer(int index, const uint8* data, int size);
54 void GetFromOutputBuffer(int index, int offset, uint8* data, int size);
55 void GetFromOutputBuffer(int index,
56 uint8* data0, int size0,
57 uint8* data1, int size1,
58 uint8* data2, int size2);
59
60 private:
61 // Java MediaCodec instance.
62 base::android::ScopedJavaGlobalRef<jobject> j_media_codec_;
63
64 base::android::ScopedJavaGlobalRef<jobjectArray> j_input_buffers_;
65 base::android::ScopedJavaGlobalRef<jobjectArray> j_output_buffers_;
66
67 int j_byte_array_size_;
68 base::android::ScopedJavaGlobalRef<jbyteArray> j_byte_array_;
69
70 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge);
71 };
72
73 } // namespace media
74
75 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
76
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698