| Index: media/base/android/media_codec_bridge.h
|
| diff --git a/media/base/android/media_codec_bridge.h b/media/base/android/media_codec_bridge.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e0690da397cd87a75ff3764cdef4b14b9e4ad261
|
| --- /dev/null
|
| +++ b/media/base/android/media_codec_bridge.h
|
| @@ -0,0 +1,76 @@
|
| +// 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 <string>
|
| +
|
| +#include "base/android/scoped_java_ref.h"
|
| +//#include "base/callback.h"
|
| +//#include "base/memory/ref_counted.h"
|
| +
|
| +// This class serves as a bridge for native code to call java functions inside
|
| +// Android MediaCodec class. For more information on Android MediaCodec, check
|
| +// http://developer.android.com/reference/android/media/MediaCodec.html
|
| +
|
| +namespace media {
|
| +
|
| +class MediaCodecBridge {
|
| + public:
|
| + explicit MediaCodecBridge(const std::string& type);
|
| +
|
| + ~MediaCodecBridge();
|
| +
|
| + void ConfigureAudio(const std::string& mime, int sample_rate,
|
| + int channel_count, const uint8* csd0, int csd0_size, const uint8* csd1,
|
| + int csd1_size, int encoder_delay, int encoder_padding,
|
| + int max_input_size);
|
| + void ConfigureVideo(const std::string& mime, int width, int height,
|
| + const uint8* csd0, int csd0_size, const uint8* csd1, int csd1_size,
|
| + jobject surface);
|
| +
|
| + void Start();
|
| + void Flush();
|
| + void Stop();
|
| + void Release();
|
| +
|
| + void GetOutputFormat(int* format, int* width, int* height);
|
| +
|
| + void QueueInputBuffer(int index, int offset, int size,
|
| + int64 presentation_time_us, int flags);
|
| + int DequeueInputBuffer(int64 timeout_us);
|
| + int DequeueOutputBuffer(
|
| + int64 timeout_us, int* offset, int* size, int64* presentation_time_us,
|
| + int* flags);
|
| + void ReleaseOutputBuffer(int index, bool render);
|
| +
|
| + int GetInputBuffers();
|
| + int GetOutputBuffers();
|
| +
|
| + void PutToInputBuffer(int index, const uint8* data, int size);
|
| + void GetFromOutputBuffer(int index, int offset, uint8* data, int size);
|
| + void GetFromOutputBuffer(int index,
|
| + uint8* data0, int size0,
|
| + uint8* data1, int size1,
|
| + uint8* data2, int size2);
|
| +
|
| + private:
|
| + // Java MediaCodec instance.
|
| + base::android::ScopedJavaGlobalRef<jobject> j_media_codec_;
|
| +
|
| + base::android::ScopedJavaGlobalRef<jobjectArray> j_input_buffers_;
|
| + base::android::ScopedJavaGlobalRef<jobjectArray> j_output_buffers_;
|
| +
|
| + int j_byte_array_size_;
|
| + base::android::ScopedJavaGlobalRef<jbyteArray> j_byte_array_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge);
|
| +};
|
| +
|
| +} // namespace media
|
| +
|
| +#endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
|
| +
|
|
|