aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mediacodec_wrapper.h
diff options
context:
space:
mode:
authorZhao Zhili <zhilizhao@tencent.com>2024-11-06 20:31:28 +0800
committerZhao Zhili <zhilizhao@tencent.com>2024-11-20 19:23:13 +0800
commit9aacbfb6caab2517e31b3ce4eea45f92efeadf64 (patch)
tree0703a340e8371c6f56fc37ccd6e18f5794a90e72 /libavcodec/mediacodec_wrapper.h
parentfa2ff5effcf3767fadbfcde1b8e826f1acb505c1 (diff)
downloadffmpeg-9aacbfb6caab2517e31b3ce4eea45f92efeadf64.tar.gz
avcodec/mediacodec_wrapper: add async mode support
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavcodec/mediacodec_wrapper.h')
-rw-r--r--libavcodec/mediacodec_wrapper.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/mediacodec_wrapper.h b/libavcodec/mediacodec_wrapper.h
index 11a4260497..18d0796445 100644
--- a/libavcodec/mediacodec_wrapper.h
+++ b/libavcodec/mediacodec_wrapper.h
@@ -178,6 +178,22 @@ struct FFAMediaCodecBufferInfo {
typedef struct FFAMediaCodecBufferInfo FFAMediaCodecBufferInfo;
typedef struct FFAMediaCodec FFAMediaCodec;
+
+typedef struct FFAMediaCodecOnAsyncNotifyCallback {
+ void (*onAsyncInputAvailable)(FFAMediaCodec *codec, void *userdata,
+ int32_t index);
+
+ void (*onAsyncOutputAvailable)(FFAMediaCodec *codec, void *userdata,
+ int32_t index,
+ FFAMediaCodecBufferInfo *buffer_info);
+
+ void (*onAsyncFormatChanged)(FFAMediaCodec *codec, void *userdata,
+ FFAMediaFormat *format);
+
+ void (*onAsyncError)(FFAMediaCodec *codec, void *userdata, int error,
+ const char *detail);
+} FFAMediaCodecOnAsyncNotifyCallback;
+
struct FFAMediaCodec {
const AVClass *class;
@@ -219,6 +235,11 @@ struct FFAMediaCodec {
// For encoder with FFANativeWindow as input.
int (*signalEndOfInputStream)(FFAMediaCodec *);
+
+ // Introduced in Android API 28
+ int (*setAsyncNotifyCallback)(FFAMediaCodec *codec,
+ const FFAMediaCodecOnAsyncNotifyCallback *callback,
+ void *userdata);
};
static inline char *ff_AMediaCodec_getName(FFAMediaCodec *codec)
@@ -343,6 +364,13 @@ static inline int ff_AMediaCodec_signalEndOfInputStream(FFAMediaCodec *codec)
return codec->signalEndOfInputStream(codec);
}
+static inline int ff_AMediaCodec_setAsyncNotifyCallback(FFAMediaCodec *codec,
+ const FFAMediaCodecOnAsyncNotifyCallback *callback,
+ void *userdata)
+{
+ return codec->setAsyncNotifyCallback(codec, callback, userdata);
+}
+
int ff_Build_SDK_INT(AVCodecContext *avctx);
enum FFAMediaFormatColorRange {