mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
frei0r: Sync properties to the controller if one was set
This commit is contained in:
parent
125efbffcc
commit
31f4ac7b30
5 changed files with 60 additions and 6 deletions
|
@ -6,8 +6,8 @@ libgstfrei0r_la_SOURCES = \
|
|||
gstfrei0rsrc.c \
|
||||
gstfrei0rmixer.c
|
||||
|
||||
libgstfrei0r_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
|
||||
libgstfrei0r_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \
|
||||
libgstfrei0r_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstfrei0r_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_CONTROLLER_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) \
|
||||
-lgstvideo-@GST_MAJORMINOR@
|
||||
libgstfrei0r_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
libgstfrei0r_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "gstfrei0rsrc.h"
|
||||
#include "gstfrei0rmixer.h"
|
||||
|
||||
#include <gst/controller/gstcontroller.h>
|
||||
#include <string.h>
|
||||
|
||||
GST_DEBUG_CATEGORY (frei0r_debug);
|
||||
|
@ -612,6 +613,8 @@ plugin_init (GstPlugin * plugin)
|
|||
|
||||
GST_DEBUG_CATEGORY_INIT (frei0r_debug, "frei0r", 0, "frei0r");
|
||||
|
||||
gst_controller_init (NULL, NULL);
|
||||
|
||||
gst_plugin_add_dependency_simple (plugin,
|
||||
"HOME/.frei0r-1/lib",
|
||||
"/usr/lib/frei0r-1:/usr/local/lib/frei0r-1",
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "gstfrei0r.h"
|
||||
#include "gstfrei0rfilter.h"
|
||||
|
||||
#include <gst/controller/gstcontroller.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (frei0r_debug);
|
||||
#define GST_CAT_DEFAULT frei0r_debug
|
||||
|
||||
|
@ -64,6 +66,24 @@ gst_frei0r_filter_stop (GstBaseTransform * trans)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_frei0r_filter_before_transform (GstBaseTransform * trans,
|
||||
GstBuffer * buffer)
|
||||
{
|
||||
GstClockTime timestamp;
|
||||
GstFrei0rFilter *self = GST_FREI0R_FILTER (trans);
|
||||
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
timestamp =
|
||||
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "sync to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (timestamp));
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
||||
gst_object_sync_values (G_OBJECT (self), timestamp);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_frei0r_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
|
@ -193,6 +213,8 @@ gst_frei0r_filter_class_init (GstFrei0rFilterClass * klass,
|
|||
gsttrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_frei0r_filter_set_caps);
|
||||
gsttrans_class->stop = GST_DEBUG_FUNCPTR (gst_frei0r_filter_stop);
|
||||
gsttrans_class->transform = GST_DEBUG_FUNCPTR (gst_frei0r_filter_transform);
|
||||
gsttrans_class->before_transform =
|
||||
GST_DEBUG_FUNCPTR (gst_frei0r_filter_before_transform);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "gstfrei0r.h"
|
||||
#include "gstfrei0rmixer.h"
|
||||
|
||||
#include <gst/controller/gstcontroller.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (frei0r_debug);
|
||||
#define GST_CAT_DEFAULT frei0r_debug
|
||||
|
||||
|
@ -546,7 +548,9 @@ gst_frei0r_mixer_collected (GstCollectPads * pads, GstFrei0rMixer * self)
|
|||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GSList *l;
|
||||
GstFrei0rMixerClass *klass = GST_FREI0R_MIXER_GET_CLASS (self);
|
||||
GstClockTime timestamp;
|
||||
gdouble time;
|
||||
GstSegment *segment = NULL;
|
||||
|
||||
if (G_UNLIKELY (self->width <= 0 || self->height <= 0))
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
|
@ -573,17 +577,29 @@ gst_frei0r_mixer_collected (GstCollectPads * pads, GstFrei0rMixer * self)
|
|||
for (l = pads->data; l; l = l->next) {
|
||||
GstCollectData *cdata = l->data;
|
||||
|
||||
if (cdata->pad == self->sink0)
|
||||
if (cdata->pad == self->sink0) {
|
||||
inbuf0 = gst_collect_pads_pop (pads, cdata);
|
||||
else if (cdata->pad == self->sink1)
|
||||
segment = &cdata->segment;
|
||||
} else if (cdata->pad == self->sink1) {
|
||||
inbuf1 = gst_collect_pads_pop (pads, cdata);
|
||||
else if (cdata->pad == self->sink2)
|
||||
} else if (cdata->pad == self->sink2) {
|
||||
inbuf2 = gst_collect_pads_pop (pads, cdata);
|
||||
}
|
||||
}
|
||||
|
||||
if (!inbuf0 || !inbuf1 || (!inbuf2 && self->sink2))
|
||||
goto eos;
|
||||
|
||||
g_assert (segment != NULL);
|
||||
timestamp = GST_BUFFER_TIMESTAMP (inbuf0);
|
||||
timestamp = gst_segment_to_stream_time (segment, GST_FORMAT_TIME, timestamp);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "sync to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (timestamp));
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
||||
gst_object_sync_values (G_OBJECT (self), timestamp);
|
||||
|
||||
gst_buffer_copy_metadata (outbuf, inbuf0,
|
||||
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
|
||||
time = ((gdouble) GST_BUFFER_TIMESTAMP (outbuf)) / GST_SECOND;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "gstfrei0r.h"
|
||||
#include "gstfrei0rsrc.h"
|
||||
|
||||
#include <gst/controller/gstcontroller.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (frei0r_debug);
|
||||
#define GST_CAT_DEFAULT frei0r_debug
|
||||
|
||||
|
@ -66,6 +68,7 @@ gst_frei0r_src_create (GstPushSrc * src, GstBuffer ** buf)
|
|||
guint size, newsize;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GstBuffer *outbuf = NULL;
|
||||
GstClockTime timestamp;
|
||||
gdouble time;
|
||||
|
||||
*buf = NULL;
|
||||
|
@ -101,7 +104,7 @@ gst_frei0r_src_create (GstPushSrc * src, GstBuffer ** buf)
|
|||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
|
||||
}
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) =
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = timestamp =
|
||||
gst_util_uint64_scale (self->n_frames, GST_SECOND * self->fps_d,
|
||||
self->fps_n);
|
||||
GST_BUFFER_OFFSET (outbuf) = self->n_frames;
|
||||
|
@ -111,6 +114,16 @@ gst_frei0r_src_create (GstPushSrc * src, GstBuffer ** buf)
|
|||
gst_util_uint64_scale (self->n_frames, GST_SECOND * self->fps_d,
|
||||
self->fps_n) - GST_BUFFER_TIMESTAMP (outbuf);
|
||||
|
||||
timestamp =
|
||||
gst_segment_to_stream_time (&GST_BASE_SRC_CAST (self)->segment,
|
||||
GST_FORMAT_TIME, timestamp);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "sync to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (timestamp));
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
||||
gst_object_sync_values (G_OBJECT (self), timestamp);
|
||||
|
||||
time = ((gdouble) GST_BUFFER_TIMESTAMP (outbuf)) / GST_SECOND;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
|
Loading…
Reference in a new issue