ensonic gst-plugins-good: gst-plugins-good/ gst-plugins-good/gst/avi/

[email protected] Tue, 9 Dec 2008 09:55:36 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-good
Changes by:     ensonic
Date:           Tue Dec 09 2008  17:55:36 UTC

Log message:
	* gst/avi/gstavidemux.c:
	  More logging.
	* gst/avi/gstavimux.c:
	  Handle more metadata fields. Better estimate of metadata size. Don't
	  merge received tags, if application has specified tags using
	  GST_TAG_MERGE_REPLACE_ALL. Fixes #563221 for avi.

Modified files:
    .               : ChangeLog
    gst/avi         : gstavidemux.c gstavimux.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.3859&r2=1.3860
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/avi/gstavidemux.c.diff?r1=1.244&r2=1.245
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/avi/gstavimux.c.diff?r1=1.108&r2=1.109

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v
retrieving revision 1.3859
retrieving revision 1.3860
diff -u -d -r1.3859 -r1.3860
--- ChangeLog	9 Dec 2008 14:30:01 -0000	1.3859
+++ ChangeLog	9 Dec 2008 17:55:19 -0000	1.3860
@@ -1,3 +1,13 @@
+2008-12-09  Stefan Kost  <[email protected]>
+
+	* gst/avi/gstavidemux.c:
+	  More logging.
+	* gst/avi/gstavimux.c:
+	  Handle more metadata fields. Better estimate of metadata size. Don't
+	  merge received tags, if application has specified tags using
+	  GST_TAG_MERGE_REPLACE_ALL. Fixes #563221 for avi.
 2008-12-09  Sebastian Dröge  <[email protected]>
 
 	* tests/check/Makefile.am:
Index: gstavidemux.c
RCS file: /cvs/gstreamer/gst-plugins-good/gst/avi/gstavidemux.c,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -d -r1.244 -r1.245
--- gstavidemux.c	31 Oct 2008 10:00:18 -0000	1.244
+++ gstavidemux.c	9 Dec 2008 17:55:21 -0000	1.245
@@ -3145,7 +3145,8 @@
         avi->avih->streams, avi->num_streams);
   }
-  GST_DEBUG_OBJECT (avi, "skipping junk between header and data ...");
+  GST_DEBUG_OBJECT (avi, "skipping junk between header and data, offset=%"
+      G_GUINT64_FORMAT, avi->offset);
   /* Now, find the data (i.e. skip all junk between header and data) */
   do {
@@ -3168,6 +3169,9 @@
     ltag = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 8);
     gst_buffer_unref (buf);
+    GST_DEBUG ("tag %" GST_FOURCC_FORMAT ", size %u",
+        GST_FOURCC_ARGS (tag), size);
     if (tag == GST_RIFF_TAG_LIST) {
       switch (ltag) {
         case GST_RIFF_LIST_movi:
@@ -3180,6 +3184,7 @@
             GST_DEBUG_OBJECT (avi, "couldn't read INFO chunk");
             goto pull_range_failed;
           }
+          GST_DEBUG ("got size %u", GST_BUFFER_SIZE (buf));
           sub = gst_buffer_create_sub (buf, 4, GST_BUFFER_SIZE (buf) - 4);
           gst_riff_parse_info (element, sub, &avi->globaltags);
Index: gstavimux.c
RCS file: /cvs/gstreamer/gst-plugins-good/gst/avi/gstavimux.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- gstavimux.c	11 Nov 2008 10:06:01 -0000	1.108
+++ gstavimux.c	9 Dec 2008 17:55:22 -0000	1.109
@@ -913,13 +913,16 @@
     gchar *tag;
   } rifftags[] = {
     {
+    GST_RIFF_INFO_IARL, GST_TAG_LOCATION}, {
+    GST_RIFF_INFO_IART, GST_TAG_ARTIST}, {
     GST_RIFF_INFO_ICMT, GST_TAG_COMMENT}, {
+    GST_RIFF_INFO_ICOP, GST_TAG_COPYRIGHT}, {
+    GST_RIFF_INFO_ICRD, GST_TAG_DATE}, {
+    GST_RIFF_INFO_IGNR, GST_TAG_GENRE}, {
+    GST_RIFF_INFO_IKEY, GST_TAG_KEYWORDS}, {
     GST_RIFF_INFO_INAM, GST_TAG_TITLE}, {
     GST_RIFF_INFO_ISFT, GST_TAG_ENCODER}, {
-    GST_RIFF_INFO_IGNR, GST_TAG_GENRE}, {
-    GST_RIFF_INFO_ICOP, GST_TAG_COPYRIGHT}, {
-    GST_RIFF_INFO_IART, GST_TAG_ARTIST}, {
-    GST_RIFF_INFO_IARL, GST_TAG_LOCATION}, {
+    GST_RIFF_INFO_ISRC, GST_TAG_ISRC}, {
     0, NULL}
   };
   gint n, len, plen;
@@ -981,9 +984,14 @@
     tags = avimux->tags_snap;
   avimux->tags_snap = tags;
-  /* FIXME: that should be the strlen of all tags + header sizes */
-  if (avimux->tags_snap)
-    size += 1024;
+  if (avimux->tags_snap) {
+    /* that should be the strlen of all tags + header sizes
+     * not all of tags end up in a avi, still this is a good estimate
+     */
+    gchar *str = gst_structure_to_string (avimux->tags_snap);
+    size += strlen (str) + 8 * gst_structure_n_fields (avimux->tags_snap);
+    g_free (str);
+  }
   /* allocate the buffer, starting with some wild/safe upper bound */
   size += avimux->codec_data_size + 100 + sizeof (gst_riff_avih)
@@ -1054,6 +1062,7 @@
     } else {
       if (audpad->auds_codec_data)
         codec_size = GST_BUFFER_SIZE (audpad->auds_codec_data);
+      /* +2 is codec_size field, not part of gst_riff_strf_auds */
       strl_size = sizeof (gst_riff_strh_full) + sizeof (gst_riff_strf_auds) + 2
           + GST_ROUND_UP_2 (codec_size) + 4 * 5 + ODML_SUPERINDEX_SIZE;
     }
@@ -1673,18 +1682,23 @@
 gst_avi_mux_handle_event (GstPad * pad, GstEvent * event)
 {
   GstAviMux *avimux;
-  GstTagList *list;
   gboolean ret;
   avimux = GST_AVI_MUX (gst_pad_get_parent (pad));
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_TAG:
-      gst_event_parse_tag (event, &list);
-      if (avimux->tags) {
-        gst_tag_list_insert (avimux->tags, list, GST_TAG_MERGE_PREPEND);
+      if (gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (avimux)) !=
+          GST_TAG_MERGE_REPLACE_ALL) {
+        GstTagList *list;
+        gst_event_parse_tag (event, &list);
+        if (avimux->tags) {
+          gst_tag_list_insert (avimux->tags, list, GST_TAG_MERGE_PREPEND);
+        } else {
+          avimux->tags = gst_tag_list_copy (list);
+        }
       } else {
-        avimux->tags = gst_tag_list_copy (list);
+        GST_DEBUG ("skipping tag-event");
       }
       break;
     default:

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose