summaryrefslogtreecommitdiffstats
path: root/ext/sdl/sdlvideosink.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2002-02-03 20:10:03 +0000
committerWim Taymans <wim.taymans@gmail.com>2002-02-03 20:10:03 +0000
commitfac29d09ff70d5faa2ee6fc38e827d6bffb8c6f2 (patch)
tree1d4006358bb5ee07f7856cd4c85565d6f3b4cca3 /ext/sdl/sdlvideosink.c
parentd9fde73163215fee58c0e00a47924173dc85ed3c (diff)
downloadgst-plugins-bad-fac29d09ff70d5faa2ee6fc38e827d6bffb8c6f2.tar.gz
gst-plugins-bad-fac29d09ff70d5faa2ee6fc38e827d6bffb8c6f2.tar.bz2
gst-plugins-bad-fac29d09ff70d5faa2ee6fc38e827d6bffb8c6f2.zip
Assorted fixes.
Original commit message from CVS: Assorted fixes. Use the new clocking stuff.
Diffstat (limited to 'ext/sdl/sdlvideosink.c')
-rw-r--r--ext/sdl/sdlvideosink.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c
index d84cde3c..29305826 100644
--- a/ext/sdl/sdlvideosink.c
+++ b/ext/sdl/sdlvideosink.c
@@ -23,6 +23,7 @@
#include <signal.h>
#include <string.h>
#include <sys/time.h>
+#include <stdlib.h>
#include "sdlvideosink.h"
@@ -153,6 +154,16 @@ gst_sdlvideosink_class_init (GstSDLVideoSinkClass *klass)
static void
+gst_sdlvideosink_set_clock (GstElement *element, GstClock *clock)
+{
+ GstSDLVideoSink *sdlvideosink;
+
+ sdlvideosink = GST_SDLVIDEOSINK (element);
+
+ sdlvideosink->clock = clock;
+}
+
+static void
gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
{
sdlvideosink->sinkpad = gst_pad_new_from_template (sink_template, "sink");
@@ -161,9 +172,6 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
gst_pad_set_chain_function (sdlvideosink->sinkpad, gst_sdlvideosink_chain);
gst_pad_set_connect_function (sdlvideosink->sinkpad, gst_sdlvideosink_sinkconnect);
- sdlvideosink->clock = gst_clock_get_system();
- gst_clock_register(sdlvideosink->clock, GST_OBJECT(sdlvideosink));
-
sdlvideosink->window_width = -1;
sdlvideosink->window_height = -1;
@@ -177,6 +185,9 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
sdlvideosink->capslist = capslist;
+ sdlvideosink->clock = NULL;
+ GST_ELEMENT (sdlvideosink)->setclockfunc = gst_sdlvideosink_set_clock;
+
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_THREAD_SUGGESTED);
}
@@ -320,7 +331,6 @@ static void
gst_sdlvideosink_chain (GstPad *pad, GstBuffer *buf)
{
GstSDLVideoSink *sdlvideosink;
- GstClockTimeDiff jitter;
SDL_Event event;
g_return_if_fail (pad != NULL);
@@ -344,15 +354,9 @@ gst_sdlvideosink_chain (GstPad *pad, GstBuffer *buf)
}
}
- jitter = gst_clock_current_diff(sdlvideosink->clock, GST_BUFFER_TIMESTAMP (buf));
-
- if (jitter > 500000 || jitter < -500000)
- {
- GST_DEBUG (0, "jitter: %lld\n", jitter);
- gst_clock_set (sdlvideosink->clock, GST_BUFFER_TIMESTAMP (buf));
- }
- else {
- gst_clock_wait(sdlvideosink->clock, GST_BUFFER_TIMESTAMP(buf), GST_OBJECT(sdlvideosink));
+ if (sdlvideosink->clock) {
+ gst_element_clock_wait (GST_ELEMENT (sdlvideosink),
+ sdlvideosink->clock, GST_BUFFER_TIMESTAMP (buf));
}
/* Lock SDL/yuv-overlay */
@@ -482,7 +486,7 @@ gst_sdlvideosink_change_state (GstElement *element)
else
{
char SDL_hack[32];
- sprintf(SDL_hack, "%ld", sdlvideosink->window_id);
+ sprintf(SDL_hack, "%d", sdlvideosink->window_id);
setenv("SDL_WINDOWID", SDL_hack, 1);
}
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0 )