[FFmpeg-devel] [PATCH 3/3] Metadata demuxer.
Michael Niedermayer
michaelni
Sun Dec 26 13:49:30 CET 2010
On Sun, Dec 26, 2010 at 10:02:57AM +0100, Anton Khirnov wrote:
> On Sat, Dec 25, 2010 at 06:39:40PM +0100, Michael Niedermayer wrote:
> > On Wed, Dec 15, 2010 at 01:15:14PM +0100, Anton Khirnov wrote:
> > [...]
> > > +
> > > +static int read_tag(uint8_t *line, AVMetadata **m)
> > > +{
> > > + uint8_t *key, *value, *p = line, *p1, *p2;
> > > +
> > > + /* find first not escaped '=' */
> > > + while (1) {
> > > + if (*p == '=')
> > > + break;
> > > + else if (*p == '\\')
> > > + p++;
> > > +
> > > + if (*p++)
> > > + continue;
> > > +
> > > + return 0;
> > > + }
> > > +
> > > + if (!(key = av_malloc((p - line + 1) * sizeof(*p))))
> > > + return AVERROR(ENOMEM);
> > > + if (!(value = av_malloc((strlen(p)) * sizeof(*p)))) {
> > > + av_free(key);
> > > + return AVERROR(ENOMEM);
> > > + }
> > > +
> >
> > > + /* unescape key/value */
> > > + p1 = key;
> > > + p2 = line;
> > > + while(p2 < p) {
> > > + if (*p2 == '\\')
> > > + p2++;
> > > + *p1++ = *p2++;
> > > + }
> > > + *p1 = 0;
> > > +
> > > + p1 = value;
> > > + p2 = p + 1;
> > > + while(*p2) {
> > > + if (*p2 == '\\')
> > > + p2++;
> > > + *p1++ = *p2++;
> > > + }
> > > + *p1 = 0;
> >
> > duplicate code
> fixed
>
> --
> Anton Khirnov
> doc/general.texi | 2
> libavcodec/avcodec.h | 1
> libavformat/Makefile | 1
> libavformat/allformats.c | 2
> libavformat/metadec.c | 173 +++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 177 insertions(+), 2 deletions(-)
> 1ed79c3bbbf2d669cd0c026254261fc6091d86d5 0001-Metadata-demuxer.patch
> From 97934f97f671b9bd14676d5cd47bc35f9eae1e4c Mon Sep 17 00:00:00 2001
> From: Anton Khirnov <anton at khirnov.net>
> Date: Tue, 14 Dec 2010 08:45:16 +0100
> Subject: [PATCH] Metadata demuxer.
lgtm if tested
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- 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/20101226/70cec90c/attachment.pgp>
More information about the ffmpeg-devel
mailing list