[FFmpeg-devel] [PATCH] asf - read/write metadata as UTF-16
Anton Khirnov
wyskas
Mon Feb 22 15:44:31 CET 2010
On Sun, Feb 21, 2010 at 11:03:01PM +0100, Michael Niedermayer wrote:
> On Sun, Feb 21, 2010 at 09:45:53PM +0100, Anton Khirnov wrote:
>
> > + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
> > + * val is given as a function it is executed only once.
>
> doesnt seems so
>
fixed
>
> PUT_UTF8 doesnt handle errors, and you do it quite incompletly
>
so you want me to skip error checking or add it to PUT_UTF8?
>
> ok if you checked all uses of this function against the spec and
> wmp
> also make sure you bump the version string we store in asf files
>
testing on wmp revealed this patch to be wrong due to asf being more
braindead than i expected (it stores number of characters, not length in
bytes here). instead i've added a patch that removes put_str16
completely as it's confusing and only used in one place anyway.
>
> > @@ -272,7 +288,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
> > {
> > ASFContext *asf = s->priv_data;
> > ByteIOContext *pb = s->pb;
> > - AVMetadataTag *title, *author, *copyright, *comment;
> > + AVMetadataTag *tags[5];
>
> unrelated?
>
>
> > int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
> > int has_title;
> > int metadata_count;
> > @@ -281,13 +297,14 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
> > int bit_rate;
> > int64_t duration;
> >
> > - title = av_metadata_get(s->metadata, "title" , NULL, 0);
> > - author = av_metadata_get(s->metadata, "author" , NULL, 0);
> > - copyright = av_metadata_get(s->metadata, "copyright", NULL, 0);
> > - comment = av_metadata_get(s->metadata, "comment" , NULL, 0);
> > + tags[0] = av_metadata_get(s->metadata, "title" , NULL, 0);
> > + tags[1] = av_metadata_get(s->metadata, "author" , NULL, 0);
> > + tags[2] = av_metadata_get(s->metadata, "copyright", NULL, 0);
> > + tags[3] = av_metadata_get(s->metadata, "comment" , NULL, 0);
> > + tags[4] = av_metadata_get(s->metadata, "rating" , NULL, 0);
>
> adding rating is a unrelated change
>
split
>
> why the strdup change?
>
because 2*len(input) (maximum length of converted output) is much more
than is needed in most cases.
these patches are tested with ffplay and wmp10, regtests pass.
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-PUT_UTF16-macro.patch
Type: text/x-diff
Size: 2049 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100222/2b4181cb/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-asfenc-eliminate-put_str16.patch
Type: text/x-diff
Size: 1776 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100222/2b4181cb/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-asf-don-t-add-WM-prefix-to-all-tags.patch
Type: text/x-diff
Size: 1753 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100222/2b4181cb/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-asfenc-simplify-writing-of-comment-header.patch
Type: text/x-diff
Size: 3001 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100222/2b4181cb/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-asfenc-write-tags-in-proper-UTF-16.patch
Type: text/x-diff
Size: 4222 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100222/2b4181cb/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-asfdec-read-metadata-as-proper-UTF-16.patch
Type: text/x-diff
Size: 1985 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100222/2b4181cb/attachment-0005.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/20100222/2b4181cb/attachment.pgp>
More information about the ffmpeg-devel
mailing list