mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
dtmfsrc: Reply to latency query
This commit is contained in:
parent
7cc59fcdf6
commit
dad751644e
2 changed files with 58 additions and 0 deletions
|
@ -234,6 +234,7 @@ static gboolean gst_dtmf_src_unlock (GstBaseSrc * src);
|
|||
|
||||
static gboolean gst_dtmf_src_unlock_stop (GstBaseSrc * src);
|
||||
static gboolean gst_dtmf_src_negotiate (GstBaseSrc * basesrc);
|
||||
static gboolean gst_dtmf_src_query (GstBaseSrc * basesrc, GstQuery * query);
|
||||
|
||||
|
||||
static void
|
||||
|
@ -277,6 +278,7 @@ gst_dtmf_src_class_init (GstDTMFSrcClass * klass)
|
|||
gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_dtmf_src_handle_event);
|
||||
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_dtmf_src_create);
|
||||
gstbasesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_dtmf_src_negotiate);
|
||||
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_dtmf_src_query);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -894,6 +896,33 @@ gst_dtmf_src_negotiate (GstBaseSrc * basesrc)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_dtmf_src_query (GstBaseSrc * basesrc, GstQuery * query)
|
||||
{
|
||||
GstDTMFSrc *dtmfsrc = GST_DTMF_SRC (basesrc);
|
||||
gboolean res = FALSE;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_LATENCY:
|
||||
{
|
||||
GstClockTime latency;
|
||||
|
||||
latency = dtmfsrc->interval * GST_MSECOND;
|
||||
gst_query_set_latency (query, gst_base_src_is_live (basesrc), latency,
|
||||
GST_CLOCK_TIME_NONE);
|
||||
GST_DEBUG_OBJECT (dtmfsrc, "Reporting latency of %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (latency));
|
||||
res = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
res = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_dtmf_src_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
|
|
|
@ -196,6 +196,7 @@ static gboolean gst_rtp_dtmf_src_unlock_stop (GstBaseSrc * src);
|
|||
static GstFlowReturn gst_rtp_dtmf_src_create (GstBaseSrc * basesrc,
|
||||
guint64 offset, guint length, GstBuffer ** buffer);
|
||||
static gboolean gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc);
|
||||
static gboolean gst_rtp_dtmf_src_query (GstBaseSrc * basesrc, GstQuery * query);
|
||||
|
||||
|
||||
static void
|
||||
|
@ -274,6 +275,7 @@ gst_rtp_dtmf_src_class_init (GstRTPDTMFSrcClass * klass)
|
|||
gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_handle_event);
|
||||
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_create);
|
||||
gstbasesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_negotiate);
|
||||
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_query);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1023,6 +1025,33 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc)
|
|||
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_rtp_dtmf_src_query (GstBaseSrc * basesrc, GstQuery * query)
|
||||
{
|
||||
GstRTPDTMFSrc *dtmfsrc = GST_RTP_DTMF_SRC (basesrc);
|
||||
gboolean res = FALSE;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_LATENCY:
|
||||
{
|
||||
GstClockTime latency;
|
||||
|
||||
latency = dtmfsrc->ptime * GST_MSECOND;
|
||||
gst_query_set_latency (query, gst_base_src_is_live (basesrc), latency,
|
||||
GST_CLOCK_TIME_NONE);
|
||||
GST_DEBUG_OBJECT (dtmfsrc, "Reporting latency of %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (latency));
|
||||
res = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
res = GST_BASE_SRC_CLASS (gst_rtp_dtmf_src_parent_class)->query (basesrc,
|
||||
query);
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_dtmf_src_ready_to_paused (GstRTPDTMFSrc * dtmfsrc)
|
||||
|
|
Loading…
Reference in a new issue