#include "mpegtsparse.h"
+/* latency in mseconds */
+#define TS_LATENCY 700
+
GST_DEBUG_CATEGORY_STATIC (mpegts_parse_debug);
#define GST_CAT_DEFAULT mpegts_parse_debug
static gboolean mpegts_parse_sink_event (GstPad * pad, GstEvent * event);
static GstStateChangeReturn mpegts_parse_change_state (GstElement * element,
GstStateChange transition);
+static gboolean mpegts_parse_src_pad_query (GstPad * pad, GstQuery * query);
GST_BOILERPLATE (MpegTSParse, mpegts_parse, GstElement, GST_TYPE_ELEMENT);
MpegTSParsePad *tspad;
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 */
tspad = g_new0 (MpegTSParsePad, 1);
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
plugin_init (GstPlugin * plugin)
{