[FFmpeg-devel] [PATCH 3/3] Metadata demuxer.
Michael Niedermayer
michaelni
Sat Dec 25 18:39:40 CET 2010
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- 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/20101225/babfdf74/attachment.pgp>
More information about the ffmpeg-devel
mailing list