mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
Assorted fixes.
Original commit message from CVS: Assorted fixes. Use the new clocking stuff.
This commit is contained in:
parent
d9fde73163
commit
fac29d09ff
2 changed files with 20 additions and 14 deletions
|
@ -763,6 +763,7 @@ gst/chart/Makefile
|
||||||
gst/cutter/Makefile
|
gst/cutter/Makefile
|
||||||
gst/deinterlace/Makefile
|
gst/deinterlace/Makefile
|
||||||
gst/flx/Makefile
|
gst/flx/Makefile
|
||||||
|
gst/goom/Makefile
|
||||||
gst/intfloat/Makefile
|
gst/intfloat/Makefile
|
||||||
gst/law/Makefile
|
gst/law/Makefile
|
||||||
gst/level/Makefile
|
gst/level/Makefile
|
||||||
|
@ -835,6 +836,7 @@ ext/shout/Makefile
|
||||||
ext/sidplay/Makefile
|
ext/sidplay/Makefile
|
||||||
ext/smoothwave/Makefile
|
ext/smoothwave/Makefile
|
||||||
ext/vorbis/Makefile
|
ext/vorbis/Makefile
|
||||||
|
ext/tarkin/Makefile
|
||||||
ext/xmms/Makefile
|
ext/xmms/Makefile
|
||||||
gst-libs/Makefile
|
gst-libs/Makefile
|
||||||
gst-libs/gst/Makefile
|
gst-libs/gst/Makefile
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "sdlvideosink.h"
|
#include "sdlvideosink.h"
|
||||||
|
|
||||||
|
@ -152,6 +153,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
|
static void
|
||||||
gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
|
gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
|
||||||
{
|
{
|
||||||
|
@ -161,9 +172,6 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
|
||||||
gst_pad_set_chain_function (sdlvideosink->sinkpad, gst_sdlvideosink_chain);
|
gst_pad_set_chain_function (sdlvideosink->sinkpad, gst_sdlvideosink_chain);
|
||||||
gst_pad_set_connect_function (sdlvideosink->sinkpad, gst_sdlvideosink_sinkconnect);
|
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_width = -1;
|
||||||
sdlvideosink->window_height = -1;
|
sdlvideosink->window_height = -1;
|
||||||
|
|
||||||
|
@ -177,6 +185,9 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
|
||||||
|
|
||||||
sdlvideosink->capslist = capslist;
|
sdlvideosink->capslist = capslist;
|
||||||
|
|
||||||
|
sdlvideosink->clock = NULL;
|
||||||
|
GST_ELEMENT (sdlvideosink)->setclockfunc = gst_sdlvideosink_set_clock;
|
||||||
|
|
||||||
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_THREAD_SUGGESTED);
|
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_THREAD_SUGGESTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +331,6 @@ static void
|
||||||
gst_sdlvideosink_chain (GstPad *pad, GstBuffer *buf)
|
gst_sdlvideosink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
GstSDLVideoSink *sdlvideosink;
|
GstSDLVideoSink *sdlvideosink;
|
||||||
GstClockTimeDiff jitter;
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
g_return_if_fail (pad != NULL);
|
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 (sdlvideosink->clock) {
|
||||||
|
gst_element_clock_wait (GST_ELEMENT (sdlvideosink),
|
||||||
if (jitter > 500000 || jitter < -500000)
|
sdlvideosink->clock, GST_BUFFER_TIMESTAMP (buf));
|
||||||
{
|
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lock SDL/yuv-overlay */
|
/* Lock SDL/yuv-overlay */
|
||||||
|
@ -482,7 +486,7 @@ gst_sdlvideosink_change_state (GstElement *element)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char SDL_hack[32];
|
char SDL_hack[32];
|
||||||
sprintf(SDL_hack, "%ld", sdlvideosink->window_id);
|
sprintf(SDL_hack, "%d", sdlvideosink->window_id);
|
||||||
setenv("SDL_WINDOWID", SDL_hack, 1);
|
setenv("SDL_WINDOWID", SDL_hack, 1);
|
||||||
}
|
}
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0 )
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0 )
|
||||||
|
|
Loading…
Reference in a new issue