[FFmpeg-devel] [PATCH]Refuse to mux invalid transport streams
Michael Niedermayer
michaelni at gmx.at
Mon May 20 15:20:13 CEST 2013
On Sun, May 19, 2013 at 10:21:59PM +0200, Carl Eugen Hoyos wrote:
> Hi!
>
> FFmpeg currently allows to mux transport streams that cannot be decoded,
> attached patch allows to report an error in such a case.
>
> Please comment, Carl Eugen
> mpegtsenc.c | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
> f68bd75c40b81771225c4d347baaefba61ebbd5a patchmpegts.diff
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 0ddae65..ec40390 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -519,6 +519,43 @@ static int mpegts_write_header(AVFormatContext *s)
> int *pids;
> int ret;
>
> + for (i = 0; i < s->nb_streams; i++) {
> + st = s->streams[i];
> + if (st->codec->codec_type == AVMEDIA_TYPE_DATA)
> + continue;
> + switch (st->codec->codec_id) {
> + case AV_CODEC_ID_CAVS:
> + case AV_CODEC_ID_DIRAC:
> + case AV_CODEC_ID_H264:
> + case AV_CODEC_ID_MPEG1VIDEO:
> + case AV_CODEC_ID_MPEG2VIDEO:
> + case AV_CODEC_ID_MPEG4:
> + case AV_CODEC_ID_AAC:
> + case AV_CODEC_ID_AAC_LATM:
> + case AV_CODEC_ID_AC3:
> + case AV_CODEC_ID_DTS:
> + case AV_CODEC_ID_EAC3:
> + case AV_CODEC_ID_MP2:
> + case AV_CODEC_ID_MP3:
> + case AV_CODEC_ID_S302M:
> + case AV_CODEC_ID_DVB_SUBTITLE:
> + continue;
> + }
> + switch (st->codec->codec_id) {
> + case AV_CODEC_ID_VC1:
> + case AV_CODEC_ID_TRUEHD:
> + case AV_CODEC_ID_PCM_BLURAY:
> + case AV_CODEC_ID_HDMV_PGS_SUBTITLE:
> + case AV_CODEC_ID_DVB_TELETEXT:
> + av_log(s, AV_LOG_ERROR, "Muxing %s in transport streams is not yet supported\n",
> + avcodec_get_name(st->codec->codec_id));
> + return AVERROR_PATCHWELCOME;
> + }
> + av_log(s, AV_LOG_ERROR, "Codec %s not supported in transport streams\n",
> + avcodec_get_name(st->codec->codec_id));
> + return AVERROR(EINVAL);
why dont you set AVOutputFormat.codec_tag / querry_codec ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130520/2d792d82/attachment.asc>
More information about the ffmpeg-devel
mailing list