diff --git a/ChangeLog b/ChangeLog index e3655dff1f..1b9d383b71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2005-07-14 Wim Taymans + + * gst/gstcaps.c: (gst_caps_do_simplify): + Remove debug info. + + * gst/gsterror.h: + Define error for stream stopped. + + * gst/gstghostpad.c: (gst_proxy_pad_do_bufferalloc), + (gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange): + Do proper return values. + + * gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps), + (gst_pad_set_caps), (gst_pad_chain), (gst_pad_push), + (gst_pad_get_range): + Better return values. + + * gst/gstpad.h: + Reorganise return values, add macro to check for fatal errors. + + * gst/gstqueue.c: (gst_queue_chain): + Return proper GstFlowReturn values, + 2005-07-14 Thomas Vander Stichele * docs/gst/gstreamer-sections.txt: diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 3188930612..0afa857cea 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -1401,12 +1401,6 @@ gst_caps_do_simplify (GstCaps * caps) break; } if (gst_caps_structure_simplify (&result, simplify, compare)) { -#if 0 - g_print ("%s - %s = %s\n", - gst_structure_to_string (simplify), - gst_structure_to_string (compare), - result ? gst_structure_to_string (result) : "---"); -#endif if (result) { gst_caps_switch_structures (caps, simplify, result, i); } else { diff --git a/gst/gsterror.h b/gst/gsterror.h index 897dc9249d..53f39fc262 100644 --- a/gst/gsterror.h +++ b/gst/gsterror.h @@ -163,6 +163,7 @@ typedef enum * @GST_STREAM_ERROR_MUX: used when muxing fails. * @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format * (for example, wrong caps). + * @GST_STREAM_ERROR_STOPPED: Streaming stopped. * @GST_STREAM_ERROR_NUM_ERRORS: the number of library error types. * * Stream errors are for anything related to the stream being processed: @@ -182,6 +183,7 @@ typedef enum GST_STREAM_ERROR_DEMUX, GST_STREAM_ERROR_MUX, GST_STREAM_ERROR_FORMAT, + GST_STREAM_ERROR_STOPPED, GST_STREAM_ERROR_NUM_ERRORS } GstStreamError; diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index 7dbb12c9f5..81a35cc122 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -156,7 +156,7 @@ gst_proxy_pad_do_bufferalloc (GstPad * pad, guint64 offset, guint size, GstPad *target = GST_PROXY_PAD_TARGET (pad); GstPad *peer; - g_return_val_if_fail (target != NULL, GST_FLOW_UNEXPECTED); + g_return_val_if_fail (target != NULL, GST_FLOW_NOT_LINKED); peer = gst_pad_get_peer (target); if (peer) { @@ -225,7 +225,7 @@ gst_proxy_pad_do_chain (GstPad * pad, GstBuffer * buffer) { GstPad *target = GST_PROXY_PAD_TARGET (pad); - g_return_val_if_fail (target != NULL, GST_FLOW_UNEXPECTED); + g_return_val_if_fail (target != NULL, GST_FLOW_NOT_LINKED); return gst_pad_chain (target, buffer); } @@ -236,7 +236,7 @@ gst_proxy_pad_do_getrange (GstPad * pad, guint64 offset, guint size, { GstPad *target = GST_PROXY_PAD_TARGET (pad); - g_return_val_if_fail (target != NULL, GST_FLOW_UNEXPECTED); + g_return_val_if_fail (target != NULL, GST_FLOW_NOT_LINKED); return gst_pad_get_range (target, offset, size, buffer); } diff --git a/gst/gstpad.c b/gst/gstpad.c index cc0a656e7a..58523f128b 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1600,6 +1600,9 @@ gst_pad_get_caps_unlocked (GstPad * pad) g_critical ("pad %s:%s returned NULL caps from getcaps function", GST_DEBUG_PAD_NAME (pad)); } else { + GST_CAT_DEBUG (GST_CAT_CAPS, + "pad getcaps %s:%s returned %" GST_PTR_FORMAT, + GST_DEBUG_PAD_NAME (pad), result); #ifndef G_DISABLE_ASSERT /* check that the returned caps are a real subset of the template caps */ if (GST_PAD_PAD_TEMPLATE (pad)) { @@ -2823,15 +2826,14 @@ flushing: "pushing, but pad was flushing"); GST_UNLOCK (pad); GST_STREAM_UNLOCK (pad); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_WRONG_STATE; } dropping: { gst_buffer_unref (buffer); GST_DEBUG ("Dropping buffer due to FALSE probe return"); GST_STREAM_UNLOCK (pad); - /* FIXME, failure? */ - return GST_FLOW_UNEXPECTED; + return GST_FLOW_OK; } not_negotiated: { @@ -2916,8 +2918,7 @@ dropping: gst_buffer_unref (buffer); gst_object_unref (peer); GST_DEBUG ("Dropping buffer due to FALSE probe return"); - /* FIXME, failure? */ - return GST_FLOW_UNEXPECTED; + return GST_FLOW_OK; } } @@ -3049,7 +3050,7 @@ flushing: "pulling range, but pad was flushing"); GST_UNLOCK (pad); GST_STREAM_UNLOCK (pad); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_WRONG_STATE; } no_function: { diff --git a/gst/gstpad.h b/gst/gstpad.h index 9e827d2522..9876af9157 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -71,16 +71,20 @@ typedef enum { #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK) typedef enum { - GST_FLOW_OK = 0, /* data passing was ok */ GST_FLOW_RESEND = 1, /* resend buffer, possibly with new caps */ - GST_FLOW_ERROR = -1, /* some (fatal) error occured */ - GST_FLOW_NOT_LINKED = -2, /* pad is not linked */ - GST_FLOW_NOT_NEGOTIATED = -3, /* pad is not negotiated */ - GST_FLOW_WRONG_STATE = -4, /* pad is in wrong state */ - GST_FLOW_UNEXPECTED = -5, /* did not expect anything, this is not fatal */ + GST_FLOW_OK = 0, /* data passing was ok */ + /* expected failures */ + GST_FLOW_NOT_LINKED = -1, /* pad is not linked */ + GST_FLOW_WRONG_STATE = -2, /* pad is in wrong state */ + /* error cases */ + GST_FLOW_UNEXPECTED = -3, /* did not expect anything, like after EOS */ + GST_FLOW_NOT_NEGOTIATED = -4, /* pad is not negotiated */ + GST_FLOW_ERROR = -5, /* some (fatal) error occured */ GST_FLOW_NOT_SUPPORTED = -6 /* function not supported */ } GstFlowReturn; +#define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED) + typedef enum { GST_ACTIVATE_NONE, GST_ACTIVATE_PUSH, diff --git a/gst/gstqueue.c b/gst/gstqueue.c index 17e4399c7d..e251f2ee77 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -655,20 +655,23 @@ gst_queue_chain (GstPad * pad, GstBuffer * buffer) return GST_FLOW_OK; out_unref: - GST_QUEUE_MUTEX_UNLOCK; + { + GST_QUEUE_MUTEX_UNLOCK; - gst_buffer_unref (buffer); - - return GST_FLOW_OK; + gst_buffer_unref (buffer); + return GST_FLOW_OK; + } out_flushing: - GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush"); - GST_QUEUE_MUTEX_UNLOCK; - gst_pad_pause_task (queue->srcpad); + { + GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush"); + GST_QUEUE_MUTEX_UNLOCK; + gst_pad_pause_task (queue->srcpad); - gst_buffer_unref (buffer); + gst_buffer_unref (buffer); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_WRONG_STATE; + } } static void diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 17e4399c7d..e251f2ee77 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -655,20 +655,23 @@ gst_queue_chain (GstPad * pad, GstBuffer * buffer) return GST_FLOW_OK; out_unref: - GST_QUEUE_MUTEX_UNLOCK; + { + GST_QUEUE_MUTEX_UNLOCK; - gst_buffer_unref (buffer); - - return GST_FLOW_OK; + gst_buffer_unref (buffer); + return GST_FLOW_OK; + } out_flushing: - GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush"); - GST_QUEUE_MUTEX_UNLOCK; - gst_pad_pause_task (queue->srcpad); + { + GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because of flush"); + GST_QUEUE_MUTEX_UNLOCK; + gst_pad_pause_task (queue->srcpad); - gst_buffer_unref (buffer); + gst_buffer_unref (buffer); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_WRONG_STATE; + } } static void