[FFmpeg-devel] [PATCH] Windows Television (.wtv) demuxer
Michael Niedermayer
michaelni
Sat Nov 27 12:57:50 CET 2010
On Sat, Nov 13, 2010 at 03:05:49PM +1100, Peter Ross wrote:
> 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)
> asf.h | 2 +
> asfdec.c | 82 +++++++++++++++++++++++++++++++--------------------------------
> 2 files changed, 43 insertions(+), 41 deletions(-)
> eede7ef1bf3b139e2b5057a4521be5315a1e5527 0001-make-guid-utility-function-visibile-to-other-modules.patch
> From e7a8f9228c490330aab18692c0e466f7a6501bf2 Mon Sep 17 00:00:00 2001
> From: Peter Ross <pross at xvid.org>
> Date: Sat, 13 Nov 2010 14:22:35 +1100
> Subject: [PATCH 1/3] make guid utility function visibile to other modules (ff_guidcmp, ff_get_guid)
ok
[...]
> avidec.c | 12 +-----------
> riff.c | 17 +++++++++++++++++
> riff.h | 7 +++++++
> 3 files changed, 25 insertions(+), 11 deletions(-)
> 3664e0df80fff12238e724e4e180147907f19b9a 0002-add-ff_get_bmp_header.patch
> From dfe9d039f74c2e508f6c4cf5dea8df31ee809df7 Mon Sep 17 00:00:00 2001
> From: Peter Ross <pross at xvid.org>
> Date: Sat, 13 Nov 2010 14:23:16 +1100
> Subject: [PATCH 2/3] add ff_get_bmp_header
ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- 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/20101127/ba435cd2/attachment.pgp>
More information about the ffmpeg-devel
mailing list