1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Mon Dec 04 13:21:37 2006 +0000
1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Mon Dec 04 22:00:41 2006 +0000
1.3 @@ -330,8 +330,6 @@
1.4 gst_element_class_add_pad_template (element_class,
1.5 gst_static_pad_template_get (&sink_template));
1.6 gst_element_class_set_details (element_class, &gst_nuv_demux_details);
1.7 -
1.8 - g_debug ("GST VER: %d.%d", GST_VERSION_MINOR, GST_VERSION_MAJOR);
1.9 }
1.10
1.11 static void
1.12 @@ -410,8 +408,9 @@
1.13 GstBuffer *buffer = NULL;
1.14 GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 72, TRUE, &buffer);
1.15
1.16 - if ((res != GST_FLOW_OK) || (buffer == NULL))
1.17 - return res;
1.18 + if ((res != GST_FLOW_OK) || (buffer == NULL)) {
1.19 + goto done;
1.20 + }
1.21
1.22 memcpy (h->id, buffer->data, 12);
1.23 memcpy (h->version, buffer->data + 12, 5);
1.24 @@ -435,7 +434,11 @@
1.25 h->i_video_blocks, h->i_audio_blocks, h->i_text_blocks,
1.26 h->i_keyframe_distance);
1.27
1.28 - gst_buffer_unref (buffer);
1.29 +done:
1.30 + if (buffer != NULL) {
1.31 + gst_buffer_unref (buffer);
1.32 + buffer = NULL;
1.33 + }
1.34 return res;
1.35 }
1.36
1.37 @@ -460,9 +463,7 @@
1.38 GstBuffer *file_header = NULL;
1.39
1.40 res = gst_nuv_demux_read_bytes (nuv, 12, FALSE, &file_header);
1.41 - if ((res != GST_FLOW_OK) || (file_header == NULL)) {
1.42 - return res;
1.43 - } else {
1.44 + if (res == GST_FLOW_OK) {
1.45 if (strncmp ((gchar *) file_header->data, "MythTVVideo", 11) ||
1.46 strncmp ((gchar *) file_header->data, "NuppelVideo", 11)) {
1.47 nuv->priv->state = GST_NUV_DEMUX_HEADER_DATA;
1.48 @@ -475,8 +476,8 @@
1.49
1.50 if (file_header != NULL) {
1.51 gst_buffer_unref (file_header);
1.52 + file_header = NULL;
1.53 }
1.54 -
1.55 return res;
1.56 }
1.57
1.58 @@ -491,13 +492,8 @@
1.59 GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 12, TRUE, &buf);
1.60
1.61 if ((res != GST_FLOW_OK) || (buf == NULL)) {
1.62 - if (buf != NULL) {
1.63 - gst_buffer_unref (buf);
1.64 - buf = NULL;
1.65 - }
1.66 - return res;
1.67 + goto done;
1.68 }
1.69 -
1.70 data = buf->data;
1.71
1.72 h->i_type = GPOINTER_TO_INT (data[0]);
1.73 @@ -513,9 +509,12 @@
1.74 h->i_keyframe ? h->i_keyframe : ' ',
1.75 h->i_filters, h->i_timecode, h->i_length);
1.76
1.77 - gst_buffer_unref (buf);
1.78 - buf = NULL;
1.79 - return GST_FLOW_OK;
1.80 +done:
1.81 + if (buf != NULL) {
1.82 + gst_buffer_unref (buf);
1.83 + buf = NULL;
1.84 + }
1.85 + return res;
1.86 }
1.87
1.88 static GstFlowReturn
1.89 @@ -528,10 +527,7 @@
1.90 GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 512, TRUE, &buff);
1.91
1.92 if ((res != GST_FLOW_OK) || (buff == NULL)) {
1.93 - if (buff != NULL) {
1.94 - gst_buffer_unref (buff);
1.95 - }
1.96 - return res;
1.97 + goto done;
1.98 }
1.99
1.100 data = buff->data;
1.101 @@ -563,7 +559,11 @@
1.102 h->i_lavc_qmin, h->i_lavc_qmax, h->i_lavc_maxqdiff, h->i_seekable_offset,
1.103 h->i_keyframe_adjust_offset);
1.104
1.105 - gst_buffer_unref (buff);
1.106 +done:
1.107 + if (buff != NULL) {
1.108 + gst_buffer_unref (buff);
1.109 + buff = NULL;
1.110 + }
1.111 return res;
1.112 }
1.113
1.114 @@ -714,8 +714,9 @@
1.115
1.116 if (h.i_length > 0) {
1.117 ret = gst_nuv_demux_read_bytes (nuv, h.i_length, TRUE, &buf);
1.118 - if ((ret != GST_FLOW_OK) || (buf == NULL))
1.119 - return ret;
1.120 + if ((ret != GST_FLOW_OK) || (buf == NULL)) {
1.121 + goto done;
1.122 + }
1.123
1.124 if (h.i_timecode < 0) {
1.125 h.i_timecode = h.i_timecode * -1;
1.126 @@ -826,7 +827,6 @@
1.127
1.128 done:
1.129 if (buf != NULL) {
1.130 - g_free (buf->data);
1.131 gst_buffer_unref (buf);
1.132 buf = NULL;
1.133 }
1.134 @@ -1060,7 +1060,6 @@
1.135 } else {
1.136 if (gst_adapter_available (nuv->priv->adapter) < size)
1.137 return GST_FLOW_ERROR_NO_DATA;
1.138 -
1.139 if (move) {
1.140 *buffer = gst_adapter_take_buffer (nuv->priv->adapter, size);
1.141 } else {
1.142 @@ -1079,6 +1078,9 @@
1.143 gboolean res = TRUE;
1.144 GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
1.145
1.146 +
1.147 + res = gst_pad_activate_push (sinkpad, TRUE);
1.148 + return res;
1.149 if (gst_pad_check_pull_range (sinkpad)) {
1.150 res = gst_pad_activate_pull (sinkpad, TRUE);
1.151 } else {
1.152 @@ -1204,7 +1206,6 @@
1.153 gst_adapter_push (nuv->priv->adapter, buf);
1.154
1.155 gst_object_unref (nuv);
1.156 - //gst_buffer_unref (buf);
1.157
1.158 return gst_nuv_demux_play (pad);
1.159 }
1.160 @@ -1229,8 +1230,9 @@
1.161 nuv->priv->duration_average = GST_CLOCK_TIME_NONE;
1.162 gst_segment_init (&nuv->priv->segment, GST_FORMAT_TIME);
1.163
1.164 - if (nuv->priv->adapter != NULL)
1.165 + if (nuv->priv->adapter != NULL) {
1.166 gst_adapter_clear (nuv->priv->adapter);
1.167 + }
1.168
1.169 if (nuv->priv->mpeg_buffer != NULL) {
1.170 gst_buffer_unref (nuv->priv->mpeg_buffer);
1.171 @@ -1288,7 +1290,6 @@
1.172 gst_nuv_demux_update_duration (GstNuvDemux *nuv, guint64 current_timestamp)
1.173 {
1.174 guint64 interval = 0;
1.175 - return;
1.176
1.177 if (gst_nuv_demux_get_time_duration (nuv) != GST_CLOCK_TIME_NONE)
1.178 return;