summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-22 15:35:42 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-22 15:35:42 +0100
commitddced37a8b83be290343502d4099d8f325da4e3f (patch)
tree33787bff4c2672b24e64133251b3790136b47f38
parent226f23eddeeadeb982e72977f00ce9fdf0ac5e7a (diff)
downloadgst-plugins-bad-ddced37a8b83be290343502d4099d8f325da4e3f.tar.gz
gst-plugins-bad-ddced37a8b83be290343502d4099d8f325da4e3f.tar.bz2
gst-plugins-bad-ddced37a8b83be290343502d4099d8f325da4e3f.zip
mxfmux: Add an error state from which we return immediately
Also improve debugging a bit.
-rw-r--r--gst/mxf/mxfmux.c31
-rw-r--r--gst/mxf/mxfmux.h3
2 files changed, 27 insertions, 7 deletions
diff --git a/gst/mxf/mxfmux.c b/gst/mxf/mxfmux.c
index 973415e0..87a00136 100644
--- a/gst/mxf/mxfmux.c
+++ b/gst/mxf/mxfmux.c
@@ -1254,21 +1254,27 @@ gst_mxf_mux_collected (GstCollectPads * pads, gpointer user_data)
GSList *sl;
gboolean eos = TRUE;
+ if (mux->state == GST_MXF_MUX_STATE_ERROR) {
+ GST_ERROR_OBJECT (mux, "Had an error before -- returning");
+ return GST_FLOW_ERROR;
+ }
+
if (mux->state == GST_MXF_MUX_STATE_HEADER) {
if (mux->collect->data == NULL) {
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
("No input streams configured"));
- return GST_FLOW_ERROR;
+ ret = GST_FLOW_ERROR;
+ goto error;
}
if (gst_pad_push_event (mux->srcpad,
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1,
0))) {
if ((ret = gst_mxf_mux_create_metadata (mux)) != GST_FLOW_OK)
- return ret;
+ goto error;
if ((ret = gst_mxf_mux_create_header_partition_pack (mux)) != GST_FLOW_OK)
- return ret;
+ goto error;
ret = gst_mxf_mux_write_header_metadata (mux);
} else {
@@ -1276,7 +1282,7 @@ gst_mxf_mux_collected (GstCollectPads * pads, gpointer user_data)
}
if (ret != GST_FLOW_OK)
- return ret;
+ goto error;
/* Sort pads, we will always write in that order */
mux->collect->data = g_slist_sort (mux->collect->data, _sort_mux_pads);
@@ -1284,7 +1290,7 @@ gst_mxf_mux_collected (GstCollectPads * pads, gpointer user_data)
/* Write body partition */
ret = gst_mxf_mux_write_body_partition (mux);
if (ret != GST_FLOW_OK)
- return ret;
+ goto error;
mux->state = GST_MXF_MUX_STATE_DATA;
}
@@ -1312,8 +1318,14 @@ gst_mxf_mux_collected (GstCollectPads * pads, gpointer user_data)
}
if (!eos && best) {
- return gst_mxf_mux_handle_buffer (mux, best);
+ GST_DEBUG_OBJECT (mux, "Handling buffer for pad '%" GST_PTR_FORMAT "'",
+ best->collect.pad);
+ ret = gst_mxf_mux_handle_buffer (mux, best);
+ if (ret != GST_FLOW_OK)
+ goto error;
} else if (eos) {
+ GST_DEBUG_OBJECT (mux, "Handling EOS");
+
mux->last_gc_position++;
mux->last_gc_timestamp =
gst_util_uint64_scale (mux->last_gc_position * GST_SECOND,
@@ -1324,6 +1336,13 @@ gst_mxf_mux_collected (GstCollectPads * pads, gpointer user_data)
} else {
return GST_FLOW_OK;
}
+
+error:
+ {
+ mux->state = GST_MXF_MUX_STATE_ERROR;
+ gst_pad_push_event (mux->srcpad, gst_event_new_eos ());
+ return ret;
+ }
}
static GstStateChangeReturn
diff --git a/gst/mxf/mxfmux.h b/gst/mxf/mxfmux.h
index ed35d7cb..612dfff4 100644
--- a/gst/mxf/mxfmux.h
+++ b/gst/mxf/mxfmux.h
@@ -61,7 +61,8 @@ typedef struct
typedef enum
{
GST_MXF_MUX_STATE_HEADER,
- GST_MXF_MUX_STATE_DATA
+ GST_MXF_MUX_STATE_DATA,
+ GST_MXF_MUX_STATE_ERROR
} GstMXFMuxState;
typedef struct _GstMXFMux {