summaryrefslogtreecommitdiff
path: root/gst/interlace
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2012-01-10 15:50:37 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-01-10 15:50:37 +0100
commita01a4ea2d3e98c7ffcedf67d48a167e5dfdd1c07 (patch)
tree62de4d4a57689565d72c5c707f74db1a7d5a9108 /gst/interlace
parentc849631686baf0012ca89d9f64cc8665277cbcba (diff)
parent1f543ec0ada7849a25a6451679eeb3cd3f605c1f (diff)
Merge branch 'master' into 0.11
Conflicts: gst/mpegtsdemux/tsdemux.c gst/videoparsers/gsth264parse.c tests/check/elements/camerabin2.c
Diffstat (limited to 'gst/interlace')
-rw-r--r--gst/interlace/gstinterlace.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/gst/interlace/gstinterlace.c b/gst/interlace/gstinterlace.c
index c6181ecad..bc319b9bf 100644
--- a/gst/interlace/gstinterlace.c
+++ b/gst/interlace/gstinterlace.c
@@ -187,6 +187,7 @@ static gboolean gst_interlace_setcaps (GstPad * pad, GstCaps * caps);
static GstCaps *gst_interlace_getcaps (GstPad * pad);
static GstStateChangeReturn gst_interlace_change_state (GstElement * element,
GstStateChange transition);
+static void gst_interlace_finalize (GObject * obj);
static GstElementClass *parent_class = NULL;
@@ -242,6 +243,7 @@ gst_interlace_class_init (GstInterlaceClass * klass)
object_class->set_property = gst_interlace_set_property;
object_class->get_property = gst_interlace_get_property;
+ object_class->finalize = gst_interlace_finalize;
element_class->change_state = gst_interlace_change_state;
@@ -269,6 +271,16 @@ gst_interlace_class_init (GstInterlaceClass * klass)
}
static void
+gst_interlace_finalize (GObject * obj)
+{
+ GstInterlace *interlace = GST_INTERLACE (obj);
+
+ gst_caps_replace (&interlace->srccaps, NULL);
+
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
+static void
gst_interlace_reset (GstInterlace * interlace)
{
interlace->phase_index = interlace->pattern_offset;
@@ -328,13 +340,19 @@ gst_interlace_decorate_buffer (GstInterlace * interlace, GstBuffer * buf,
int n_fields)
{
/* field duration = src_fps_d / (2 * src_fps_n) */
- GST_BUFFER_TIMESTAMP (buf) = interlace->timebase +
- gst_util_uint64_scale (GST_SECOND,
- interlace->src_fps_d * interlace->fields_since_timebase,
- interlace->src_fps_n * 2);
- GST_BUFFER_DURATION (buf) =
- gst_util_uint64_scale (GST_SECOND, interlace->src_fps_d * n_fields,
- interlace->src_fps_n * 2);
+ if (interlace->src_fps_n == 0) {
+ /* If we don't know the fps, we can't generate timestamps/durations */
+ GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
+ } else {
+ GST_BUFFER_TIMESTAMP (buf) = interlace->timebase +
+ gst_util_uint64_scale (GST_SECOND,
+ interlace->src_fps_d * interlace->fields_since_timebase,
+ interlace->src_fps_n * 2);
+ GST_BUFFER_DURATION (buf) =
+ gst_util_uint64_scale (GST_SECOND, interlace->src_fps_d * n_fields,
+ interlace->src_fps_n * 2);
+ }
/* increment the buffer timestamp by duration for the next buffer */
gst_buffer_set_caps (buf, interlace->srccaps);
@@ -457,6 +475,8 @@ gst_interlace_getcaps (GstPad * pad)
gst_caps_set_simple (icaps, "interlaced", G_TYPE_BOOLEAN,
pad == interlace->srcpad ? TRUE : FALSE, NULL);
+ gst_object_unref (interlace);
+
return icaps;
}
@@ -470,7 +490,7 @@ gst_interlace_setcaps (GstPad * pad, GstCaps * caps)
gboolean interlaced = TRUE;
int fps_n, fps_d;
GstPad *otherpad;
- GstCaps *othercaps;
+ GstCaps *othercaps = NULL;
const PulldownFormat *pdformat;
interlace = GST_INTERLACE (gst_pad_get_parent (pad));
@@ -519,6 +539,8 @@ gst_interlace_setcaps (GstPad * pad, GstCaps * caps)
}
error:
+ if (othercaps)
+ gst_caps_unref (othercaps);
g_object_unref (interlace);
return ret;