Commit c0f14458 authored by Aurelien Jacobs's avatar Aurelien Jacobs

use new metadata API in aiff demuxer

Originally committed as revision 16966 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 33abc1a7
...@@ -79,9 +79,10 @@ static int get_tag(ByteIOContext *pb, uint32_t * tag) ...@@ -79,9 +79,10 @@ static int get_tag(ByteIOContext *pb, uint32_t * tag)
} }
/* Metadata string read */ /* Metadata string read */
static void get_meta(ByteIOContext *pb, char * str, int strsize, int size) static void get_meta(AVFormatContext *s, const char *key, int size)
{ {
int res = get_buffer(pb, (uint8_t*)str, FFMIN(strsize-1, size)); uint8_t str[1024];
int res = get_buffer(s->pb, str, FFMIN(sizeof(str)-1, size));
if (res < 0) if (res < 0)
return; return;
...@@ -90,7 +91,9 @@ static void get_meta(ByteIOContext *pb, char * str, int strsize, int size) ...@@ -90,7 +91,9 @@ static void get_meta(ByteIOContext *pb, char * str, int strsize, int size)
size++; size++;
size -= res; size -= res;
if (size) if (size)
url_fskip(pb, size); url_fskip(s->pb, size);
av_metadata_set(&s->metadata, key, str);
} }
/* Returns the number of sound data frames or negative on error */ /* Returns the number of sound data frames or negative on error */
...@@ -351,16 +354,16 @@ static int aiff_read_header(AVFormatContext *s, ...@@ -351,16 +354,16 @@ static int aiff_read_header(AVFormatContext *s,
version = get_be32(pb); version = get_be32(pb);
break; break;
case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */ case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */
get_meta(pb, s->title, sizeof(s->title), size); get_meta(s, "title" , size);
break; break;
case MKTAG('A', 'U', 'T', 'H'): /* Author chunk */ case MKTAG('A', 'U', 'T', 'H'): /* Author chunk */
get_meta(pb, s->author, sizeof(s->author), size); get_meta(s, "author" , size);
break; break;
case MKTAG('(', 'c', ')', ' '): /* Copyright chunk */ case MKTAG('(', 'c', ')', ' '): /* Copyright chunk */
get_meta(pb, s->copyright, sizeof(s->copyright), size); get_meta(s, "copyright", size);
break; break;
case MKTAG('A', 'N', 'N', 'O'): /* Annotation chunk */ case MKTAG('A', 'N', 'N', 'O'): /* Annotation chunk */
get_meta(pb, s->comment, sizeof(s->comment), size); get_meta(s, "comment" , size);
break; break;
case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */ case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
offset = get_be32(pb); /* Offset of sound data */ offset = get_be32(pb); /* Offset of sound data */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment