mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
gst/mpegtsparse/mpegtsparse.c: Handle latency queries in src pads.
Original commit message from CVS: * gst/mpegtsparse/mpegtsparse.c: Handle latency queries in src pads.
This commit is contained in:
parent
ed4368e08f
commit
9d8a7aa18f
2 changed files with 43 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-02-05 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
||||||
|
|
||||||
|
* gst/mpegtsparse/mpegtsparse.c:
|
||||||
|
Handle latency queries in src pads.
|
||||||
|
|
||||||
2008-02-05 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
2008-02-05 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
||||||
|
|
||||||
* gst/mpegtsparse/mpegtspacketizer.c:
|
* gst/mpegtsparse/mpegtspacketizer.c:
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
|
|
||||||
#include "mpegtsparse.h"
|
#include "mpegtsparse.h"
|
||||||
|
|
||||||
|
/* latency in mseconds */
|
||||||
|
#define TS_LATENCY 700
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (mpegts_parse_debug);
|
GST_DEBUG_CATEGORY_STATIC (mpegts_parse_debug);
|
||||||
#define GST_CAT_DEFAULT mpegts_parse_debug
|
#define GST_CAT_DEFAULT mpegts_parse_debug
|
||||||
|
|
||||||
|
@ -125,6 +128,7 @@ static GstFlowReturn mpegts_parse_chain (GstPad * pad, GstBuffer * buf);
|
||||||
static gboolean mpegts_parse_sink_event (GstPad * pad, GstEvent * event);
|
static gboolean mpegts_parse_sink_event (GstPad * pad, GstEvent * event);
|
||||||
static GstStateChangeReturn mpegts_parse_change_state (GstElement * element,
|
static GstStateChangeReturn mpegts_parse_change_state (GstElement * element,
|
||||||
GstStateChange transition);
|
GstStateChange transition);
|
||||||
|
static gboolean mpegts_parse_src_pad_query (GstPad * pad, GstQuery * query);
|
||||||
|
|
||||||
GST_BOILERPLATE (MpegTSParse, mpegts_parse, GstElement, GST_TYPE_ELEMENT);
|
GST_BOILERPLATE (MpegTSParse, mpegts_parse, GstElement, GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
|
@ -553,6 +557,8 @@ mpegts_parse_create_tspad (MpegTSParse * parse, const gchar * pad_name)
|
||||||
MpegTSParsePad *tspad;
|
MpegTSParsePad *tspad;
|
||||||
|
|
||||||
pad = gst_pad_new_from_static_template (&program_template, pad_name);
|
pad = gst_pad_new_from_static_template (&program_template, pad_name);
|
||||||
|
gst_pad_set_query_function (pad,
|
||||||
|
GST_DEBUG_FUNCPTR (mpegts_parse_src_pad_query));
|
||||||
|
|
||||||
/* create our wrapper */
|
/* create our wrapper */
|
||||||
tspad = g_new0 (MpegTSParsePad, 1);
|
tspad = g_new0 (MpegTSParsePad, 1);
|
||||||
|
@ -1156,6 +1162,38 @@ mpegts_parse_change_state (GstElement * element, GstStateChange transition)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
mpegts_parse_src_pad_query (GstPad * pad, GstQuery * query)
|
||||||
|
{
|
||||||
|
MpegTSParse *parse = GST_MPEGTS_PARSE (gst_pad_get_parent (pad));
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
case GST_QUERY_LATENCY:
|
||||||
|
{
|
||||||
|
if ((res = gst_pad_peer_query (parse->sinkpad, query))) {
|
||||||
|
gboolean is_live;
|
||||||
|
GstClockTime min_latency, max_latency;
|
||||||
|
|
||||||
|
gst_query_parse_latency (query, &is_live, &min_latency, &max_latency);
|
||||||
|
if (is_live) {
|
||||||
|
min_latency += TS_LATENCY * GST_MSECOND;
|
||||||
|
if (max_latency != GST_CLOCK_TIME_NONE)
|
||||||
|
max_latency += TS_LATENCY * GST_MSECOND;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_query_set_latency (query, is_live, min_latency, max_latency);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
res = gst_pad_query_default (pad, query);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue