[FFmpeg-devel] [PATCH] avcodec/mediacodecdec: rename MediaCodecH264DecContext to MediaCodecContext
Zhao Zhili
quinkblack at foxmail.com
Wed Dec 4 15:28:45 EET 2024
> On Dec 4, 2024, at 20:45, luckysk <luckysk-at-foxmail.com at ffmpeg.org> wrote:
>
> We support multiple video and audio formats, not just H264
LGTM.
> ---
> libavcodec/mediacodecdec.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
> index 4937828f21..e096a7e0a0 100644
> --- a/libavcodec/mediacodecdec.c
> +++ b/libavcodec/mediacodecdec.c
> @@ -45,7 +45,7 @@
> #include "mediacodec_wrapper.h"
> #include "mediacodecdec_common.h"
>
> -typedef struct MediaCodecH264DecContext {
> +typedef struct MediaCodecContext {
>
> AVClass *avclass;
>
> @@ -59,11 +59,11 @@ typedef struct MediaCodecH264DecContext {
> int use_ndk_codec;
> // Ref. MediaFormat KEY_OPERATING_RATE
> int operating_rate;
> -} MediaCodecH264DecContext;
> +} MediaCodecContext;
>
> static av_cold int mediacodec_decode_close(AVCodecContext *avctx)
> {
> - MediaCodecH264DecContext *s = avctx->priv_data;
> + MediaCodecContext *s = avctx->priv_data;
>
> ff_mediacodec_dec_close(avctx, s->ctx);
> s->ctx = NULL;
> @@ -318,7 +318,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
> const char *codec_mime = NULL;
>
> FFAMediaFormat *format = NULL;
> - MediaCodecH264DecContext *s = avctx->priv_data;
> + MediaCodecContext *s = avctx->priv_data;
>
> if (s->use_ndk_codec < 0)
> s->use_ndk_codec = !av_jni_get_java_vm(avctx);
> @@ -493,7 +493,7 @@ done:
>
> static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
> {
> - MediaCodecH264DecContext *s = avctx->priv_data;
> + MediaCodecContext *s = avctx->priv_data;
> int ret;
> ssize_t index;
>
> @@ -576,7 +576,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
>
> static void mediacodec_decode_flush(AVCodecContext *avctx)
> {
> - MediaCodecH264DecContext *s = avctx->priv_data;
> + MediaCodecContext *s = avctx->priv_data;
>
> av_packet_unref(&s->buffered_pkt);
>
> @@ -596,7 +596,7 @@ static const AVCodecHWConfigInternal *const mediacodec_hw_configs[] = {
> NULL
> };
>
> -#define OFFSET(x) offsetof(MediaCodecH264DecContext, x)
> +#define OFFSET(x) offsetof(MediaCodecContext, x)
> #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
> static const AVOption ff_mediacodec_vdec_options[] = {
> { "delay_flush", "Delay flush until hw output buffers are returned to the decoder",
> @@ -624,7 +624,7 @@ const FFCodec ff_ ## short_name ## _mediacodec_decoder = {
> .p.type = AVMEDIA_TYPE_VIDEO, \
> .p.id = codec_id, \
> .p.priv_class = &ff_##short_name##_mediacodec_dec_class, \
> - .priv_data_size = sizeof(MediaCodecH264DecContext), \
> + .priv_data_size = sizeof(MediaCodecContext), \
> .init = mediacodec_decode_init, \
> FF_CODEC_RECEIVE_FRAME_CB(mediacodec_receive_frame), \
> .flush = mediacodec_decode_flush, \
> @@ -689,7 +689,7 @@ const FFCodec ff_ ## short_name ## _mediacodec_decoder = {
> .p.type = AVMEDIA_TYPE_AUDIO, \
> .p.id = codec_id, \
> .p.priv_class = &ff_##short_name##_mediacodec_dec_class, \
> - .priv_data_size = sizeof(MediaCodecH264DecContext), \
> + .priv_data_size = sizeof(MediaCodecContext), \
> .init = mediacodec_decode_init, \
> FF_CODEC_RECEIVE_FRAME_CB(mediacodec_receive_frame), \
> .flush = mediacodec_decode_flush, \
> --
> 2.47.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list