~ubuntu-branches/ubuntu/raring/gst-plugins-good0.10/raring-proposed

« back to all changes in this revision

Viewing changes to farsight/rtpmux/gstrtpmux.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-02-09 16:44:53 UTC
  • mfrom: (40.2.38 experimental)
  • Revision ID: package-import@ubuntu.com-20120209164453-6hjokwrvdn42zopb
Tags: 0.10.30.3-1ubuntu1
* Merge from Debian experimental, remaining changes:
  - 04_move_farsight_plugins_to_good.patch
    Import autoconvert, dtmf, liveadder, rptmux from -plugins-bad
  - 05_move_shm_to_good.patch
    Import shm from -plugins-bad.
  - 07_move-camerabin.patch
    Import camerabin, camerabin2, jpegformat and basecamerabinsrc
    from -plugins-bad.
  - control*:
    * Drop dependency from gstreamer0.10-plugins-good on
      gstreamer0.10-gconf. It pulls gconf and gtk3 onto the Kubuntu cd.
    * Use Breaks instead of Conflicts.
    * Add a 'Pre-Depends: ${misc:Pre-Depends}' to the plugin package,
      since we're shipping shared libraries in the package that Debian
      isn't.
* Update the patches by pulling new version of the code from
  -plugins-bad 0.10.22.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
    GValue * value, GParamSpec * pspec);
108
108
static void gst_rtp_mux_dispose (GObject * object);
109
109
 
 
110
static gboolean gst_rtp_mux_src_event_real (GstRTPMux *rtp_mux,
 
111
    GstEvent * event);
 
112
 
110
113
GST_BOILERPLATE (GstRTPMux, gst_rtp_mux, GstElement, GST_TYPE_ELEMENT);
111
114
 
112
115
static void
114
117
{
115
118
  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
116
119
 
117
 
  gst_element_class_add_pad_template (element_class,
118
 
      gst_static_pad_template_get (&src_factory));
119
 
  gst_element_class_add_pad_template (element_class,
120
 
      gst_static_pad_template_get (&sink_factory));
 
120
  gst_element_class_add_static_pad_template (element_class, &src_factory);
 
121
  gst_element_class_add_static_pad_template (element_class, &sink_factory);
121
122
 
122
123
  gst_element_class_set_details_simple (element_class, "RTP muxer",
123
124
      "Codec/Muxer",
137
138
  gobject_class->set_property = gst_rtp_mux_set_property;
138
139
  gobject_class->dispose = gst_rtp_mux_dispose;
139
140
 
 
141
  klass->src_event = gst_rtp_mux_src_event_real;
 
142
 
140
143
  g_object_class_install_property (G_OBJECT_CLASS (klass),
141
144
      PROP_TIMESTAMP_OFFSET, g_param_spec_int ("timestamp-offset",
142
145
          "Timestamp Offset",
183
186
static gboolean
184
187
gst_rtp_mux_src_event (GstPad * pad, GstEvent * event)
185
188
{
186
 
  GstElement *rtp_mux;
 
189
  GstRTPMux *rtp_mux;
 
190
  GstRTPMuxClass *klass;
 
191
  gboolean ret = FALSE;
 
192
 
 
193
  rtp_mux = (GstRTPMux *) gst_pad_get_parent_element (pad);
 
194
  g_return_val_if_fail (rtp_mux != NULL, FALSE);
 
195
  klass = GST_RTP_MUX_GET_CLASS (rtp_mux);
 
196
 
 
197
  ret = klass->src_event (rtp_mux, event);
 
198
 
 
199
  gst_object_unref (rtp_mux);
 
200
 
 
201
  return ret;
 
202
}
 
203
 
 
204
static gboolean
 
205
gst_rtp_mux_src_event_real (GstRTPMux *rtp_mux, GstEvent * event)
 
206
{
187
207
  GstIterator *iter;
188
208
  GstPad *sinkpad;
189
209
  gboolean result = FALSE;
190
210
  gboolean done = FALSE;
191
211
 
192
 
  rtp_mux = gst_pad_get_parent_element (pad);
193
 
  g_return_val_if_fail (rtp_mux != NULL, FALSE);
194
 
 
195
 
  iter = gst_element_iterate_sink_pads (rtp_mux);
 
212
  iter = gst_element_iterate_sink_pads (GST_ELEMENT (rtp_mux));
196
213
 
197
214
  while (!done) {
198
215
    switch (gst_iterator_next (iter, (gpointer) & sinkpad)) {
213
230
    }
214
231
  }
215
232
  gst_iterator_free (iter);
216
 
  gst_object_unref (rtp_mux);
217
233
  gst_event_unref (event);
218
234
 
219
235
  return result;
236
252
  object->seqnum_offset = DEFAULT_SEQNUM_OFFSET;
237
253
 
238
254
  object->segment_pending = TRUE;
 
255
  object->last_stop = GST_CLOCK_TIME_NONE;
239
256
}
240
257
 
241
258
static void
394
411
      break;
395
412
 
396
413
    gst_buffer_list_iterator_take (it, rtpbuf);
 
414
 
 
415
    do {
 
416
      if (GST_BUFFER_DURATION_IS_VALID (rtpbuf) &&
 
417
          GST_BUFFER_TIMESTAMP_IS_VALID (rtpbuf))
 
418
        rtp_mux->last_stop = GST_BUFFER_TIMESTAMP (rtpbuf) +
 
419
            GST_BUFFER_DURATION (rtpbuf);
 
420
      else
 
421
        rtp_mux->last_stop = GST_CLOCK_TIME_NONE;
 
422
 
 
423
      gst_buffer_list_iterator_take (it, rtpbuf);
 
424
 
 
425
    } while ((rtpbuf = gst_buffer_list_iterator_next (it)) != NULL);
 
426
 
 
427
 
397
428
  }
398
429
  gst_buffer_list_iterator_free (it);
399
430
 
456
487
 
457
488
  drop = !process_buffer_locked (rtp_mux, padpriv, buffer);
458
489
 
459
 
  if (!drop && rtp_mux->segment_pending) {
460
 
    /*
461
 
     * We set the start at 0, because we re-timestamps to the running time
462
 
     */
463
 
    newseg_event = gst_event_new_new_segment_full (FALSE, 1.0, 1.0,
464
 
        GST_FORMAT_TIME, 0, -1, 0);
465
 
 
466
 
    rtp_mux->segment_pending = FALSE;
 
490
  if (!drop) {
 
491
    if (rtp_mux->segment_pending) {
 
492
      /*
 
493
       * We set the start at 0, because we re-timestamps to the running time
 
494
       */
 
495
      newseg_event = gst_event_new_new_segment_full (FALSE, 1.0, 1.0,
 
496
          GST_FORMAT_TIME, 0, -1, 0);
 
497
 
 
498
      rtp_mux->segment_pending = FALSE;
 
499
    }
 
500
 
 
501
    if (GST_BUFFER_DURATION_IS_VALID (buffer) &&
 
502
        GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
 
503
      rtp_mux->last_stop = GST_BUFFER_TIMESTAMP (buffer) +
 
504
          GST_BUFFER_DURATION (buffer);
 
505
    else
 
506
      rtp_mux->last_stop = GST_CLOCK_TIME_NONE;
467
507
  }
 
508
 
468
509
  GST_OBJECT_UNLOCK (rtp_mux);
469
510
 
470
511
  if (newseg_event)
709
750
      GstRTPMuxPadPrivate *padpriv;
710
751
 
711
752
      GST_OBJECT_LOCK (mux);
 
753
      mux->last_stop = GST_CLOCK_TIME_NONE;
712
754
      mux->segment_pending = TRUE;
713
755
      padpriv = gst_pad_get_element_private (pad);
714
756
      if (padpriv)
801
843
  else
802
844
    rtp_mux->ts_base = rtp_mux->ts_offset;
803
845
 
 
846
  rtp_mux->last_stop = GST_CLOCK_TIME_NONE;
 
847
 
804
848
  GST_DEBUG_OBJECT (rtp_mux, "set clock-base to %u", rtp_mux->ts_base);
805
849
 
806
850
  GST_OBJECT_UNLOCK (rtp_mux);