From 65e372cf3f8fa9ca06f7ef0008240df162bf7184 Mon Sep 17 00:00:00 2001 From: Sandro Kalatozishvili Date: Wed, 6 Nov 2024 17:39:39 +0400 Subject: [PATCH] Use muxer callback function based on avcodec version --- .vscode/settings.json | 34 ---------------------------------- example/xmedia.c | 4 ++++ src/encoder.h | 2 +- 3 files changed, 5 insertions(+), 35 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 38eddd8..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "files.associations": { - "xstd.h": "c", - "encoder.h": "c", - "stdinc.h": "c", - "cmath": "c", - "array": "c", - "string_view": "c", - "initializer_list": "c", - "numbers": "c", - "xstr.h": "c", - "random": "c", - "deque": "c", - "string": "c", - "unordered_map": "c", - "vector": "c", - "system_error": "c", - "decoder.h": "c", - "array.h": "c", - "meta.h": "c", - "compare": "c", - "functional": "c", - "tuple": "c", - "type_traits": "c", - "utility": "c", - "nalu.h": "c", - "frame.h": "c", - "version.h": "c", - "stream.h": "c", - "status.h": "c", - "xtime.h": "c", - "avformat.h": "c" - } -} \ No newline at end of file diff --git a/example/xmedia.c b/example/xmedia.c index d48b87e..0e6bfa4 100644 --- a/example/xmedia.c +++ b/example/xmedia.c @@ -76,7 +76,11 @@ static void clear_cb(xarray_data_t *pArrData) free(pArrData->pData); } +#if XMEDIA_AVCODEC_VER_AT_LEAST(5, 7) +static int muxer_cb(void *pCtx, const uint8_t *pData, int nSize) +#else static int muxer_cb(void *pCtx, uint8_t *pData, int nSize) +#endif { xlogd("Muxer callback: size(%d)", nSize); xtranscoder_t *pTransmuxer = (xtranscoder_t*)pCtx; diff --git a/src/encoder.h b/src/encoder.h index a364163..9707634 100644 --- a/src/encoder.h +++ b/src/encoder.h @@ -25,7 +25,7 @@ typedef void(*xencoder_stat_cb_t)(void *pUserCtx, const char *pStatus); typedef void(*xencoder_err_cb_t)(void *pUserCtx, const char *pErrStr); typedef int(*xencoder_pkt_cb_t)(void *pUserCtx, AVPacket *pPacket); -#ifdef __APPLE__ +#if XMEDIA_AVCODEC_VER_AT_LEAST(5, 7) typedef int(*xmuxer_cb_t)(void *pUserCtx, const uint8_t *pData, int nSize); #else typedef int(*xmuxer_cb_t)(void *pUserCtx, uint8_t *pData, int nSize);