[FFmpeg-devel] [PATCH 4/4] avformat/mpegtsenc: use the correct stream_types and write HDMV descriptors for m2ts

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Apr 13 01:17:32 EEST 2020


Am Fr., 10. Apr. 2020 um 21:45 Uhr schrieb Marton Balint <cus at passwd.hu>:
>
> Fixes ticket #2622.
>
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/mpegtsenc.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 57 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index add35aca89..b154675d60 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -359,6 +359,54 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st)
>      return stream_type;
>  }
>
> +static int get_m2ts_stream_type(AVFormatContext *s, AVStream *st)
> +{
> +    int stream_type;
> +
> +    switch (st->codecpar->codec_id) {
> +    case AV_CODEC_ID_MPEG2VIDEO:
> +        stream_type = STREAM_TYPE_VIDEO_MPEG2;
> +        break;
> +    case AV_CODEC_ID_H264:
> +        stream_type = STREAM_TYPE_VIDEO_H264;
> +        break;
> +    case AV_CODEC_ID_VC1:
> +        stream_type = STREAM_TYPE_VIDEO_VC1;
> +        break;
> +    case AV_CODEC_ID_HEVC:
> +        stream_type = STREAM_TYPE_VIDEO_HEVC;
> +        break;
> +    case AV_CODEC_ID_PCM_BLURAY:
> +        stream_type = 0x80;
> +        break;
> +    case AV_CODEC_ID_AC3:
> +        stream_type = 0x81;
> +        break;
> +    case AV_CODEC_ID_DTS:
> +        stream_type = (st->codecpar->channels > 6) ? 0x85 : 0x82;
> +        break;
> +    case AV_CODEC_ID_TRUEHD:
> +        stream_type = 0x83;
> +        break;
> +    case AV_CODEC_ID_EAC3:
> +        stream_type = 0x84;
> +        break;
> +    case AV_CODEC_ID_HDMV_PGS_SUBTITLE:
> +        stream_type = 0x90;
> +        break;
> +    case AV_CODEC_ID_HDMV_TEXT_SUBTITLE:
> +        stream_type = 0x92;
> +        break;

I believe this is worth a line in the Changelog.

Carl Eugen


More information about the ffmpeg-devel mailing list