mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 20:59:44 +00:00
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.
This commit is contained in:
parent
b01a413122
commit
6cca025c97
2 changed files with 25 additions and 21 deletions
10
ChangeLog
10
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
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue