aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Kuphal <kevin.kuphal@sitecity.net>2004-01-06 15:31:36 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-01-06 15:31:36 +0000
commitd13431cd565e37e7e93667c18d78649cd538b237 (patch)
tree370d7b5a3e23be94b43e7efb32f83eba6bd6ac4b
parent4850b2d243f2f62617029335e6a7cd7a0c7d8afc (diff)
downloadffmpeg-d13431cd565e37e7e93667c18d78649cd538b237.tar.gz
ASF extended header parsing patch by ("Kevin Kuphal" <kevin dot kuphal at sitecity dot net>)
Originally committed as revision 2672 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/asf.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 29310b5714..ca74f37e44 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -176,6 +176,10 @@ static const GUID head2_guid = {
0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 },
};
+static const GUID extended_content_header = {
+ 0xD2D0A440, 0xE307, 0x11D2, { 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50 },
+};
+
/* I am not a number !!! This GUID is the one found on the PC used to
generate the stream */
static const GUID my_guid = {
@@ -947,6 +951,38 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_str16_nolen(pb, len3, s->copyright, sizeof(s->copyright));
get_str16_nolen(pb, len4, s->comment, sizeof(s->comment));
url_fskip(pb, len5);
+ } else if (!memcmp(&g, &extended_content_header, sizeof(GUID))) {
+ int desc_count, i;
+
+ desc_count = get_le16(pb);
+ for(i=0;i<desc_count;i++)
+ {
+ int name_len,value_type,value_len,value_num = 0;
+ char *name, *value;
+
+ name_len = get_le16(pb);
+ name = (char *)av_mallocz(name_len);
+ get_str16_nolen(pb, name_len, name, name_len);
+ value_type = get_le16(pb);
+ value_len = get_le16(pb);
+ if ((value_type == 0) || (value_type == 1)) // unicode or byte
+ {
+ value = (char *)av_mallocz(value_len);
+ get_str16_nolen(pb, value_len, value, value_len);
+ if (strcmp(name,"WM/AlbumTitle")==0) { strcpy(s->album, value); }
+ av_free(value);
+ }
+ if ((value_type >= 2) || (value_type <= 5)) // boolean or DWORD or QWORD or WORD
+ {
+ if (value_type==2) value_num = get_le32(pb);
+ if (value_type==3) value_num = get_le32(pb);
+ if (value_type==4) value_num = get_le64(pb);
+ if (value_type==5) value_num = get_le16(pb);
+ if (strcmp(name,"WM/Track")==0) s->track = value_num + 1;
+ if (strcmp(name,"WM/TrackNumber")==0) s->track = value_num;
+ }
+ av_free(name);
+ }
#if 0
} else if (!memcmp(&g, &head1_guid, sizeof(GUID))) {
int v1, v2;