wtay gst-plugins-bad: gst-plugins-bad/ gst-plugins-bad/ext/spc/

[email protected]
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-bad
Changes by:     wtay
Date:           Tue Nov 25 2008  18:28:33 UTC

Log message:
Patch by: Jonathan Matthew <notverysmart at gmail dot com>
* ext/spc/gstspc.c: (gst_spc_dec_sink_event), (spc_setup):
Post an error and push EOS when we can't start playback for some reason.
also avoid a crash when fed an empty file. Fixes #480543.

Modified files:
    .               : ChangeLog
    ext/spc         : gstspc.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3743&r2=1.3744
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/spc/gstspc.c.diff?r1=1.5&r2=1.6

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3743
retrieving revision 1.3744
diff -u -d -r1.3743 -r1.3744
--- ChangeLog	25 Nov 2008 16:37:49 -0000	1.3743
+++ ChangeLog	25 Nov 2008 18:28:16 -0000	1.3744
@@ -1,3 +1,11 @@
+2008-11-25  Wim Taymans  <[email protected]>
+
+	Patch by: Jonathan Matthew <notverysmart at gmail dot com>
+	* ext/spc/gstspc.c: (gst_spc_dec_sink_event), (spc_setup):
+	Post an error and push EOS when we can't start playback for some reason.
+	also avoid a crash when fed an empty file. Fixes #480543.
 2008-11-25  Sebastian Dröge  <[email protected]>
 
 	* tests/check/elements/speexresample.c: (test_pipeline):
Index: gstspc.c
RCS file: /cvs/gstreamer/gst-plugins-bad/ext/spc/gstspc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gstspc.c	8 Jul 2008 13:31:36 -0000	1.5
+++ gstspc.c	25 Nov 2008 18:28:18 -0000	1.6
@@ -195,20 +195,27 @@
 {
   GstSpcDec *spc = GST_SPC_DEC (gst_pad_get_parent (pad));
   gboolean result = TRUE;
+  gboolean forward = FALSE;
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_EOS:
-      result = spc_setup (spc);
-      break;
-    case GST_EVENT_NEWSEGMENT:
-      result = FALSE;
+      /* we get EOS when we loaded the complete file, now try to initialize the
+       * decoding */
+      if (!(result = spc_setup (spc))) {
+        /* can't start, post an ERROR and push EOS downstream */
+        GST_ELEMENT_ERROR (spc, STREAM, DEMUX, (NULL),
+            ("can't start playback"));
+        forward = TRUE;
+      }
       break;
     default:
   }
+  if (forward)
+    result = gst_pad_push_event (spc->srcpad, event);
+  else
+    gst_event_unref (event);
-  gst_event_unref (event);
   gst_object_unref (spc);
   return result;
@@ -453,18 +460,18 @@
 static gboolean
 spc_setup (GstSpcDec * spc)
-  guchar *data = GST_BUFFER_DATA (spc->buf);
   spc_tag_info *info;
   GstTagList *taglist;
   guint64 total_duration;
-  if (!spc_negotiate (spc)) {
+  if (!spc->buf || !spc_negotiate (spc)) {
     return FALSE;
   info = &(spc->tag_info);
-  spc_tag_get_info (data, GST_BUFFER_SIZE (spc->buf), info);
+  spc_tag_get_info (GST_BUFFER_DATA (spc->buf), GST_BUFFER_SIZE (spc->buf),
+      info);
   taglist = gst_tag_list_new ();

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.