From cdb42cdc5ccb785edabe1ee6407134fbae5662a9 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Thu, 8 May 2014 14:46:05 -0700 Subject: Add AMediaCodec callback Change-Id: I33b7ff3bcdcff6d3a5e1db385b900ae18b7e0f03 --- include/ndk/NdkMediaCodec.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ndk/NdkMediaCodec.h b/include/ndk/NdkMediaCodec.h index 2af88d0..c35c6b3 100644 --- a/include/ndk/NdkMediaCodec.h +++ b/include/ndk/NdkMediaCodec.h @@ -55,7 +55,6 @@ enum { AMEDIACODEC_INFO_TRY_AGAIN_LATER = -1 }; - /** * Create codec by name. Use this if you know the exact codec you want to use. * When configuring, you will need to specify whether to use the codec as an @@ -140,6 +139,17 @@ int AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render); +typedef void (*OnCodecEvent)(AMediaCodec *codec, void *userdata); + +/** + * Set a callback to be called when a new buffer is available, or there was a format + * or buffer change. + * Note that you cannot perform any operations on the mediacodec from within the callback. + * If you need to perform mediacodec operations, you must do so on a different thread. + */ +int AMediaCodec_setNotificationCallback(AMediaCodec*, OnCodecEvent callback, void *userdata); + + #ifdef __cplusplus } // extern "C" #endif -- cgit v1.1