summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-15 15:27:03 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-21 10:19:48 +0100
commit266736817d1ce0ba79e52b23d3aae8610d645784 (patch)
treea468ed37e7ea52d9927d10fe5ae5b642c7b37908
parent57ba515539679610dec04519c132f10491e96d71 (diff)
downloadgst-plugins-bad-266736817d1ce0ba79e52b23d3aae8610d645784.tar.gz
gst-plugins-bad-266736817d1ce0ba79e52b23d3aae8610d645784.tar.bz2
gst-plugins-bad-266736817d1ce0ba79e52b23d3aae8610d645784.zip
mxfmux: Add some debugging and error out on invalid input data
-rw-r--r--gst/mxf/mxfmux.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gst/mxf/mxfmux.c b/gst/mxf/mxfmux.c
index 0cec37ee..d6bcc30b 100644
--- a/gst/mxf/mxfmux.c
+++ b/gst/mxf/mxfmux.c
@@ -268,6 +268,8 @@ gst_mxf_mux_setcaps (GstPad * pad, GstCaps * caps)
MXFUL d_instance_uid = { {0,} };
MXFMetadataFileDescriptor *old_descriptor = cpad->descriptor;
+ GST_DEBUG_OBJECT (pad, "Setting caps %" GST_PTR_FORMAT, caps);
+
if (old_descriptor) {
memcpy (&d_instance_uid, &MXF_METADATA_BASE (old_descriptor)->instance_uid,
16);
@@ -368,6 +370,7 @@ gst_mxf_mux_request_new_pad (GstElement * element,
pad_number = g_atomic_int_exchange_and_add ((gint *) & mux->n_pads, 1);
name = g_strdup_printf (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ), pad_number);
+ GST_DEBUG_OBJECT (mux, "Creating pad '%s'", name);
pad = gst_pad_new_from_template (templ, name);
g_free (name);
cpad = (GstMXFMuxPad *)
@@ -412,9 +415,14 @@ gst_mxf_mux_create_metadata (GstMXFMux * mux)
GSList *l;
GArray *tmp;
+ GST_DEBUG_OBJECT (mux, "Creating MXF metadata");
+
for (l = mux->collect->data; l; l = l->next) {
GstMXFMuxPad *cpad = l->data;
+ if (!cpad || !cpad->descriptor || !GST_PAD_CAPS (cpad->collect.pad))
+ return GST_FLOW_ERROR;
+
if (cpad->writer->update_descriptor)
cpad->writer->update_descriptor (cpad->descriptor,
GST_PAD_CAPS (cpad->collect.pad), cpad->mapping_data,
@@ -701,6 +709,11 @@ gst_mxf_mux_create_metadata (GstMXFMux * mux)
sizeof (MXFFraction));
}
+ if (track->edit_rate.d <= 0 || track->edit_rate.n <= 0) {
+ GST_ERROR_OBJECT (mux, "Invalid edit rate");
+ return GST_FLOW_ERROR;
+ }
+
if (min_edit_rate_d >
((gdouble) track->edit_rate.n) / ((gdouble) track->edit_rate.d)) {
min_edit_rate_d =
@@ -980,6 +993,10 @@ gst_mxf_mux_handle_buffer (GstMXFMux * mux, GstMXFMuxPad * cpad)
GstFlowReturn ret = GST_FLOW_OK;
guint8 slen, ber[9];
+ GST_DEBUG_OBJECT (mux,
+ "Handling buffer of size %u for track %u at position %" G_GINT64_FORMAT,
+ GST_BUFFER_SIZE (buf), cpad->source_track->parent.track_id, cpad->pos);
+
if ((ret =
cpad->write_func (buf, GST_PAD_CAPS (cpad->collect.pad),
cpad->mapping_data, cpad->adapter, &outbuf,
@@ -1252,6 +1269,8 @@ gst_mxf_mux_collected (GstCollectPads * pads, gpointer user_data)
mux->state = GST_MXF_MUX_STATE_DATA;
}
+ g_return_val_if_fail (g_hash_table_size (mux->metadata) > 0, GST_FLOW_ERROR);
+
for (sl = mux->collect->data; sl; sl = sl->next) {
GstMXFMuxPad *cpad = sl->data;
GstClockTime next_gc_timestamp =