# HG changeset patch # User renatofilho # Date 1163450915 0 # Node ID 653adbffb418cce7f7f148a569a9dbb80e48a9b6 # Parent 56e39289fa966a9f9b574a0eee83282e0a7a818a [svn r83] create enum for pull and push mode diff -r 56e39289fa96 -r 653adbffb418 gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Mon Nov 13 19:58:37 2006 +0000 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Mon Nov 13 20:48:35 2006 +0000 @@ -60,6 +60,11 @@ #define GST_FLOW_ERROR_NO_DATA -101 +enum +{ + NUV_PUSH_MODE = 0, + NUV_PULL_MODE +}; GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT); @@ -442,7 +447,6 @@ return ret; } -//TODO: send a new segment event before the firts data static GstFlowReturn gst_nuv_demux_stream_data (GstNuvDemux * nuv) { @@ -477,14 +481,7 @@ GST_CLOCK_TIME_NONE, 0)); nuv->new_video_segment = FALSE; } - - GST_BUFFER_SIZE (buf) = h->i_length; - gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_video_pad)); - ret = gst_pad_push (nuv->src_video_pad, buf); - if (ret != GST_FLOW_OK) { - GST_WARNING_OBJECT (nuv, "error pushing on srcpad %s, is linked? = %d", - gst_pad_get_name (nuv->src_video_pad), gst_pad_is_linked (nuv->src_video_pad)); - } + res = gst_nuv_demux_push_dat (nuv, h->i_lengh, nuv->src_video_pad); break; } case 'A': @@ -764,8 +761,7 @@ if (nuv->src_audio_pad) gst_pad_push_event (nuv->src_audio_pad, gst_event_new_eos ()); } - -//TODO: try use "gst_pad_alloc_buffer" function + static GstFlowReturn gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size, gboolean move, GstBuffer ** buffer) @@ -777,7 +773,7 @@ return ret; } - if (nuv->mode == 0) { + if (nuv->mode == NUV_PULL_MODE) { ret = gst_pad_pull_range (nuv->sinkpad, nuv->offset, size, buffer); if (ret == GST_FLOW_OK) { if (move) { @@ -819,7 +815,7 @@ if (gst_pad_check_pull_range (sinkpad)) { res = gst_pad_activate_pull (sinkpad, TRUE); } else { - nuv->mode = 1; + nuv->mode = NUV_PUSH_MODE; if (nuv->adapter) { gst_adapter_clear (nuv->adapter); } else { @@ -837,7 +833,7 @@ GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad)); if (active) { - nuv->mode = 0; + nuv->mode = NUV_PULL_MODE; if (nuv->adapter) { gst_adapter_clear (nuv->adapter); g_object_unref (nuv->adapter);