[FFmpeg-devel] [PATCH] Windows Television (.wtv) demuxer
Peter Ross
pross
Sat Nov 13 05:05:49 CET 2010
Updated patch set. Improvements:
demuxer now ignores unsupported streams
placeholder streams are also ignored
use metadata 'language' tag
added AC3 GUID
On Tue, Sep 28, 2010 at 09:03:33PM +0200, Michael Niedermayer wrote:
> On Tue, Sep 28, 2010 at 12:28:19AM +1000, Peter Ross wrote:
> [...]
> > +/**
> > + * parse VIDEOINFOHEADER2 structure
> > + * @return bytes consumed
> > + */
> > +static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st)
> > +{
> > + ByteIOContext *pb = s->pb;
> > +
> > + // VIDEOINFOHEADER2 part
> > + url_fskip(pb, 32);
> > + st->codec->bit_rate = get_le32(pb);
> > + url_fskip(pb, 20);
> > + st->sample_aspect_ratio.num = get_le32(pb);
> > + st->sample_aspect_ratio.den = get_le32(pb);
> > + url_fskip(pb, 8);
> > +
> > + // BITMAPINFOHEADER part
>
> we have code to read BITMAPINFOHEADERs in libavformat/avidec.c strf
> maybe this can be factored?
Done.
> > + url_fskip(pb, size - 32);
> > + ff_get_guid(pb, &actual_subtype);
> > + ff_get_guid(pb, &actual_formattype);
>
> > + url_fseek(pb, -size, SEEK_CUR);
>
> this wont work with non seekable protocols
Yep it is a disadvantage. The authors of this abomination decided to write the
format identifying information (ala GUIDs) *AFTER* the format buffer.
> > +
> > + parse_media_type(s, st, mediatype, actual_subtype, actual_formattype, size - 32);
> > + url_fskip(pb, 32);
> > + return;
> > + } else if (!ff_guidcmp(mediatype, mediatype_audio)) {
> > + if (!ff_guidcmp(formattype, format_waveformatex)) {
> > + ff_get_wav_header(pb, st->codec, size);
> > + } else {
>
> > + if (ff_guidcmp(formattype, format_none)) {
> > + av_log(s, AV_LOG_WARNING, "unknown formatype:");
> > + print_guid(AV_LOG_WARNING, formattype);
> > + av_log(0, AV_LOG_WARNING, "\n");
> ^
> why not s?
av_log(0,...) instructs the logger not to output the context information, allowing
text to be appended to previous log statement. For the above code, the output is:
[foo @ 0xbeef] unknown formattype:00000000000000000000000000000000(newline)
Have fixed this anyway.
> > + } else if (!ff_guidcmp(formattype, format_mpeg2_video)) {
> > + int consumed = parse_videoinfoheader2(s, st);
> > + url_fskip(pb, 4);
> > + st->codec->extradata_size = get_le32(pb);
> > + url_fskip(pb, 12);
> > +#if 1
> > + //the extradata is rejected by the decoder
> > + st->codec->extradata_size = 0;
> > +#endif
> > + if (st->codec->extradata_size) {
> > + st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
> > + if (!st->codec->extradata) {
> > + st->codec->extradata_size = 0;
> > + }else {
> > + memset(st->codec->extradata, 0, st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
> > + get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
> > + }
>
> > +{ int i;
> > + av_log(0,0, "data [[\n");
> > + for(i=0; i<st->codec->extradata_size;i++) {
> > + av_log(0,0, " %02x", st->codec->extradata[i]);
> > + }
> > + av_log(0,0, "]]\n");
> > +}
Cruft removed.
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-make-guid-utility-function-visibile-to-other-modules.patch
Type: text/x-diff
Size: 12847 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101113/01311146/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-add-ff_get_bmp_header.patch
Type: text/x-diff
Size: 3157 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101113/01311146/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Windows-Television-WTV-demuxer.patch
Type: text/x-diff
Size: 21432 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101113/01311146/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101113/01311146/attachment.pgp>
More information about the ffmpeg-devel
mailing list