[FFmpeg-devel] [PATCH] mpegtsenc.c Added AC3 Codec info to the pes header

Michael Niedermayer michaelni at gmx.at
Wed Sep 7 19:54:59 CEST 2011


On Wed, Sep 07, 2011 at 04:53:43PM +0000, Chiranjeevi Melam wrote:
> Hi ,
> Attached is the patch in MpegTs Encoder. Added AC3 Codec info to the "pes" header in order to specify AC3 streams in Mpeg2Ts container if container contains AC3 encoded streams. Original code does not have this support. Otherwise some of the tools reporting the AC3 streams as different type of audio streams.

> Thanks,
> Chiru
> 

Content-Description: ac3.patch
>  mpegtsenc.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> a0dcfa484e62c80b5ed93d635f84f9a1551ab2b2  ac3.patch
> diff --git a/ffmpeg_base/libavformat/mpegtsenc.c b/ffmpeg/libavformat/mpegtsenc.c
> index 7263bb0..c7e71bb 100755
> --- a/ffmpeg_base/libavformat/mpegtsenc.c
> +++ b/ffmpeg/libavformat/mpegtsenc.c
> @@ -825,8 +825,11 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
>                          st->codec->codec_id == CODEC_ID_MP3 ||
>                          st->codec->codec_id == CODEC_ID_AAC)) {
>                  *q++ = 0xc0;
> -            } else {
> -                *q++ = 0xbd;
> +            } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
> +                       (st->codec->codec_id == CODEC_ID_AC3)) {
> +                *q++ = 0xbd;
> +            } else {
> +                *q++ = 0xbd;
>                  if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
>                      private_code = 0x20;
>                  }

This patch makes no functional difference
Please look at your patches before submitting them!
The code before your patch looks like this:
            } else {
                *q++ = 0xbd;
                if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
                    private_code = 0x20;
                }
            }

what your patch does is:

+           } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
+                      (st->codec->codec_id == CODEC_ID_AC3)) {
+               *q++ = 0xbd;
            } else {
                *q++ = 0xbd;
                if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
                    private_code = 0x20;
                }
            }

in both cases 0xbd will be written and
for AVMEDIA_TYPE_SUBTITLE private_code will be set to 0x20
your patch does not change anything

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- 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/20110907/973fb2a0/attachment.asc>


More information about the ffmpeg-devel mailing list