mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:46:13 +00:00
update v4lmjpegsink to the newer clock api. i can't test this, though.
Original commit message from CVS: update v4lmjpegsink to the newer clock api. i can't test this, though.
This commit is contained in:
parent
d44ca0c99f
commit
f0f64e0786
1 changed files with 20 additions and 13 deletions
|
@ -68,6 +68,7 @@ static void gst_v4lmjpegsink_get_property (GObject
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gst_v4lmjpegsink_close (GstV4lMjpegSink *v4lmjpegsink);
|
static void gst_v4lmjpegsink_close (GstV4lMjpegSink *v4lmjpegsink);
|
||||||
static GstElementStateReturn gst_v4lmjpegsink_change_state (GstElement *element);
|
static GstElementStateReturn gst_v4lmjpegsink_change_state (GstElement *element);
|
||||||
|
static void gst_v4lmjpegsink_set_clock (GstElement *element, GstClock *clock);
|
||||||
|
|
||||||
|
|
||||||
static GstCaps *capslist = NULL;
|
static GstCaps *capslist = NULL;
|
||||||
|
@ -159,8 +160,8 @@ gst_v4lmjpegsink_init (GstV4lMjpegSink *v4lmjpegsink)
|
||||||
gst_pad_set_chain_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_chain);
|
gst_pad_set_chain_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_chain);
|
||||||
gst_pad_set_connect_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_sinkconnect);
|
gst_pad_set_connect_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_sinkconnect);
|
||||||
|
|
||||||
v4lmjpegsink->clock = gst_system_clock_obtain ();
|
v4lmjpegsink->clock = NULL;
|
||||||
gst_clock_register(v4lmjpegsink->clock, GST_OBJECT(v4lmjpegsink));
|
GST_ELEMENT (v4lmjpegsink)->setclockfunc = gst_v4lmjpegsink_set_clock;
|
||||||
|
|
||||||
v4lmjpegsink->width = -1;
|
v4lmjpegsink->width = -1;
|
||||||
v4lmjpegsink->height = -1;
|
v4lmjpegsink->height = -1;
|
||||||
|
@ -210,6 +211,15 @@ gst_v4lmjpegsink_sinkconnect (GstPad *pad,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_v4lmjpegsink_set_clock (GstElement *element, GstClock *clock)
|
||||||
|
{
|
||||||
|
GstV4lMjpegSink *v4mjpegsink = GST_V4LMJPEGSINK (element);
|
||||||
|
|
||||||
|
v4mjpegsink->clock = clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_v4lmjpegsink_chain (GstPad *pad,
|
gst_v4lmjpegsink_chain (GstPad *pad,
|
||||||
GstBuffer *buf)
|
GstBuffer *buf)
|
||||||
|
@ -224,20 +234,17 @@ gst_v4lmjpegsink_chain (GstPad *pad,
|
||||||
|
|
||||||
v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
|
v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
GST_DEBUG (0,"videosink: clock wait: %llu\n", GST_BUFFER_TIMESTAMP(buf));
|
if (v4lmjpegsink->clock) {
|
||||||
|
GST_DEBUG (0,"videosink: clock wait: %llu\n", GST_BUFFER_TIMESTAMP(buf));
|
||||||
|
|
||||||
jitter = gst_clock_current_diff(v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP (buf));
|
jitter = gst_clock_current_diff(v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP (buf));
|
||||||
|
|
||||||
if (jitter > 500000 || jitter < -500000)
|
if (jitter > 500000 || jitter < -500000)
|
||||||
{
|
GST_DEBUG (0, "jitter: %lld\n", jitter);
|
||||||
GST_DEBUG (0, "jitter: %lld\n", jitter);
|
|
||||||
gst_clock_set (v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP (buf));
|
gst_element_clock_wait(GST_ELEMENT(v4lmjpegsink), v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP(buf));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
//gst_clock_wait(v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP(buf), GST_OBJECT(v4lmjpegsink));
|
|
||||||
gst_clock_wait(v4lmjpegsink->clock, GST_BUFFER_TIMESTAMP(buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check size */
|
/* check size */
|
||||||
if (GST_BUFFER_SIZE(buf) > v4lmjpegsink->breq.size)
|
if (GST_BUFFER_SIZE(buf) > v4lmjpegsink->breq.size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue