diff -r d9628018e9f7 -r 653d06bca826 gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Mon Dec 04 13:21:37 2006 +0000 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Mon Dec 04 22:00:41 2006 +0000 @@ -330,8 +330,6 @@ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template)); gst_element_class_set_details (element_class, &gst_nuv_demux_details); - - g_debug ("GST VER: %d.%d", GST_VERSION_MINOR, GST_VERSION_MAJOR); } static void @@ -410,8 +408,9 @@ GstBuffer *buffer = NULL; GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 72, TRUE, &buffer); - if ((res != GST_FLOW_OK) || (buffer == NULL)) - return res; + if ((res != GST_FLOW_OK) || (buffer == NULL)) { + goto done; + } memcpy (h->id, buffer->data, 12); memcpy (h->version, buffer->data + 12, 5); @@ -435,7 +434,11 @@ h->i_video_blocks, h->i_audio_blocks, h->i_text_blocks, h->i_keyframe_distance); - gst_buffer_unref (buffer); +done: + if (buffer != NULL) { + gst_buffer_unref (buffer); + buffer = NULL; + } return res; } @@ -460,9 +463,7 @@ GstBuffer *file_header = NULL; res = gst_nuv_demux_read_bytes (nuv, 12, FALSE, &file_header); - if ((res != GST_FLOW_OK) || (file_header == NULL)) { - return res; - } else { + if (res == GST_FLOW_OK) { if (strncmp ((gchar *) file_header->data, "MythTVVideo", 11) || strncmp ((gchar *) file_header->data, "NuppelVideo", 11)) { nuv->priv->state = GST_NUV_DEMUX_HEADER_DATA; @@ -475,8 +476,8 @@ if (file_header != NULL) { gst_buffer_unref (file_header); + file_header = NULL; } - return res; } @@ -491,13 +492,8 @@ GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 12, TRUE, &buf); if ((res != GST_FLOW_OK) || (buf == NULL)) { - if (buf != NULL) { - gst_buffer_unref (buf); - buf = NULL; - } - return res; + goto done; } - data = buf->data; h->i_type = GPOINTER_TO_INT (data[0]); @@ -513,9 +509,12 @@ h->i_keyframe ? h->i_keyframe : ' ', h->i_filters, h->i_timecode, h->i_length); - gst_buffer_unref (buf); - buf = NULL; - return GST_FLOW_OK; +done: + if (buf != NULL) { + gst_buffer_unref (buf); + buf = NULL; + } + return res; } static GstFlowReturn @@ -528,10 +527,7 @@ GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 512, TRUE, &buff); if ((res != GST_FLOW_OK) || (buff == NULL)) { - if (buff != NULL) { - gst_buffer_unref (buff); - } - return res; + goto done; } data = buff->data; @@ -563,7 +559,11 @@ h->i_lavc_qmin, h->i_lavc_qmax, h->i_lavc_maxqdiff, h->i_seekable_offset, h->i_keyframe_adjust_offset); - gst_buffer_unref (buff); +done: + if (buff != NULL) { + gst_buffer_unref (buff); + buff = NULL; + } return res; } @@ -714,8 +714,9 @@ if (h.i_length > 0) { ret = gst_nuv_demux_read_bytes (nuv, h.i_length, TRUE, &buf); - if ((ret != GST_FLOW_OK) || (buf == NULL)) - return ret; + if ((ret != GST_FLOW_OK) || (buf == NULL)) { + goto done; + } if (h.i_timecode < 0) { h.i_timecode = h.i_timecode * -1; @@ -826,7 +827,6 @@ done: if (buf != NULL) { - g_free (buf->data); gst_buffer_unref (buf); buf = NULL; } @@ -1060,7 +1060,6 @@ } else { if (gst_adapter_available (nuv->priv->adapter) < size) return GST_FLOW_ERROR_NO_DATA; - if (move) { *buffer = gst_adapter_take_buffer (nuv->priv->adapter, size); } else { @@ -1079,6 +1078,9 @@ gboolean res = TRUE; GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad)); + + res = gst_pad_activate_push (sinkpad, TRUE); + return res; if (gst_pad_check_pull_range (sinkpad)) { res = gst_pad_activate_pull (sinkpad, TRUE); } else { @@ -1204,7 +1206,6 @@ gst_adapter_push (nuv->priv->adapter, buf); gst_object_unref (nuv); - //gst_buffer_unref (buf); return gst_nuv_demux_play (pad); } @@ -1229,8 +1230,9 @@ nuv->priv->duration_average = GST_CLOCK_TIME_NONE; gst_segment_init (&nuv->priv->segment, GST_FORMAT_TIME); - if (nuv->priv->adapter != NULL) + if (nuv->priv->adapter != NULL) { gst_adapter_clear (nuv->priv->adapter); + } if (nuv->priv->mpeg_buffer != NULL) { gst_buffer_unref (nuv->priv->mpeg_buffer); @@ -1288,7 +1290,6 @@ gst_nuv_demux_update_duration (GstNuvDemux *nuv, guint64 current_timestamp) { guint64 interval = 0; - return; if (gst_nuv_demux_get_time_duration (nuv) != GST_CLOCK_TIME_NONE) return;