summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2007-04-12 20:04:35 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:47:58 +0100
commit516f1cb7270aef1ffad91abadf9d45682633650c (patch)
treee77afde2a394d9b048a54ce79f224048439a4347
parent50dbdcc4e143a50e278fb634592cf01670bfa449 (diff)
downloadgst-plugins-bad-516f1cb7270aef1ffad91abadf9d45682633650c.tar.gz
gst-plugins-bad-516f1cb7270aef1ffad91abadf9d45682633650c.tar.bz2
gst-plugins-bad-516f1cb7270aef1ffad91abadf9d45682633650c.zip
[MOVED FROM GST-P-FARSIGHT] Use segment to calculate dtmfsrc rtp timestamp
20070412200435-3e2dc-b5cc26b12b6e8b89f131fd27f0e4627746e85697.gz
-rw-r--r--gst/rtpdtmf/gstrtpdtmfsrc.c23
-rw-r--r--gst/rtpdtmf/gstrtpdtmfsrc.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/gst/rtpdtmf/gstrtpdtmfsrc.c b/gst/rtpdtmf/gstrtpdtmfsrc.c
index cecacb9b..a748c5cb 100644
--- a/gst/rtpdtmf/gstrtpdtmfsrc.c
+++ b/gst/rtpdtmf/gstrtpdtmfsrc.c
@@ -391,6 +391,22 @@ gst_rtp_dtmf_src_handle_event (GstPad * pad, GstEvent * event)
gst_rtp_dtmf_src_stop (dtmfsrc);
result = TRUE;
break;
+ case GST_EVENT_FLUSH_STOP:
+ gst_segment_init (&dtmfsrc->segment, GST_FORMAT_UNDEFINED);
+ break;
+ case GST_EVENT_NEWSEGMENT:
+ {
+ gboolean update;
+ gdouble rate;
+ GstFormat fmt;
+ gint64 start, stop, position;
+
+ gst_event_parse_new_segment (event, &update, &rate, &fmt, &start, &stop,
+ &position);
+ gst_segment_set_newsegment (&dtmfsrc->segment, update, rate, fmt,
+ start, stop, position);
+ }
+ /* fallthrough */
default:
result = gst_pad_event_default (pad, event);
break;
@@ -497,8 +513,9 @@ gst_rtp_dtmf_prepare_timestamps (GstRTPDTMFSrc *dtmfsrc)
dtmfsrc->rtp_timestamp = dtmfsrc->ts_base +
gst_util_uint64_scale_int (
- dtmfsrc->timestamp - gst_element_get_base_time (GST_ELEMENT (dtmfsrc)),
- dtmfsrc->clock_rate, GST_SECOND);
+ gst_segment_to_running_time (&dtmfsrc->segment, GST_FORMAT_TIME,
+ dtmfsrc->timestamp - gst_element_get_base_time (GST_ELEMENT (dtmfsrc))),
+ dtmfsrc->clock_rate, GST_SECOND);
}
static void
@@ -676,6 +693,8 @@ gst_rtp_dtmf_src_set_caps (GstRTPDTMFSrc *dtmfsrc)
static void
gst_rtp_dtmf_src_ready_to_paused (GstRTPDTMFSrc *dtmfsrc)
{
+ gst_segment_init (&dtmfsrc->segment, GST_FORMAT_UNDEFINED);
+
if (dtmfsrc->ssrc == -1)
dtmfsrc->current_ssrc = g_random_int ();
else
diff --git a/gst/rtpdtmf/gstrtpdtmfsrc.h b/gst/rtpdtmf/gstrtpdtmfsrc.h
index 204492cf..6d012f42 100644
--- a/gst/rtpdtmf/gstrtpdtmfsrc.h
+++ b/gst/rtpdtmf/gstrtpdtmfsrc.h
@@ -83,6 +83,7 @@ struct _GstRTPDTMFSrc {
gboolean first_packet;
GstClockTime timestamp;
+ GstSegment segment;
};
struct _GstRTPDTMFSrcClass {