diff mbox series

[FFmpeg-devel] avcodec/mpeg12dec: set FF_CODEC_PROPERTY_CLOSED_CAPTIONS in mpeg_set_cc_format()

Message ID 20241012180450.2752650-1-marth64@proxyid.net
State New
Headers show
Series [FFmpeg-devel] avcodec/mpeg12dec: set FF_CODEC_PROPERTY_CLOSED_CAPTIONS in mpeg_set_cc_format() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Marth64 Oct. 12, 2024, 6:04 p.m. UTC
When Closed Captions are discovered, this method is always invoked.
Therefore, use it to set the property instead of repeating the statement.

Signed-off-by: Marth64 <marth64@proxyid.net>
---
 libavcodec/mpeg12dec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Anton Khirnov Oct. 13, 2024, 11:33 a.m. UTC | #1
Quoting Marth64 (2024-10-12 20:04:50)
> When Closed Captions are discovered, this method is always invoked.
> Therefore, use it to set the property instead of repeating the statement.
> 
> Signed-off-by: Marth64 <marth64@proxyid.net>
> ---
>  libavcodec/mpeg12dec.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Makes sense.
diff mbox series

Patch

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 4f784611de..c0ed6a9d5b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1917,6 +1917,8 @@  static void mpeg_set_cc_format(AVCodecContext *avctx, enum Mpeg2ClosedCaptionsFo
 
         av_log(avctx, AV_LOG_DEBUG, "CC: first seen substream is %s format\n", label);
     }
+
+    avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
 static int mpeg_decode_a53_cc(AVCodecContext *avctx,
@@ -1943,7 +1945,6 @@  static int mpeg_decode_a53_cc(AVCodecContext *avctx,
             if (ret >= 0)
                 memcpy(s1->a53_buf_ref->data + old_size, p + 7, cc_count * UINT64_C(3));
 
-            avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
             mpeg_set_cc_format(avctx, CC_FORMAT_A53_PART4, "A/53 Part 4");
         }
         return 1;
@@ -1993,7 +1994,6 @@  static int mpeg_decode_a53_cc(AVCodecContext *avctx,
                 }
             }
 
-            avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
             mpeg_set_cc_format(avctx, CC_FORMAT_SCTE20, "SCTE-20");
         }
         return 1;
@@ -2056,7 +2056,6 @@  static int mpeg_decode_a53_cc(AVCodecContext *avctx,
                 }
             }
 
-            avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
             mpeg_set_cc_format(avctx, CC_FORMAT_DVD, "DVD");
         }
         return 1;