[FFmpeg-devel] [PATCH} to mpegtsenc.c to populate PMT descriptors with codec_tag for AVMEDIA_TYPE_DATA

Michael Niedermayer michaelni at gmx.at
Thu Sep 22 22:46:09 CEST 2011


On Thu, Sep 22, 2011 at 04:02:13PM -0400, Scott Leno wrote:
> Several months ago, it was suggested that the PMT descriptors be
> populated with the codec_tag for AVMEDIA_TYPE_DATA
> 
> > [FFmpeg-devel] requested change for mpegts.enc
> > Hill, Scott SHill at camber.com
> > Fri Apr 1 21:06:04 CEST 2011
> 
> > I would like to request a change to the write_pmt function to output the
> > codec_tag for data streams.  This is necessary for transport streams
> > conforming to SMPTE RP 217
> 
> I have included my patch to do so.
> I added tests that the codec_tag was populated and that the
> stream_type == STREAM_TYPE_PRIVATE_DATA.
> I can't say that allowing stream_type != STREAM_TYPE_PRIVATE_DATA is a
> bad thing, but I was being careful.
> 
>    Scott

> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index eb1e91c..461f6b9 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -354,6 +354,18 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
>                  *q++ = 'c';
>              }
>              break;
> +        case AVMEDIA_TYPE_DATA:
> +            if (stream_type == STREAM_TYPE_PRIVATE_DATA &&
> +                st->codec->codec_tag != 0x00 ) {
> +                *q++ = 0x05; /*MPEG-2 registration descriptor*/
> +                *q++ = 4;
> +                char *c = (char *) &(st->codec->codec_tag);
> +                *q++ = *c++;
> +                *q++ = *c++;
> +                *q++ = *c++;
> +                *q++ = *c++;

that is endian dependant

see bytestream_put_be32()

also it would be cool if we could put any avi based codec in mpegts
most would only need extradata, codec_tag and keeping frames seperate

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- 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/20110922/5990ea60/attachment.asc>


More information about the ffmpeg-devel mailing list