Commit bcfd60a8 authored by Sebastian Dröge's avatar Sebastian Dröge

videomixer2: Add videomixer2 element

This is based on collectpads2 and is synchronizing
all streams based on the running time.

New features compared to old videomixer:
 * Synchronizing frames on the running time
 * Improved and simplified negotiation
 * Full QoS support
 * Variable framerate support

Fixes bug #626048, #624905.
parent 6940559c
......@@ -3,14 +3,27 @@ plugin_LTLIBRARIES = libgstvideomixer.la
ORC_SOURCE=blendorc
include $(top_srcdir)/common/orc.mak
libgstvideomixer_la_SOURCES = videomixer.c blend.c
libgstvideomixer_la_SOURCES = \
videomixer.c \
blend.c \
videomixer2.c \
gstcollectpads2.c
nodist_libgstvideomixer_la_SOURCES = $(ORC_NODIST_SOURCES)
libgstvideomixer_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
libgstvideomixer_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ \
$(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS) \
-DGstCollectPads2=GstVideoMixer2Pads \
-DGstCollectPads2Class=GstVideoMixer2PadsClass
libgstvideomixer_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-@GST_MAJORMINOR@ \
$(GST_BASE_LIBS) $(GST_CONTROLLER_LIBS) $(GST_LIBS) $(ORC_LIBS)
libgstvideomixer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvideomixer_la_LIBTOOLFLAGS = --tag=disable-static
# headers we need but don't want installed
noinst_HEADERS = videomixer.h videomixerpad.h blend.h
noinst_HEADERS = \
videomixer.h \
videomixerpad.h \
blend.h \
videomixer2.h \
gstcollectpads2.h
This diff is collapsed.
This diff is collapsed.
......@@ -85,6 +85,7 @@
#endif
#include "videomixer.h"
#include "videomixer2.h"
GST_DEBUG_CATEGORY_STATIC (gst_videomixer_debug);
#define GST_CAT_DEFAULT gst_videomixer_debug
......@@ -1855,7 +1856,7 @@ plugin_init (GstPlugin * plugin)
gst_video_mixer_init_blend ();
return gst_element_register (plugin, "videomixer", GST_RANK_PRIMARY,
GST_TYPE_VIDEO_MIXER);
GST_TYPE_VIDEO_MIXER) && gst_videomixer2_register (plugin);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
......
This diff is collapsed.
/* Generic video mixer plugin
* Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
* Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_VIDEO_MIXER2_H__
#define __GST_VIDEO_MIXER2_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include "blend.h"
#include "gstcollectpads2.h"
G_BEGIN_DECLS
#define GST_TYPE_VIDEO_MIXER2 (gst_videomixer2_get_type())
#define GST_VIDEO_MIXER2(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_MIXER2, GstVideoMixer2))
#define GST_VIDEO_MIXER2_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_MIXER2, GstVideoMixer2Class))
#define GST_IS_VIDEO_MIXER2(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_MIXER2))
#define GST_IS_VIDEO_MIXER2_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_MIXER2))
typedef struct _GstVideoMixer2 GstVideoMixer2;
typedef struct _GstVideoMixer2Class GstVideoMixer2Class;
/**
* GstVideoMixer2Background:
* @VIDEO_MIXER2_BACKGROUND_CHECKER: checker pattern background
* @VIDEO_MIXER2_BACKGROUND_BLACK: solid color black background
* @VIDEO_MIXER2_BACKGROUND_WHITE: solid color white background
*
* The different backgrounds videomixer can blend over.
*/
typedef enum
{
VIDEO_MIXER2_BACKGROUND_CHECKER,
VIDEO_MIXER2_BACKGROUND_BLACK,
VIDEO_MIXER2_BACKGROUND_WHITE
}
GstVideoMixer2Background;
/**
* GstVideoMixer2:
*
* The opaque #GstVideoMixer2 structure.
*/
struct _GstVideoMixer2
{
GstElement element;
/* pad */
GstPad *srcpad;
/* Lock to prevent the state to change while blending */
GMutex *lock;
/* Sink pads using Collect Pads 2*/
GstCollectPads2 *collect;
/* sinkpads, a GSList of GstVideoMixer2Pads */
GSList *sinkpads;
gint numpads;
/* Next available sinkpad index */
gint next_sinkpad;
/* Output caps */
GstVideoFormat format;
gint width, height;
gint fps_n;
gint fps_d;
gint par_n;
gint par_d;
gboolean newseg_pending;
gboolean flush_stop_pending;
GstVideoMixer2Background background;
/* Current downstream segment */
GstSegment segment;
GstClockTime ts_offset;
guint64 nframes;
/* QoS stuff */
gdouble proportion;
GstClockTime earliest_time;
guint64 qos_processed, qos_dropped;
BlendFunction blend;
FillCheckerFunction fill_checker;
FillColorFunction fill_color;
};
struct _GstVideoMixer2Class
{
GstElementClass parent_class;
};
GType gst_videomixer2_get_type (void);
gboolean gst_videomixer2_register (GstPlugin * plugin);
G_END_DECLS
#endif /* __GST_VIDEO_MIXER2_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment