On Thu, Feb 07, 2019 at 09:03:16PM +0100, Mathieu Duponchelle wrote:
> ---
> doc/encoders.texi | 3 +++
> libavcodec/mpeg12enc.c | 31 +++++++++++++++++++++++++++++++
> libavcodec/mpegvideo.h | 2 ++
> 3 files changed, 36 insertions(+)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index e86ae69cc5..a283b9fddf 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -2574,6 +2574,9 @@ Specifies the video_format written into the sequence
> display extension
> indicating the source of the video pictures. The default is
> @samp{unspecified},
> can be @samp{component}, @samp{pal}, @samp{ntsc}, @samp{secam} or @samp{mac}.
> For maximum compatibility, use @samp{component}.
> +@item a53cc @var{boolean}
> +Import closed captions (which must be ATSC compatible format) into output.
> +Default is 1 (on).
> @end table
>
> @section png
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index d0b458e34b..15a3db9e6d 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -61,6 +61,8 @@ static uint32_t mpeg1_chr_dc_uni[512];
> static uint8_t mpeg1_index_run[2][64];
> static int8_t mpeg1_max_level[2][64];
>
> +#define A53_MAX_CC_COUNT 0x1f
> +
> static av_cold void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len)
> {
> int i;
> @@ -544,6 +546,35 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s,
> int picture_number)
> }
> }
>
> + if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->a53_cc) {
> + side_data = av_frame_get_side_data(s->current_picture_ptr->f,
> + AV_FRAME_DATA_A53_CC);
> + if (side_data) {
> + if (side_data->size <= A53_MAX_CC_COUNT) {
> + int i = 0;
> +
> + put_header (s, USER_START_CODE);
> +
> + put_bits(&s->pb, 8, 'G'); //
> user_identifier
> + put_bits(&s->pb, 8, 'A');
> + put_bits(&s->pb, 8, '9');
> + put_bits(&s->pb, 8, '4');
> + put_bits(&s->pb, 8, 3); //
> user_data_type_code> + put_bits(&s->pb, 8, > + (side_data->size / 3 & A53_MAX_CC_COUNT) | 0x40); // > flags, cc_count what if size is not a multiple of 3 ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
