[svn r74] Changed the set_active on PADs, fixed some offset on video and audio.
1.1 --- a/gst-plugins-nuvdemux/src/gstnuvdemux.c Tue Nov 07 23:11:23 2006 +0000
1.2 +++ b/gst-plugins-nuvdemux/src/gstnuvdemux.c Thu Nov 09 15:20:29 2006 +0000
1.3 @@ -52,15 +52,13 @@
1.4 #include <gst/gstplugin.h>
1.5 #include <string.h>
1.6
1.7 -#define GETTEXT_PACKAGE "gst-plugins-nuvdemux-0.10.3"
1.8 -#include <glib/gi18n.h>
1.9 +#include "gst/gst-i18n-plugin.h"
1.10 #include "gstnuvdemux.h"
1.11
1.12 GST_DEBUG_CATEGORY_STATIC (nuvdemux_debug);
1.13 #define GST_CAT_DEFAULT nuvdemux_debug
1.14
1.15
1.16 -#define DEMUX_INDEX_SIZE_MAX (100000)
1.17 #define GST_FLOW_ERROR_NO_DATA -101
1.18
1.19 GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT);
1.20 @@ -90,11 +88,11 @@
1.21 GST_STATIC_CAPS_ANY);
1.22
1.23 /* NUV Demux indexes init/dispose callers */
1.24 -static nuv_demux_index* gst_nuv_demux_index_new (void);
1.25 -static void gst_nuv_demux_index_destroy (nuv_demux_index *p_idx);
1.26 +static void gst_nuv_demux_index_init( nuv_demux_index **p_idx );
1.27 +static void gst_nuv_demux_index_clean( nuv_demux_index **p_idx );
1.28
1.29 /* NUV Demux indexes manipulation functions */
1.30 -static gint64 gst_nuv_demux_index_find_offset( GstNuvDemux *nuv, gint64 i_offset );
1.31 +//static gint64 gst_nuv_demux_index_find_offset( GstNuvDemux *nuv, gint64 i_offset );
1.32 static void gst_nuv_demux_index_append( GstNuvDemux *nuv, gint64 i_time, gint64 i_offset );
1.33 static gint64 gst_nuv_demux_index_convert_time( GstNuvDemux *nuv, gint64 i_time );
1.34
1.35 @@ -107,12 +105,16 @@
1.36 static GstFlowReturn gst_nuv_demux_play (GstPad * pad);
1.37 static gboolean gst_nuv_demux_sink_activate_pull (GstPad * sinkpad,
1.38 gboolean active);
1.39 -static gboolean gst_nuv_demux_sink_activate_push (GstPad * pad,
1.40 - gboolean active);
1.41 static gboolean gst_nuv_demux_sink_activate (GstPad * sinkpad);
1.42 static GstFlowReturn gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size,
1.43 gboolean move, GstBuffer ** buffer);
1.44 static void gst_nuv_demux_reset (GstNuvDemux * nuv);
1.45 +static gboolean gst_nuv_demux_handle_sink_event (GstPad * sinkpad,
1.46 + GstEvent * event);
1.47 +static gboolean gst_nuv_demux_handle_audio_src_event (GstPad * sinkpad,
1.48 + GstEvent * event);
1.49 +static gboolean gst_nuv_demux_handle_video_src_event (GstPad * sinkpad,
1.50 + GstEvent * event);
1.51 static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv);
1.52 static void gst_nuv_demux_send_eos (GstNuvDemux * nuv);
1.53
1.54 @@ -180,15 +182,14 @@
1.55 gst_pad_set_activatepull_function (nuv->sinkpad,
1.56 gst_nuv_demux_sink_activate_pull);
1.57
1.58 - gst_pad_set_activatepush_function (nuv->sinkpad,
1.59 - gst_nuv_demux_sink_activate_push);
1.60 -
1.61 gst_pad_set_chain_function (nuv->sinkpad,
1.62 GST_DEBUG_FUNCPTR (gst_nuv_demux_chain));
1.63
1.64 + gst_pad_set_event_function (nuv->sinkpad, gst_nuv_demux_handle_sink_event);
1.65 +
1.66 gst_element_add_pad (GST_ELEMENT (nuv), nuv->sinkpad);
1.67
1.68 - nuv->index_entries = gst_nuv_demux_index_new ();
1.69 + gst_nuv_demux_index_init( &nuv->index_entries );
1.70
1.71 nuv->adapter = NULL;
1.72 nuv->mpeg_buffer = NULL;
1.73 @@ -208,7 +209,7 @@
1.74 }
1.75
1.76 if ( nuv->index_entries != NULL ) {
1.77 - gst_nuv_demux_index_destroy (nuv->index_entries);
1.78 + gst_nuv_demux_index_clean( &nuv->index_entries );
1.79 nuv->index_entries = NULL;
1.80 }
1.81
1.82 @@ -225,20 +226,22 @@
1.83 * Indexes (timecode offset conversion) functions
1.84 *****************************************************************************/
1.85
1.86 -static nuv_demux_index*
1.87 -gst_nuv_demux_index_new (void)
1.88 +static void
1.89 +gst_nuv_demux_index_init( nuv_demux_index **p_idx )
1.90 {
1.91 - return g_new0 (nuv_demux_index, 1);
1.92 + *p_idx = g_new0( nuv_demux_index, 1 );
1.93 + (*p_idx)->i_idx = 0;
1.94 + (*p_idx)->i_idx_max = 0;
1.95 }
1.96
1.97 static void
1.98 -gst_nuv_demux_index_destroy (nuv_demux_index *p_idx)
1.99 +gst_nuv_demux_index_clean( nuv_demux_index **p_idx )
1.100 {
1.101 - if (p_idx != NULL) {
1.102 - g_free (p_idx->idx);
1.103 - p_idx->idx = NULL;
1.104 - g_free (p_idx);
1.105 + if ( *p_idx != NULL ) {
1.106 + g_free( *p_idx );
1.107 + *p_idx = NULL;
1.108 }
1.109 +
1.110 }
1.111
1.112 static void
1.113 @@ -250,13 +253,13 @@
1.114 // return;
1.115
1.116 /* Be sure to append new entry (we don't insert point) */
1.117 - if (p_idx != NULL && p_idx->i_idx > 0 && p_idx->idx[p_idx->i_idx-1].i_time >= i_time)
1.118 + if( p_idx != NULL && p_idx->i_idx > 0 && p_idx->idx[p_idx->i_idx-1].i_time >= i_time )
1.119 return;
1.120
1.121 /* */
1.122 - if (p_idx->i_idx >= p_idx->i_idx_max)
1.123 + if( p_idx->i_idx >= p_idx->i_idx_max )
1.124 {
1.125 - if (p_idx->i_idx >= DEMUX_INDEX_SIZE_MAX)
1.126 + if( p_idx->i_idx >= DEMUX_INDEX_SIZE_MAX )
1.127 {
1.128 /* Avoid too big index */
1.129 const gint64 i_length = p_idx->idx[p_idx->i_idx-1].i_time -
1.130 @@ -265,20 +268,20 @@
1.131 gint i, j;
1.132
1.133 /* We try to reduce the resolution of the index by a factor 2 */
1.134 - for (i = 1, j = 1; i < p_idx->i_idx; i++)
1.135 + for( i = 1, j = 1; i < p_idx->i_idx; i++ )
1.136 {
1.137 - if (p_idx->idx[i].i_time < j * i_length / i_count)
1.138 + if( p_idx->idx[i].i_time < j * i_length / i_count )
1.139 continue;
1.140
1.141 p_idx->idx[j++] = p_idx->idx[i];
1.142 }
1.143 p_idx->i_idx = j;
1.144
1.145 - if (p_idx->i_idx > 3 * DEMUX_INDEX_SIZE_MAX / 4)
1.146 + if( p_idx->i_idx > 3 * DEMUX_INDEX_SIZE_MAX / 4 )
1.147 {
1.148 /* We haven't created enough space
1.149 * (This method won't create a good index but work for sure) */
1.150 - for (i = 0; i < p_idx->i_idx/2; i++)
1.151 + for( i = 0; i < p_idx->i_idx/2; i++ )
1.152 p_idx->idx[i] = p_idx->idx[2*i];
1.153 p_idx->i_idx /= 2;
1.154 }
1.155 @@ -286,8 +289,6 @@
1.156 else
1.157 {
1.158 p_idx->i_idx_max += 1000;
1.159 - p_idx->idx = g_realloc (p_idx->idx,
1.160 - p_idx->i_idx_max*sizeof(nuv_demux_index_entry));
1.161 }
1.162 }
1.163
1.164 @@ -342,50 +343,26 @@
1.165 return p_idx->idx[i_max].i_offset;
1.166 }
1.167
1.168 -static gint64
1.169 -gst_nuv_demux_index_find_offset( GstNuvDemux *nuv, gint64 i_offset )
1.170 +/*****************************************************************************
1.171 + * Utils functions
1.172 + *****************************************************************************/
1.173 +
1.174 +static gboolean
1.175 +gst_nuv_demux_handle_sink_event (GstPad * sinkpad, GstEvent * event)
1.176 {
1.177 - nuv_demux_index *p_idx = nuv->index_entries;
1.178 + gboolean res = FALSE;
1.179
1.180 - g_return_val_if_fail( p_idx != NULL && p_idx->idx != NULL, i_offset );
1.181 + switch (GST_EVENT_TYPE (event)) {
1.182 + case GST_EVENT_NEWSEGMENT:
1.183 + res = TRUE;
1.184 + break;
1.185 + default:
1.186 + return gst_pad_event_default (sinkpad, event);
1.187 + break;
1.188 + }
1.189
1.190 - gint i_min = 0;
1.191 - gint i_max = p_idx->i_idx-1;
1.192 -
1.193 - /* Empty index */
1.194 - if( p_idx->i_idx <= 0 )
1.195 - return -1;
1.196 -
1.197 - /* Special border case */
1.198 - if( i_offset <= p_idx->idx[0].i_offset )
1.199 - return p_idx->idx[0].i_offset;
1.200 - if( i_offset == p_idx->idx[i_max].i_offset )
1.201 - return p_idx->idx[i_max].i_offset;
1.202 - if( i_offset > p_idx->idx[i_max].i_offset )
1.203 - return -1;
1.204 -
1.205 - /* Dicho */
1.206 - for( ;; )
1.207 - {
1.208 - gint i_med;
1.209 -
1.210 - if ( i_max - i_min <= 1 )
1.211 - break;
1.212 -
1.213 - i_med = (i_min+i_max)/2;
1.214 - if( p_idx->idx[i_med].i_offset < i_offset )
1.215 - i_min = i_med;
1.216 - else if( p_idx->idx[i_med].i_offset > i_offset )
1.217 - i_max = i_med;
1.218 - else
1.219 - return p_idx->idx[i_med].i_offset;
1.220 - }
1.221 -
1.222 - /* return nearest */
1.223 - if( i_offset - p_idx->idx[i_min].i_offset < p_idx->idx[i_max].i_offset - i_offset )
1.224 - return p_idx->idx[i_min].i_offset;
1.225 - else
1.226 - return p_idx->idx[i_max].i_offset;
1.227 + gst_event_unref (event);
1.228 + return res;
1.229 }
1.230
1.231 /* HeaderLoad:
1.232 @@ -559,12 +536,18 @@
1.233 }
1.234
1.235 static gboolean
1.236 -gst_nuv_demux_handle_src_event (GstPad * pad, GstEvent * event)
1.237 +gst_nuv_demux_handle_audio_src_event (GstPad * pad, GstEvent * event)
1.238 {
1.239 gst_event_unref (event);
1.240 return FALSE;
1.241 }
1.242
1.243 +static gboolean
1.244 +gst_nuv_demux_handle_video_src_event (GstPad * pad, GstEvent * event)
1.245 +{
1.246 + gst_event_unref (event);
1.247 + return FALSE;
1.248 +}
1.249
1.250 static void
1.251 gst_nuv_demux_create_pads (GstNuvDemux * nuv)
1.252 @@ -584,15 +567,13 @@
1.253 (gint) (nuv->h->d_aspect * 1000.0f), 1000, NULL);
1.254
1.255 gst_pad_use_fixed_caps (nuv->src_video_pad);
1.256 - gst_pad_set_active (nuv->src_video_pad, TRUE);
1.257 gst_pad_set_caps (nuv->src_video_pad, video_caps);
1.258
1.259 + gst_pad_set_event_function (nuv->src_video_pad,
1.260 + gst_nuv_demux_handle_video_src_event);
1.261 gst_pad_set_active (nuv->src_video_pad, TRUE);
1.262 gst_element_add_pad (GST_ELEMENT (nuv), nuv->src_video_pad);
1.263
1.264 - gst_pad_set_event_function (nuv->src_video_pad,
1.265 - gst_nuv_demux_handle_src_event);
1.266 -
1.267 gst_caps_unref (video_caps);
1.268 }
1.269
1.270 @@ -609,14 +590,13 @@
1.271 "mpegversion", G_TYPE_INT, nuv->eh->i_version, NULL);
1.272
1.273 gst_pad_use_fixed_caps (nuv->src_audio_pad);
1.274 - gst_pad_set_active (nuv->src_audio_pad, TRUE);
1.275 gst_pad_set_caps (nuv->src_audio_pad, audio_caps);
1.276 +
1.277 + gst_pad_set_event_function (nuv->src_audio_pad,
1.278 + gst_nuv_demux_handle_audio_src_event);
1.279 gst_pad_set_active (nuv->src_audio_pad, TRUE);
1.280 gst_element_add_pad (GST_ELEMENT (nuv), nuv->src_audio_pad);
1.281
1.282 - gst_pad_set_event_function (nuv->src_audio_pad,
1.283 - gst_nuv_demux_handle_src_event);
1.284 -
1.285 gst_caps_unref (audio_caps);
1.286 }
1.287
1.288 @@ -642,14 +622,19 @@
1.289 GstFlowReturn ret = GST_FLOW_OK;
1.290 GstBuffer *buf = NULL;
1.291 nuv_frame_header *h = nuv->fh;
1.292 +
1.293 + gint64 table_timecode = 0;
1.294
1.295 if (h->i_type == 'R')
1.296 goto done;
1.297
1.298 + table_timecode = h->i_timecode;
1.299
1.300 - GST_DEBUG_OBJECT (nuv, "starting append index");
1.301 - /* append the frame's header timecode field, and the actual offset */
1.302 - gst_nuv_demux_index_append( nuv, h->i_timecode, nuv->offset );
1.303 + /* append the frame's header timecode field, and the actual offset */
1.304 + if ( h->i_type == 'V' )
1.305 + gst_nuv_demux_index_append( nuv, h->i_timecode, nuv->video_offset );
1.306 + else if ( h->i_type == 'A' )
1.307 + gst_nuv_demux_index_append( nuv, h->i_timecode, nuv->audio_offset );
1.308
1.309 if (h->i_length > 0) {
1.310 ret = gst_nuv_demux_read_bytes (nuv, h->i_length, TRUE, &buf);
1.311 @@ -659,71 +644,80 @@
1.312 /* search for a valid timecode in the indexes list (find the nearest valid timecode) */
1.313 if ( h->i_timecode < 0 ) {
1.314 /* convert this actual timecode to a valid index in the timecode's table */
1.315 - gint64 pos = gst_nuv_demux_index_convert_time (nuv, h->i_timecode);
1.316 -
1.317 - /* find the nearest empty frame slot */
1.318 - gint64 near_off = gst_nuv_demux_index_find_offset (nuv, pos);
1.319 + gint64 pos = gst_nuv_demux_index_convert_time( nuv, h->i_timecode );
1.320
1.321 /* just get the timecode from the timecode's table */
1.322 - GST_BUFFER_TIMESTAMP (buf) = nuv->index_entries->idx[near_off].i_time * GST_MSECOND;
1.323 + table_timecode = nuv->index_entries->idx[pos].i_time * GST_MSECOND;
1.324 } else {
1.325 - GST_BUFFER_TIMESTAMP (buf) = h->i_timecode * GST_MSECOND;
1.326 + table_timecode = h->i_timecode * GST_MSECOND;
1.327 }
1.328 - }
1.329 -
1.330 - GST_DEBUG_OBJECT (nuv, "index appended");
1.331 +
1.332 + GST_BUFFER_TIMESTAMP (buf) = table_timecode;
1.333 + }
1.334
1.335 switch (h->i_type) {
1.336 case 'V':
1.337 {
1.338 if (h->i_length == 0)
1.339 break;
1.340 -
1.341 - GST_BUFFER_OFFSET (buf) = nuv->video_offset;
1.342 +
1.343 + if ( !gst_pad_is_linked( nuv->src_video_pad ) )
1.344 + break;
1.345 +
1.346 + //GST_PAD_STREAM_LOCK(nuv->src_video_pad);
1.347 +
1.348 + GST_BUFFER_SIZE (buf) = h->i_length;
1.349 gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_video_pad));
1.350 ret = gst_pad_push (nuv->src_video_pad, buf);
1.351 - if (ret != GST_FLOW_OK) {
1.352 - GST_WARNING_OBJECT (nuv, "error pushing on srcpad %s, is linked? = %d",
1.353 - gst_pad_get_name (nuv->src_video_pad), gst_pad_is_linked (nuv->src_video_pad));
1.354 - }
1.355 - nuv->video_offset++;
1.356 + nuv->video_offset += h->i_length;
1.357 +
1.358 + //GST_PAD_STREAM_UNLOCK(nuv->src_video_pad);
1.359 break;
1.360 }
1.361 case 'A':
1.362 {
1.363 if (h->i_length == 0)
1.364 break;
1.365 -
1.366 - GST_BUFFER_OFFSET (buf) = nuv->audio_offset;
1.367 +
1.368 + if ( !gst_pad_is_linked( nuv->src_audio_pad ) )
1.369 + break;
1.370 +
1.371 + //GST_PAD_STREAM_LOCK(nuv->src_audio_pad);
1.372 +
1.373 + GST_BUFFER_SIZE (buf) = h->i_length;
1.374 gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_audio_pad));
1.375 ret = gst_pad_push (nuv->src_audio_pad, buf);
1.376 - if (ret != GST_FLOW_OK) {
1.377 - GST_WARNING_OBJECT (nuv, "Error pushing on srcpad %s, is linked? = %d",
1.378 - gst_pad_get_name (nuv->src_audio_pad), gst_pad_is_linked (nuv->src_audio_pad));
1.379 - }
1.380 - nuv->audio_offset++;
1.381 + nuv->audio_offset += h->i_length;
1.382 +
1.383 + //GST_PAD_STREAM_UNLOCK(nuv->src_audio_pad);
1.384 break;
1.385 }
1.386 case 'S':
1.387 {
1.388 - /*
1.389 switch (h->i_compression) {
1.390 case 'V':
1.391 - GST_DEBUG_OBJECT (nuv, "Video New Segment");
1.392 - nuv->video_offset = 0;
1.393 + if ( !gst_pad_is_linked( nuv->src_video_pad ) )
1.394 + break;
1.395 +
1.396 + //GST_PAD_STREAM_LOCK(nuv->src_video_pad);
1.397 gst_pad_push_event (nuv->src_video_pad,
1.398 - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1,
1.399 - 0));
1.400 + gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, table_timecode,
1.401 + GST_CLOCK_TIME_NONE, 0));
1.402 + //GST_PAD_STREAM_UNLOCK(nuv->src_video_pad);
1.403 break;
1.404 - case 'A':
1.405 - GST_DEBUG_OBJECT (nuv, "Audio New Segment");
1.406 + case 'A':
1.407 + if ( !gst_pad_is_linked( nuv->src_audio_pad ) )
1.408 + break;
1.409 +
1.410 + //GST_PAD_STREAM_LOCK(nuv->src_audio_pad);
1.411 gst_pad_push_event (nuv->src_audio_pad,
1.412 - gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
1.413 + gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, table_timecode,
1.414 + GST_CLOCK_TIME_NONE, 0));
1.415 + //GST_PAD_STREAM_UNLOCK(nuv->src_audio_pad);
1.416 break;
1.417 default:
1.418 break;
1.419 }
1.420 - */
1.421 }
1.422 default:
1.423 if (buf != NULL)
1.424 @@ -732,8 +726,6 @@
1.425 break;
1.426 }
1.427
1.428 - GST_DEBUG_OBJECT (nuv, "data sent");
1.429 -
1.430 done:
1.431 nuv->state = GST_NUV_DEMUX_FRAME_HEADER;
1.432 g_free (nuv->fh);
1.433 @@ -751,7 +743,7 @@
1.434 gst_nuv_demux_read_bytes (nuv, nuv->mpeg_data_size, TRUE,
1.435 &nuv->mpeg_buffer);
1.436 if (ret != GST_FLOW_OK) {
1.437 - return GST_FLOW_ERROR;
1.438 + return ret; //GST_FLOW_ERROR;
1.439 }
1.440 GST_BUFFER_SIZE (nuv->mpeg_buffer) = nuv->mpeg_data_size;
1.441 nuv->state = GST_NUV_DEMUX_EXTEND_HEADER;
1.442 @@ -912,7 +904,7 @@
1.443
1.444 case GST_NUV_DEMUX_MOVI:
1.445 res = gst_nuv_demux_stream_data (nuv);
1.446 - if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
1.447 + if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA) && (res != GST_FLOW_CUSTOM_ERROR)) {
1.448 goto pause;
1.449 }
1.450 break;
1.451 @@ -929,8 +921,6 @@
1.452 return GST_FLOW_OK;
1.453
1.454 pause:
1.455 - g_debug ("PAUSE");
1.456 -
1.457 GST_LOG_OBJECT (nuv, "pausing task, reason %s", gst_flow_get_name (res));
1.458 gst_pad_pause_task (nuv->sinkpad);
1.459 if (GST_FLOW_IS_FATAL (res)) {
1.460 @@ -965,13 +955,13 @@
1.461 *buffer = gst_buffer_new ();
1.462 return ret;
1.463 }
1.464 -
1.465 +
1.466 if (nuv->mode == 0) {
1.467 ret = gst_pad_pull_range (nuv->sinkpad, nuv->offset, size, buffer);
1.468 if (ret == GST_FLOW_OK) {
1.469 - if (move) {
1.470 - nuv->offset += size;
1.471 - }
1.472 + if (move) {
1.473 + nuv->offset += size;
1.474 + }
1.475 /* got eos */
1.476 } else if (ret == GST_FLOW_UNEXPECTED) {
1.477 gst_nuv_demux_send_eos (nuv);
1.478 @@ -982,11 +972,7 @@
1.479 return GST_FLOW_ERROR_NO_DATA;
1.480
1.481 if (move) {
1.482 - guint8 *data = NULL;
1.483 -
1.484 - data = (guint8 *) gst_adapter_take (nuv->adapter, size);
1.485 - *buffer = gst_buffer_new ();
1.486 - gst_buffer_set_data (*buffer, data, size);
1.487 + *buffer = gst_adapter_take_buffer (nuv->adapter, size);
1.488 } else {
1.489 guint8 *data = NULL;
1.490
1.491 @@ -995,6 +981,8 @@
1.492 gst_buffer_set_data (*buffer, data, size);
1.493 }
1.494 }
1.495 +
1.496 +
1.497 return ret;
1.498 }
1.499
1.500 @@ -1006,14 +994,20 @@
1.501
1.502 if (gst_pad_check_pull_range (sinkpad)) {
1.503 nuv->mode = 0;
1.504 - nuv->adapter = NULL;
1.505 + if (nuv->adapter) {
1.506 + gst_adapter_clear (nuv->adapter);
1.507 + g_object_unref (nuv->adapter);
1.508 + nuv->adapter = NULL;
1.509 + }
1.510 res = gst_pad_activate_pull (sinkpad, TRUE);
1.511 - GST_DEBUG_OBJECT (nuv, "starting PULL mode");
1.512 } else {
1.513 nuv->mode = 1;
1.514 - nuv->adapter = gst_adapter_new ();
1.515 + if (nuv->adapter) {
1.516 + gst_adapter_clear (nuv->adapter);
1.517 + } else {
1.518 + nuv->adapter = gst_adapter_new ();
1.519 + }
1.520 res = gst_pad_activate_push (sinkpad, TRUE);
1.521 - GST_DEBUG_OBJECT (nuv, "starting PUSH mode");
1.522 }
1.523
1.524 g_object_unref (nuv);
1.525 @@ -1035,22 +1029,6 @@
1.526 return TRUE;
1.527 }
1.528
1.529 -static gboolean
1.530 -gst_nuv_demux_sink_activate_push (GstPad * pad, gboolean active)
1.531 -{
1.532 - GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
1.533 -
1.534 - if (active) {
1.535 - GST_DEBUG_OBJECT (nuv, "activating push/chain function");
1.536 - } else {
1.537 - GST_DEBUG_OBJECT (nuv, "deactivating push/chain function");
1.538 - }
1.539 -
1.540 - gst_object_unref (nuv);
1.541 -
1.542 - return TRUE;
1.543 -}
1.544 -
1.545 static GstFlowReturn
1.546 gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf)
1.547 {
1.548 @@ -1058,10 +1036,6 @@
1.549
1.550 gst_adapter_push (nuv->adapter, buf);
1.551
1.552 - GST_DEBUG_OBJECT (nuv, "PUSH adapter %d", gst_adapter_available (nuv->adapter));
1.553 -
1.554 - gst_object_unref (nuv);
1.555 -
1.556 return gst_nuv_demux_play (pad);
1.557 }
1.558
1.559 @@ -1116,7 +1090,7 @@
1.560 gst_nuv_demux_change_state (GstElement * element, GstStateChange transition)
1.561 {
1.562 GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
1.563 -
1.564 +
1.565 switch (transition) {
1.566 case GST_STATE_CHANGE_READY_TO_PAUSED:
1.567 break;
1.568 @@ -1146,6 +1120,7 @@
1.569 {
1.570 #ifdef ENABLE_NLS
1.571 setlocale (LC_ALL, "");
1.572 + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
1.573 #endif /* ENABLE_NLS */
1.574
1.575 if (!gst_element_register (plugin, "nuvdemux", GST_RANK_SECONDARY,
2.1 --- a/gst-plugins-nuvdemux/src/gstnuvdemux.h Tue Nov 07 23:11:23 2006 +0000
2.2 +++ b/gst-plugins-nuvdemux/src/gstnuvdemux.h Thu Nov 09 15:20:29 2006 +0000
2.3 @@ -38,6 +38,8 @@
2.4 #define GST_IS_NUV_DEMUX_CLASS(klass) \
2.5 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NUV_DEMUX))
2.6
2.7 +#define DEMUX_INDEX_SIZE_MAX (100000)
2.8 +
2.9 /* Indexes (timecodes/offsets) conversion structures */
2.10 typedef struct
2.11 {
2.12 @@ -51,7 +53,7 @@
2.13 gint i_idx;
2.14 gint i_idx_max;
2.15
2.16 - nuv_demux_index_entry *idx;
2.17 + nuv_demux_index_entry idx[DEMUX_INDEX_SIZE_MAX];
2.18 } nuv_demux_index;
2.19
2.20 /* */
2.21 @@ -107,7 +109,7 @@
2.22 0x02: gauss 5 pixel (8,1,1,1,1)/12
2.23 0x04: cartoon filter */
2.24
2.25 - gint i_timecode; /* ms */
2.26 + gint32 i_timecode; /* ms */
2.27
2.28 gint i_length; /* V,A,T: length of following data
2.29 S: length of packet correl */