summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8152900)
raw | patch | inline | side by side (parent: 8152900)
author | Alessandro Decina <alessandro.decina@collabora.co.uk> | |
Tue, 31 Jan 2012 11:59:06 +0000 (12:59 +0100) | ||
committer | Alessandro Decina <alessandro.decina@collabora.co.uk> | |
Tue, 31 Jan 2012 11:59:06 +0000 (12:59 +0100) |
src/gstducatividdec.c | patch | blob | history | |
src/gstducatividdec.h | patch | blob | history |
diff --git a/src/gstducatividdec.c b/src/gstducatividdec.c
index e93a092ae91b0bd530aff2940fa420008867be3e..cde050c15b36cd1f93dd3ef41270575d262ca1d7 100644 (file)
--- a/src/gstducatividdec.c
+++ b/src/gstducatividdec.c
gst_ducati_viddec_do_qos (GstDucatiVidDec * self, GstBuffer * buf)
{
GstClockTime timestamp, qostime;
+ GstDucatiVidDecClass *klass = GST_DUCATIVIDDEC_GET_CLASS (self);
gint64 diff;
- gboolean is_keyframe;
timestamp = GST_BUFFER_TIMESTAMP (buf);
if (self->segment.format != GST_FORMAT_TIME ||
/* out of segment */
goto no_qos;
- is_keyframe = !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
-
/* see how our next timestamp relates to the latest qos timestamp. negative
* values mean we are early, positive values mean we are too late. */
diff = GST_CLOCK_DIFF (qostime, self->qos_earliest_time);
GST_TIME_ARGS (qostime), GST_TIME_ARGS (self->qos_earliest_time), diff,
self->qos_proportion);
- if (diff >= 0 && !is_keyframe)
+ if (klass->drop_frame (self, buf, diff)) {
+ GST_INFO_OBJECT (self, "dropping frame");
return FALSE;
+ }
no_qos:
return TRUE;
}
+static gboolean
+gst_ducati_viddec_drop_frame (GstDucatiVidDec * self, GstBuffer * buf,
+ gint64 diff)
+{
+ gboolean is_keyframe = !GST_BUFFER_FLAG_IS_SET (buf,
+ GST_BUFFER_FLAG_DELTA_UNIT);
+
+ if (diff >= 0 && !is_keyframe)
+ return TRUE;
+
+ return FALSE;
+}
+
static GstFlowReturn
gst_ducati_viddec_chain (GstPad * pad, GstBuffer * buf)
{
return GST_FLOW_ERROR;
}
- GST_DEBUG_OBJECT (self, "chain: %" GST_TIME_FORMAT " (%d bytes)",
- GST_TIME_ARGS (ts), GST_BUFFER_SIZE (buf));
+ GST_DEBUG_OBJECT (self, "chain: %" GST_TIME_FORMAT " (%d bytes, flags %d)",
+ GST_TIME_ARGS (ts), GST_BUFFER_SIZE (buf), GST_BUFFER_FLAGS (buf));
decode = gst_ducati_viddec_do_qos (self, buf);
if (!decode) {
GST_DEBUG_FUNCPTR (gst_ducati_viddec_allocate_params);
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);
g_object_class_install_property (gobject_class, PROP_VERSION,
g_param_spec_string ("version", "Version",
diff --git a/src/gstducatividdec.h b/src/gstducatividdec.h
index 10365e7e90d9802421821a8826837c1654d07eab..f9daabe8afcce9657fee77d8a34e4707986339c4 100644 (file)
--- a/src/gstducatividdec.h
+++ b/src/gstducatividdec.h
*/
gint (*handle_error) (GstDucatiVidDec * self, gint ret, gint extended_error,
gint status_extended_error);
+
+ /**
+ * Called to check whether it's a good idea to drop buf or not.
+ */
+ gboolean (*drop_frame) (GstDucatiVidDec * self, GstBuffer * buf, gint64 diff);
};
GType gst_ducati_viddec_get_type (void);