[MPlayer-cvslog] CVS: main/libmpdemux demux_ogg.c,1.77,1.78

Alex Beregszaszi syncmail at mplayerhq.hu
Tue Sep 20 00:52:05 CEST 2005


CVS change done by Alex Beregszaszi

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv13128

Modified Files:
	demux_ogg.c 
Log Message:
Disassemble comments and pass it to the demux_info interface

Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- demux_ogg.c	2 Sep 2005 08:32:32 -0000	1.77
+++ demux_ogg.c	19 Sep 2005 22:52:03 -0000	1.78
@@ -439,18 +439,28 @@
 {
   char *hdr, *val;
   char **cmt = vc->user_comments;
-  int index;
+  int index, i;
   ogg_demuxer_t *ogg_d = (ogg_demuxer_t *)d->priv;
+  struct table {
+    char *ogg;
+    char *mp;
+  } table[] = {
+    { "ENCODED_USING", "Software" },
+    { "ENCODER_URL", "Encoder URL" },
+    { "TITLE", "Name" },
+    { "ARTIST", "Artist" },
+    { "COMMENT", "Comments" },
+    { "DATE", "Creation Date" },
+    { "GENRE", "Genre" },
+    { "ALBUM", "Album" },
+    { "TRACKNUMBER", "Track" },
+    { NULL, NULL },
+  };
 
   while(*cmt)
   {
     hdr = NULL;
-    if (!strncasecmp(*cmt, "ENCODED_USING=", 14))
-    {
-      hdr = "Software";
-      val = *cmt + 14;
-    }
-    else if (!strncasecmp(*cmt, "LANGUAGE=", 9))
+    if (!strncasecmp(*cmt, "LANGUAGE=", 9))
     {
       val = *cmt + 9;
       if (identify)
@@ -479,18 +489,19 @@
       else
 	hdr = "Language";
     }
-    else if (!strncasecmp(*cmt, "ENCODER_URL=", 12))
-    {
-      hdr = "Encoder URL";
-      val = *cmt + 12;
-    }
-    else if (!strncasecmp(*cmt, "TITLE=", 6))
-    {
-      hdr = "Name";
-      val = *cmt + 6;
+    else {
+	for (i = 0; table[i].ogg; i++)
+	{
+	    if (!strncasecmp(*cmt, table[i].ogg, strlen(table[i].ogg)))
+	    {
+		hdr = table[i].mp;
+		val = *cmt + strlen(table[i].ogg) + 1;
+	    }
+	}
     }
+    demux_info_add(d, hdr, val);
     if (hdr)
-      mp_msg(MSGT_DEMUX, MSGL_V, " %s: %s\n", hdr, val);
+      mp_dbg(MSGT_DEMUX, MSGL_DBG2, " %s: %s\n", hdr, val);
     cmt++;
   }
 }




More information about the MPlayer-cvslog mailing list