summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 83dc0e3)
raw | patch | inline | side by side (parent: 83dc0e3)
author | Alessandro Decina <alessandro.decina@collabora.co.uk> | |
Thu, 22 Mar 2012 14:32:38 +0000 (15:32 +0100) | ||
committer | Alessandro Decina <alessandro.decina@collabora.co.uk> | |
Thu, 22 Mar 2012 15:19:22 +0000 (16:19 +0100) |
src/gstducatih264dec.c | patch | blob | history | |
src/gstducatividdec.c | patch | blob | history | |
src/gstducatividdec.h | patch | blob | history |
diff --git a/src/gstducatih264dec.c b/src/gstducatih264dec.c
index d0b071694fadea927423e2a5156b73b03cc7e155..fedb46fe6bd93a66ef5cff2d44a53a66107e8650 100644 (file)
--- a/src/gstducatih264dec.c
+++ b/src/gstducatih264dec.c
return ret;
}
+static gboolean
+gst_ducati_h264dec_query (GstDucatiVidDec * vdec, GstPad * pad,
+ GstQuery * query, gboolean * forward)
+{
+ GstDucatiH264Dec * self = GST_DUCATIH264DEC (vdec);
+ gboolean res = TRUE;
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_LATENCY:
+ {
+ gboolean live;
+ GstClockTime min, max, latency;
+
+ if (vdec->fps_d == 0) {
+ GST_INFO_OBJECT (self, "not ready to report latency");
+ res = FALSE;
+ break;
+ }
+
+ gst_query_parse_latency (query, &live, &min, &max);
+ if (vdec->fps_n != 0)
+ latency = gst_util_uint64_scale (GST_SECOND,
+ vdec->fps_d, vdec->fps_n);
+ else
+ latency = 0;
+
+ if (min == GST_CLOCK_TIME_NONE)
+ min = latency;
+ else
+ min += latency;
+
+ if (max != GST_CLOCK_TIME_NONE)
+ max += latency;
+
+ GST_INFO_OBJECT (self, "latency %"GST_TIME_FORMAT " ours %"GST_TIME_FORMAT,
+ GST_TIME_ARGS (min), GST_TIME_ARGS (latency));
+ gst_query_set_latency (query, live, min, max);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (res)
+ res = parent_class->query (vdec, pad, query, forward);
+
+ return res;
+}
+
static gboolean
gst_ducati_h264dec_drop_frame (GstDucatiVidDec * self, GstBuffer * buf,
gint64 diff)
GST_DEBUG_FUNCPTR (gst_ducati_h264dec_allocate_params);
bclass->handle_error = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_handle_error);
bclass->drop_frame = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_drop_frame);
+ bclass->query = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_query);
}
static void
diff --git a/src/gstducatividdec.c b/src/gstducatividdec.c
index 0ea500570e16104fc176646a55dd75bbbbd070f2..ebef4f256f13417926752447d914b13ddcd5494d 100644 (file)
--- a/src/gstducatividdec.c
+++ b/src/gstducatividdec.c
}
static gboolean
-gst_ducati_viddec_query (GstPad * pad, GstQuery * query)
+gst_ducati_viddec_query (GstDucatiVidDec * self, GstPad * pad,
+ GstQuery * query, gboolean * forward)
{
- gboolean res = TRUE, forward = TRUE;
- GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
-
- GST_DEBUG_OBJECT (self, "query: %" GST_PTR_FORMAT, query);
+ gboolean res = TRUE;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_BUFFERS:
self->padded_width, self->padded_height);
gst_query_set_buffers_dimensions (query,
self->padded_width, self->padded_height);
- forward = FALSE;
+ *forward = FALSE;
break;
default:
break;
}
- if (forward)
+
+ return res;
+}
+
+static gboolean
+gst_ducati_viddec_src_query (GstPad * pad, GstQuery * query)
+{
+ gboolean res = TRUE, forward = TRUE;
+ GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
+ GstDucatiVidDecClass *klass = GST_DUCATIVIDDEC_GET_CLASS (self);
+
+ GST_DEBUG_OBJECT (self, "query: %" GST_PTR_FORMAT, query);
+ res = klass->query(self, pad, query, &forward);
+ if (res && forward)
res = gst_pad_query_default (pad, query);
return res;
klass->push_input = GST_DEBUG_FUNCPTR (gst_ducati_viddec_push_input);
klass->handle_error = GST_DEBUG_FUNCPTR (gst_ducati_viddec_handle_error);
klass->drop_frame = GST_DEBUG_FUNCPTR (gst_ducati_viddec_drop_frame);
+ klass->query = GST_DEBUG_FUNCPTR (gst_ducati_viddec_query);
g_object_class_install_property (gobject_class, PROP_VERSION,
g_param_spec_string ("version", "Version",
gst_pad_set_event_function (self->srcpad,
GST_DEBUG_FUNCPTR (gst_ducati_viddec_src_event));
gst_pad_set_query_function (self->srcpad,
- GST_DEBUG_FUNCPTR (gst_ducati_viddec_query));
+ GST_DEBUG_FUNCPTR (gst_ducati_viddec_src_query));
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
diff --git a/src/gstducatividdec.h b/src/gstducatividdec.h
index d744c5f0e17e904cea84233f15160de52e9253cd..5b64b20d8b04b5292262923dacf9515e85f39425 100644 (file)
--- a/src/gstducatividdec.h
+++ b/src/gstducatividdec.h
* Called to check whether it's a good idea to drop buf or not.
*/
gboolean (*drop_frame) (GstDucatiVidDec * self, GstBuffer * buf, gint64 diff);
+
+ gboolean (*query) (GstDucatiVidDec * self, GstPad * pad, GstQuery * query,
+ gboolean * forward);
};
GType gst_ducati_viddec_get_type (void);