diff mbox series

[FFmpeg-devel,17/30] avcodec/mpeg12enc: Simplify check for A53 closed captions

Message ID AM7PR03MB666004D3EA864C0591FAD0BB8F7E9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit ac49439e7734f384206b77ab6860d74f5969c281
Headers show
Series [FFmpeg-devel,01/14] avcodec/mjpegenc: Use custom close function directly | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Andreas Rheinhardt Dec. 23, 2021, 9:13 a.m. UTC
The a53_cc option is only useful and meaningful for MPEG-2,
yet it was accidentally added for all mpegvideo-based encoders.
This means that it is possible for a53_cc to be set for other
encoders as well.
This commit changes this and reroutes a53_cc to the dummy field
in MpegEncContext for all codecs for which it is not supported.
This allows to avoid a check for the current codec in mpeg12enc.c.

Also add a compile-time check for whether the MPEG-2 encoder is
available while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpeg12enc.c | 2 +-
 libavcodec/mpegvideo.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 2fb2232f3c..abb0a4b29f 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -551,7 +551,7 @@  void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
         }
     }
 
-    if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->a53_cc) {
+    if (CONFIG_MPEG2VIDEO_ENCODER && s->a53_cc) {
         side_data = av_frame_get_side_data(s->current_picture_ptr->f,
             AV_FRAME_DATA_A53_CC);
         if (side_data) {
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index d810f900f2..900b8b1403 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -662,7 +662,7 @@  FF_MPV_OPT_CMP_FUNC, \
 #define FF_MPV_DEPRECATED_MPEG_QUANT_OPT \
     { "mpeg_quant", "Deprecated, does nothing", FF_MPV_OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 0, FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED },
 #define FF_MPV_DEPRECATED_A53_CC_OPT \
-    { "a53cc",      "Deprecated, does nothing", FF_MPV_OFFSET(a53_cc),     AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED },
+    { "a53cc",      "Deprecated, does nothing", FF_MPV_OFFSET(dummy),      AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED },
 #define FF_MPV_DEPRECATED_MATRIX_OPT \
    { "force_duplicated_matrix", "Deprecated, does nothing", FF_MPV_OFFSET(dummy), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED },
 #define FF_MPV_DEPRECATED_BFRAME_OPTS \