summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorEdgard Lima <edgard.lima@indt.org.br>2005-10-27 19:36:18 +0000
committerEdgard Lima <edgard.lima@indt.org.br>2005-10-27 19:36:18 +0000
commit76c4048ca8ba6a9723beda083ef1beeb42d1d8e4 (patch)
treef30331cdf9982a3c18f2ae6f5903a46e270129b1 /ext
parent9faf9154f14db8033ff366f8268a45b2592d2678 (diff)
downloadgst-plugins-bad-76c4048ca8ba6a9723beda083ef1beeb42d1d8e4.tar.gz
gst-plugins-bad-76c4048ca8ba6a9723beda083ef1beeb42d1d8e4.tar.bz2
gst-plugins-bad-76c4048ca8ba6a9723beda083ef1beeb42d1d8e4.zip
Trying to fix videos out of sync (not fixed yet)
Original commit message from CVS: Trying to fix videos out of sync (not fixed yet)
Diffstat (limited to 'ext')
-rw-r--r--ext/sdl/sdlvideosink.c39
-rw-r--r--ext/sdl/sdlvideosink.h2
2 files changed, 39 insertions, 2 deletions
diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c
index cdf560b8..d92fed8d 100644
--- a/ext/sdl/sdlvideosink.c
+++ b/ext/sdl/sdlvideosink.c
@@ -162,6 +162,30 @@ gst_sdlvideosink_finalize (GObject * obj)
}
static void
+gst_sdlvideosink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
+ GstClockTime * start, GstClockTime * end)
+{
+ GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (basesink);
+ GstClockTime timestamp, duration;
+
+ timestamp = GST_BUFFER_TIMESTAMP (buffer);
+ if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
+
+ *start = timestamp;
+ duration = GST_BUFFER_DURATION (buffer);
+ if (GST_CLOCK_TIME_IS_VALID (duration)) {
+ *end = timestamp + duration;
+ } else {
+ if (sdlvideosink->framerate > 0) {
+ *end = timestamp + GST_SECOND / sdlvideosink->framerate;
+ }
+ }
+
+ }
+
+}
+
+static void
gst_sdlvideosink_class_init (GstSDLVideoSinkClass * klass)
{
GObjectClass *gobject_class;
@@ -183,6 +207,7 @@ gst_sdlvideosink_class_init (GstSDLVideoSinkClass * klass)
GST_DEBUG_FUNCPTR (gst_sdlvideosink_change_state);
gstvs_class->set_caps = GST_DEBUG_FUNCPTR (gst_sdlvideosink_setcaps);
+ gstvs_class->get_times = GST_DEBUG_FUNCPTR (gst_sdlvideosink_get_times);
gstvs_class->preroll = GST_DEBUG_FUNCPTR (gst_sdlvideosink_show_frame);
gstvs_class->render = GST_DEBUG_FUNCPTR (gst_sdlvideosink_show_frame);
@@ -256,6 +281,7 @@ gst_sdlvideosink_init (GstSDLVideoSink * sdlvideosink)
sdlvideosink->width = -1;
sdlvideosink->height = -1;
+ sdlvideosink->framerate = 0;
sdlvideosink->overlay = NULL;
sdlvideosink->screen = NULL;
@@ -543,6 +569,7 @@ gst_sdlvideosink_setcaps (GstBaseSink * bsink, GstCaps * vscapslist)
gst_sdlvideosink_get_sdl_from_fourcc (sdlvideosink, format);
gst_structure_get_int (structure, "width", &sdlvideosink->width);
gst_structure_get_int (structure, "height", &sdlvideosink->height);
+ gst_structure_get_double (structure, "framerate", &sdlvideosink->framerate);
if (!sdlvideosink->format || !gst_sdlvideosink_create (sdlvideosink))
return FALSE;
@@ -652,6 +679,7 @@ static GstStateChangeReturn
gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition)
{
GstSDLVideoSink *sdlvideosink;
+ GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
g_return_val_if_fail (GST_IS_SDLVIDEOSINK (element),
GST_STATE_CHANGE_FAILURE);
@@ -663,7 +691,16 @@ gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition)
return GST_STATE_CHANGE_FAILURE;
GST_OBJECT_FLAG_SET (sdlvideosink, GST_SDLVIDEOSINK_OPEN);
break;
+ default: /* do nothing */
+ break;
+ }
+
+ if (GST_ELEMENT_CLASS (parent_class)->change_state)
+ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+ switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
+ sdlvideosink->framerate = 0;
gst_sdlvideosink_destroy (sdlvideosink);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
@@ -674,8 +711,6 @@ gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition)
break;
}
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_STATE_CHANGE_SUCCESS;
}
diff --git a/ext/sdl/sdlvideosink.h b/ext/sdl/sdlvideosink.h
index 3dc29236..eaf0e9ee 100644
--- a/ext/sdl/sdlvideosink.h
+++ b/ext/sdl/sdlvideosink.h
@@ -52,6 +52,8 @@ struct _GstSDLVideoSink {
guint32 format;
gint width, height; /* the size of the incoming YUV stream */
unsigned long xwindow_id;
+
+ gdouble framerate;
gboolean init;