[FFmpeg-devel] [PATCH v2 1/2] avcodec/mpeg12dec: parse A53 caption data embedded in SCTE-20 user data

Michael Niedermayer michael at niedermayer.cc
Wed Mar 15 23:06:05 EET 2017


On Wed, Mar 15, 2017 at 12:53:03PM -0700, Aman Gupta wrote:
> From: Aman Gupta <aman at tmm1.net>
> 
> includes a fate test, which requires
> https://s3.amazonaws.com/tmm1/ccaptions/scte20.ts
> to be uploaded as sub/scte20.ts

uploaded



> ---
>  libavcodec/mpeg12dec.c       | 39 +++++++++++++++++++++++++++++++++++++++
>  tests/fate/subtitles.mak     |  3 +++
>  tests/ref/fate/sub-cc-scte20 | 15 +++++++++++++++
>  3 files changed, 57 insertions(+)
>  create mode 100644 tests/ref/fate/sub-cc-scte20
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index e49167f..cea8963 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -2260,6 +2260,45 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
>              avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
>          }
>          return 1;
> +    } else if (buf_size >= 2 &&
> +               p[0] == 0x03 && (p[1]&0x7f) == 0x01) {
> +        /* extract SCTE-20 CC data */
> +        GetBitContext gb;
> +        int cc_count = 0;
> +        int i;
> +
> +        init_get_bits(&gb, p + 2, buf_size - 2);
> +        cc_count = get_bits(&gb, 5);
> +        if (cc_count > 0) {

remainig bits or buf_size should be checked to be large enough for
cc_count

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170315/9a6dc707/attachment.sig>


More information about the ffmpeg-devel mailing list