[svn r83] create enum for pull and push mode trunk
authorrenatofilho
Mon Nov 13 20:48:35 2006 +0000 (2006-11-13)
branchtrunk
changeset 82653adbffb418
parent 81 56e39289fa96
child 83 7550ece15943
[svn r83] create enum for pull and push mode
gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
     1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Nov 13 19:58:37 2006 +0000
     1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Nov 13 20:48:35 2006 +0000
     1.3 @@ -60,6 +60,11 @@
     1.4  
     1.5  
     1.6  #define GST_FLOW_ERROR_NO_DATA  -101
     1.7 +enum
     1.8 +{
     1.9 +   NUV_PUSH_MODE = 0,
    1.10 +   NUV_PULL_MODE
    1.11 +};
    1.12  
    1.13  GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT);
    1.14  
    1.15 @@ -442,7 +447,6 @@
    1.16    return ret;
    1.17  }
    1.18  
    1.19 -//TODO: send a new segment event before the firts data
    1.20  static GstFlowReturn
    1.21  gst_nuv_demux_stream_data (GstNuvDemux * nuv)
    1.22  {
    1.23 @@ -477,14 +481,7 @@
    1.24                                       GST_CLOCK_TIME_NONE, 0));
    1.25          nuv->new_video_segment = FALSE;
    1.26        }
    1.27 -     
    1.28 -      GST_BUFFER_SIZE (buf) = h->i_length;
    1.29 -      gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_video_pad));
    1.30 -      ret = gst_pad_push (nuv->src_video_pad, buf);
    1.31 -      if (ret != GST_FLOW_OK) {
    1.32 -        GST_WARNING_OBJECT (nuv, "error pushing on srcpad %s, is linked? = %d",
    1.33 -            gst_pad_get_name (nuv->src_video_pad), gst_pad_is_linked (nuv->src_video_pad));
    1.34 -      }
    1.35 +      res = gst_nuv_demux_push_dat (nuv, h->i_lengh, nuv->src_video_pad);
    1.36        break;
    1.37      }
    1.38      case 'A':
    1.39 @@ -764,8 +761,7 @@
    1.40    if (nuv->src_audio_pad)
    1.41      gst_pad_push_event (nuv->src_audio_pad, gst_event_new_eos ());
    1.42  }
    1.43 -
    1.44 -//TODO: try use "gst_pad_alloc_buffer" function
    1.45 +    
    1.46  static GstFlowReturn
    1.47  gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size, gboolean move,
    1.48      GstBuffer ** buffer)
    1.49 @@ -777,7 +773,7 @@
    1.50      return ret;
    1.51    }
    1.52    
    1.53 -  if (nuv->mode == 0) {
    1.54 +  if (nuv->mode == NUV_PULL_MODE) {
    1.55      ret = gst_pad_pull_range (nuv->sinkpad, nuv->offset, size, buffer);
    1.56      if (ret == GST_FLOW_OK) {
    1.57          if (move) {
    1.58 @@ -819,7 +815,7 @@
    1.59    if (gst_pad_check_pull_range (sinkpad)) {
    1.60      res = gst_pad_activate_pull (sinkpad, TRUE);
    1.61    } else {
    1.62 -    nuv->mode = 1;
    1.63 +    nuv->mode = NUV_PUSH_MODE;
    1.64      if (nuv->adapter) {
    1.65        gst_adapter_clear (nuv->adapter);
    1.66      } else {
    1.67 @@ -837,7 +833,7 @@
    1.68    GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
    1.69  
    1.70    if (active) {
    1.71 -    nuv->mode = 0;
    1.72 +    nuv->mode = NUV_PULL_MODE;
    1.73      if (nuv->adapter) {
    1.74        gst_adapter_clear (nuv->adapter);
    1.75        g_object_unref (nuv->adapter);