Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-04-20 23:33:34 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-04-20 23:33:34 (GMT)
commit796a0fbffa9e320dd2304883377913d7686342b8 (patch)
tree453cf2c9b7daa697a4f1ad2dc6a632384f22ce95
parentf32dd01a984c05f34330dc2b57e923d775c77d97 (diff)
Apply #567928 patch for gstvideorate
-rw-r--r--gst/gstvideorate.c24
-rw-r--r--gst/gstvideorate.h1
2 files changed, 24 insertions, 1 deletions
diff --git a/gst/gstvideorate.c b/gst/gstvideorate.c
index 8d22186..8ba9ede 100644
--- a/gst/gstvideorate.c
+++ b/gst/gstvideorate.c
@@ -92,6 +92,7 @@ enum
#define DEFAULT_SILENT TRUE
#define DEFAULT_NEW_PREF 1.0
+#define DEFAULT_SKIP_TO_FIRST FALSE
enum
{
@@ -102,6 +103,7 @@ enum
ARG_DROP,
ARG_SILENT,
ARG_NEW_PREF,
+ ARG_SKIP_TO_FIRST
/* FILL ME */
};
@@ -182,6 +184,11 @@ gst_video_rate_class_init (GstVideoRateClass * klass)
g_param_spec_double ("new-pref", "New Pref",
"Value indicating how much to prefer new frames (unused)", 0.0, 1.0,
DEFAULT_NEW_PREF, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, ARG_SKIP_TO_FIRST,
+ g_param_spec_boolean ("skip-to-first", "Skip to first buffer",
+ "Don't produce buffers before the first one we receive",
+ DEFAULT_SKIP_TO_FIRST,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
element_class->change_state = gst_video_rate_change_state;
}
@@ -641,7 +648,16 @@ gst_video_rate_chain (GstPad * pad, GstBuffer * buffer)
if (!GST_CLOCK_TIME_IS_VALID (videorate->next_ts)) {
/* new buffer, we expect to output a buffer that matches the first
* timestamp in the segment */
- videorate->next_ts = videorate->segment.start + videorate->segment.accum;
+ if (videorate->skip_to_first) {
+ videorate->next_ts = in_ts;
+ videorate->segment_out = gst_util_uint64_scale (in_ts,
+ videorate->to_rate_numerator,
+ videorate->to_rate_denominator * GST_SECOND) -
+ (videorate->segment.accum + videorate->segment.start);
+ }
+ else {
+ videorate->next_ts = videorate->segment.start + videorate->segment.accum;
+ }
}
} else {
GstClockTime prevtime;
@@ -764,6 +780,9 @@ gst_video_rate_set_property (GObject * object,
case ARG_NEW_PREF:
videorate->new_pref = g_value_get_double (value);
break;
+ case ARG_SKIP_TO_FIRST:
+ videorate->skip_to_first = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -795,6 +814,9 @@ gst_video_rate_get_property (GObject * object,
case ARG_NEW_PREF:
g_value_set_double (value, videorate->new_pref);
break;
+ case ARG_SKIP_TO_FIRST:
+ g_value_set_boolean (value, videorate->skip_to_first);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/gst/gstvideorate.h b/gst/gstvideorate.h
index ea6063b..76e690d 100644
--- a/gst/gstvideorate.h
+++ b/gst/gstvideorate.h
@@ -64,6 +64,7 @@ struct _GstVideoRate
guint64 in, out, dup, drop;
gboolean silent;
gdouble new_pref;
+ gboolean skip_to_first;
};
struct _GstVideoRateClass