[FFmpeg-devel] [PATCH] Google WebP support

Pascal Massimino pascal.massimino
Thu Oct 7 04:24:11 CEST 2010


Aurelien, Stefano,

On Wed, Oct 6, 2010 at 2:01 PM, Aurelien Jacobs <aurel at gnuage.org> wrote:

> On Wed, Oct 06, 2010 at 08:37:23PM +0200, Stefano Sabatini wrote:
> > On date Tuesday 2010-10-05 13:49:06 -0700, Pascal Massimino encoded:
> > > Aurelien,
> > >
> > > another iteration:
> > >
> > > On Tue, Oct 5, 2010 at 12:45 PM, Aurelien Jacobs <aurel at gnuage.org>
> wrote:
> > [...]
> > > Index: libavformat/webpdec.c
> > > ===================================================================
> > > --- libavformat/webpdec.c   (revision 0)
> > > +++ libavformat/webpdec.c   (revision 0)
> > > @@ -0,0 +1,120 @@
> > [...]
> > > +static int read_packet(AVFormatContext *s, AVPacket *pkt)
> > > +{
> > > +    AVStream *stream = s->streams[pkt->stream_index];
> > > +    uint32_t tag = get_le32(s->pb);
> > > +    uint32_t chunk_size = get_le32(s->pb);
> > > +    int ret = -1;
> > > +    if (tag == stream->codec->codec_tag)
> > > +        ret = av_get_packet(s->pb, pkt, chunk_size);
> >
> > > +    else if (tag == AV_RL32("IART"))
> > > +        ret = get_metadata(s->pb, stream, "artist", chunk_size);
> > > +    else if (tag == AV_RL32("ICOP"))
> > > +        ret = get_metadata(s->pb, stream, "copyright", chunk_size);
> > > +    else if (tag == AV_RL32("INAM"))
> > > +        ret = get_metadata(s->pb, stream, "title", chunk_size);
> > > +    else if (tag == AV_RL32("ICMT"))
> > > +        ret = get_metadata(s->pb, stream, "comment", chunk_size);
> >
> > This can be factorized:
> > ret = get_metadata(s->pb, stream, tag == AV_RL32("IART") ? "artist"    :
> >                                   tag == AV_RL32("ICOP") ? "copyright" :
> >                                   ...
>
> Actually you shouldn't use "artist", "title" and other generic strings
> as keys. Instead you should use "IART", "INAM" and others directly, and
> just set an appropriate conversion table in AVInputFormat.metadata_conv.
> Same applies to the muxer.
>

much nicer indeed! See $attached.
Also changed the AVERROR_NOTSUPP

skal



>
> Aurel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_webp_ffmpeg.3.diff
Type: application/octet-stream
Size: 9299 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101006/84ea6fe9/attachment.obj>



More information about the ffmpeg-devel mailing list