asfdec: parse payload extension list
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 3 Nov 2012 04:35:35 +0000 (05:35 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 3 Nov 2012 04:35:35 +0000 (05:35 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/asf.h
libavformat/asfdec.c

index 822cd6b..528d4c1 100644 (file)
 
 #define PACKET_SIZE 3200
 
+typedef struct ASFPayload {
+    uint8_t type;
+    uint16_t size;
+} ASFPayload;
+
 typedef struct ASFStream {
     int num;
     unsigned char seq;
@@ -47,6 +52,9 @@ typedef struct ASFStream {
 
     int      palette_changed;
     uint32_t palette[256];
+
+    int payload_ext_ct;
+    ASFPayload payload[8];
 } ASFStream;
 
 typedef struct ASFMainHeader {
index 9f56818..4ad5c2d 100644 (file)
@@ -512,8 +512,10 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
     stream_ct = avio_rl16(pb); //stream-name-count
     payload_ext_ct = avio_rl16(pb); //payload-extension-system-count
 
-    if (stream_num < 128)
+    if (stream_num < 128) {
         asf->stream_bitrates[stream_num] = leak_rate;
+        asf->streams[stream_num].payload_ext_ct = 0;
+    }
 
     for (i=0; i<stream_ct; i++){
         avio_rl16(pb);
@@ -522,10 +524,18 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
     }
 
     for (i=0; i<payload_ext_ct; i++){
+        int size;
         ff_get_guid(pb, &g);
-        avio_skip(pb, 2);
+        size = avio_rl16(pb);
         ext_len=avio_rl32(pb);
         avio_skip(pb, ext_len);
+        if (stream_num < 128 && i < FF_ARRAY_ELEMS(asf->streams[stream_num].payload)) {
+            ASFPayload *p = &asf->streams[stream_num].payload[i];
+            p->type = g[0];
+            p->size = size;
+            av_log(s, AV_LOG_DEBUG, "Payload extension %x %d\n", g[0], p->size );
+            asf->streams[stream_num].payload_ext_ct ++;
+        }
     }
 
     return 0;