summaryrefslogtreecommitdiffstats
path: root/ext/spc/gstspc.c
diff options
context:
space:
mode:
authorJonathan Matthew <notverysmart@gmail.com>2008-11-25 18:28:18 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-11-25 18:28:18 +0000
commitc68ea73e3fef09e8a7e9d4bd95454c418b8a91fd (patch)
treebb12aca022ca6ef70de52025de953ac1f55d5f2b /ext/spc/gstspc.c
parent7615d3d8d34a5439fe63eec69580cfcdeebbd8ce (diff)
downloadgst-plugins-bad-c68ea73e3fef09e8a7e9d4bd95454c418b8a91fd.tar.gz
gst-plugins-bad-c68ea73e3fef09e8a7e9d4bd95454c418b8a91fd.tar.bz2
gst-plugins-bad-c68ea73e3fef09e8a7e9d4bd95454c418b8a91fd.zip
ext/spc/gstspc.c: Post an error and push EOS when we can't start playback for some reason. also avoid a crash when fe...
Original commit message from CVS: 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.
Diffstat (limited to 'ext/spc/gstspc.c')
-rw-r--r--ext/spc/gstspc.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/ext/spc/gstspc.c b/ext/spc/gstspc.c
index b8d7810a..c8ece379 100644
--- a/ext/spc/gstspc.c
+++ b/ext/spc/gstspc.c
@@ -195,20 +195,27 @@ gst_spc_dec_sink_event (GstPad * pad, GstEvent * event)
{
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:
- result = FALSE;
break;
}
+ 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 @@ spc_play (GstPad * pad)
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 ();