summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ext/sdl/sdlvideosink.c39
-rw-r--r--ext/sdl/sdlvideosink.h2
3 files changed, 45 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 11f6f7f2..7695d683 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-27 Edgard Lima <edgard.lima@indt.org.br>
+
+ * ext/sdl/sdlvideosink.c:
+ * ext/sdl/sdlvideosink.h:
+ Trying to fix videos out of sync (not fixed yet)
+
2005-10-27 Tim-Philipp Müller <tim at centricular dot net>
* gst/qtdemux/qtdemux.h:
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;