diff avidec.c @ 1256:2cddf00f92a6 libavformat

AVI tag reading and writing patch by David Conrad. umovimus at gmail dot com
author banan
date Fri, 18 Aug 2006 16:48:35 +0000
parents 6a5e58d2114b
children e27e94ac0c4b
line wrap: on
line diff
--- a/avidec.c	Fri Aug 18 07:55:08 2006 +0000
+++ b/avidec.c	Fri Aug 18 16:48:35 2006 +0000
@@ -180,6 +180,15 @@
     }
 }
 
+static int avi_read_tag(ByteIOContext *pb, char *buf, int maxlen,  unsigned int size)
+{
+    offset_t i = url_ftell(pb);
+    size += (size & 1);
+    get_strz(pb, buf, maxlen);
+    url_fseek(pb, i+size, SEEK_SET);
+    return 0;
+}
+
 static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
 {
     AVIContext *avi = s->priv_data;
@@ -438,6 +447,21 @@
             }
             url_fseek(pb, i+size, SEEK_SET);
             break;
+        case MKTAG('I', 'N', 'A', 'M'):
+            avi_read_tag(pb, s->title, sizeof(s->title), size);
+            break;
+        case MKTAG('I', 'A', 'R', 'T'):
+            avi_read_tag(pb, s->author, sizeof(s->author), size);
+            break;
+        case MKTAG('I', 'C', 'O', 'P'):
+            avi_read_tag(pb, s->copyright, sizeof(s->copyright), size);
+            break;
+        case MKTAG('I', 'C', 'M', 'T'):
+            avi_read_tag(pb, s->comment, sizeof(s->comment), size);
+            break;
+        case MKTAG('I', 'G', 'N', 'R'):
+            avi_read_tag(pb, s->genre, sizeof(s->genre), size);
+            break;
         default:
             /* skip tag */
             size += (size & 1);