PR #23765 opened by ghost00
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23765
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23765.patch

The context structure was named specifically for H.264, but it's actually
used for multiple codecs (H.264, H.265, MPEG-4, etc.). Renaming it to
MediaCodecContext better reflects its actual usage and makes the code
more consistent.

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 0fc9393e2bd8a0f78ce5bd11dd9f2df05f046bf7 Mon Sep 17 00:00:00 2001
From: lck <[email protected]>
Date: Sat, 11 Jul 2026 09:10:26 +0800
Subject: [PATCH] lavc/mediacodecdec: rename MediaCodecH264DecContext to
 MediaCodecContext

The context structure was named specifically for H.264, but it's actually
used for multiple codecs (H.264, H.265, MPEG-4, etc.). Renaming it to
MediaCodecContext better reflects its actual usage and makes the code
more consistent.
---
 libavcodec/mediacodecdec.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index bc176d8070..73942c2b15 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;
@@ -313,7 +313,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);
@@ -488,7 +488,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;
 
@@ -571,7 +571,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);
 
@@ -591,7 +591,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",
@@ -619,7 +619,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,                                 
                \
@@ -684,7 +684,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,                                 
                \
@@ -709,4 +709,4 @@ DECLARE_MEDIACODEC_ADEC(amrwb, "AMR-WB", 
AV_CODEC_ID_AMR_WB, NULL)
 
 #if CONFIG_MP3_MEDIACODEC_DECODER
 DECLARE_MEDIACODEC_ADEC(mp3, "MP3", AV_CODEC_ID_MP3, NULL)
-#endif
+#endif
\ No newline at end of file
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to