summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-02-14 12:26:20 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-02-14 12:26:20 +0000
commit6cca025c97bdb920e7f5fea7cfd9f5c75ccca812 (patch)
tree1a7b798207ecd19b63f85e12c36f024d88c3ffb8
parentb01a413122cab895cb99cf5ed011966129e57563 (diff)
downloadgst-plugins-bad-6cca025c97bdb920e7f5fea7cfd9f5c75ccca812.tar.gz
gst-plugins-bad-6cca025c97bdb920e7f5fea7cfd9f5c75ccca812.tar.bz2
gst-plugins-bad-6cca025c97bdb920e7f5fea7cfd9f5c75ccca812.zip
ext/libmms/gstmms.c: Return FLOW_UNEXPECTED on EOS, not FLOW_ERROR. Also, no need to push our own EOS event on EOS, t...
Original commit message from CVS: * ext/libmms/gstmms.c: (gst_mms_class_init), (gst_mms_create), (gst_mms_start): Return FLOW_UNEXPECTED on EOS, not FLOW_ERROR. Also, no need to push our own EOS event on EOS, the base class will do that for us; fix bogus query code; post semi-decent errors on the bus when an error occurs in ::start(), otherwise the user will get to see whatever cryptic default message GstBaseSrc comes up with.
-rw-r--r--ChangeLog10
-rw-r--r--ext/libmms/gstmms.c36
2 files changed, 25 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 82f130b1..a46c8972 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-02-14 Tim-Philipp Müller <tim at centricular dot net>
+
+ * ext/libmms/gstmms.c: (gst_mms_class_init), (gst_mms_create),
+ (gst_mms_start):
+ Return FLOW_UNEXPECTED on EOS, not FLOW_ERROR. Also, no need to
+ push our own EOS event on EOS, the base class will do that for us;
+ fix bogus query code; post semi-decent errors on the bus when an
+ error occurs in ::start(), otherwise the user will get to see
+ whatever cryptic default message GstBaseSrc comes up with.
+
2006-02-14 Andy Wingo <wingo@pobox.com>
* sys/glsink/glimagesink.c (gst_glimage_sink_init): Come on
diff --git a/ext/libmms/gstmms.c b/ext/libmms/gstmms.c
index fa886d9d..82a26275 100644
--- a/ext/libmms/gstmms.c
+++ b/ext/libmms/gstmms.c
@@ -133,10 +133,10 @@ gst_mms_class_init (GstMMSClass * klass)
"How many bytes should be read at once", 0, 65536, 2048,
G_PARAM_READWRITE));
- gstbasesrc_class->start = gst_mms_start;
- gstbasesrc_class->stop = gst_mms_stop;
+ gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_mms_start);
+ gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_mms_stop);
- gstpushsrc_class->create = gst_mms_create;
+ gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_mms_create);
}
@@ -253,7 +253,6 @@ gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf)
/* DEBUG */
GstFormat fmt = GST_FORMAT_BYTES;
gint64 query_res;
- GstQuery *query;
mmssrc = GST_MMS (psrc);
*buf = gst_buffer_new_and_alloc (mmssrc->blocksize);
@@ -286,16 +285,10 @@ gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf)
/* EOS? */
if (result == 0) {
- GstPad *peer;
-
gst_buffer_unref (*buf);
*buf = NULL;
GST_DEBUG ("Returning EOS");
- peer = gst_pad_get_peer (GST_BASE_SRC_PAD (mmssrc));
- if (!gst_pad_send_event (peer, gst_event_new_eos ())) {
- ret = GST_FLOW_ERROR;
- }
- gst_object_unref (peer);
+ ret = GST_FLOW_UNEXPECTED;
goto done;
}
@@ -309,11 +302,9 @@ gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf)
GST_BUFFER_SIZE (*buf) = result;
/* DEBUG */
- query = gst_query_new_position (GST_QUERY_POSITION);
- gst_pad_query (GST_BASE_SRC (mmssrc)->srcpad, query);
- gst_query_parse_position (query, &fmt, &query_res);
- gst_query_unref (query);
- GST_DEBUG ("mms position: %lld\n", query_res);
+ fmt = GST_FORMAT_BYTES;
+ gst_pad_query_position (GST_BASE_SRC (mmssrc)->srcpad, &fmt, &query_res);
+ GST_DEBUG ("mms position: %" G_GINT64_FORMAT, query_res);
done:
@@ -328,10 +319,12 @@ gst_mms_start (GstBaseSrc * bsrc)
mms = GST_MMS (bsrc);
- if (!mms->uri_name) {
- ret = FALSE;
- goto done;
+ if (!mms->uri_name || *mms->uri_name == '\0') {
+ GST_ELEMENT_ERROR (mms, RESOURCE, OPEN_READ,
+ ("No URI to open specified"), (NULL));
+ return FALSE;
}
+
/* FIXME: pass some sane arguments here */
gst_mms_stop (bsrc);
@@ -342,11 +335,12 @@ gst_mms_start (GstBaseSrc * bsrc)
mms->connection_h = mmsh_connect (NULL, NULL, mms->uri_name, 128 * 1024);
if (mms->connection_h) {
ret = TRUE;
+ } else {
+ GST_ELEMENT_ERROR (mms, RESOURCE, OPEN_READ,
+ ("Could not connect to this stream"), (NULL));
}
-
}
-done:
return ret;
}