mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-27 03:23:16 +00:00
Remove capssetter element
It has been moved to gst-plugins-good. See #617739.
This commit is contained in:
parent
c2513b374a
commit
ee063478ff
12 changed files with 7 additions and 676 deletions
|
@ -44,8 +44,9 @@ CRUFT_FILES = \
|
|||
$(top_builddir)/gst/aacparse/.libs/*.{so,dll,DLL,dylib} \
|
||||
$(top_builddir)/gst/amrparse/.libs/*.{so,dll,DLL,dylib} \
|
||||
$(top_builddir)/gst/flacparse/.libs/*.{so,dll,DLL,dylib} \
|
||||
$(top_builddir)/gst/shapewipe/.libs/*.{so,dll,DLL,dylib}
|
||||
$(top_builddir)/ext/ivorbis/.libs/*.{so,dll,DLL,dylib}
|
||||
$(top_builddir)/gst/shapewipe/.libs/*.{so,dll,DLL,dylib} \
|
||||
$(top_builddir)/ext/ivorbis/.libs/*.{so,dll,DLL,dylib} \
|
||||
$(top_builddir)/tests/check/elements/capssetter
|
||||
|
||||
CRUFT_DIRS = \
|
||||
$(top_srcdir)/gst/aacparse \
|
||||
|
|
|
@ -136,7 +136,6 @@ EXTRA_HFILES = \
|
|||
$(top_srcdir)/gst/dccp/gstdccpserversink.h \
|
||||
$(top_srcdir)/gst/dccp/gstdccpserversrc.h \
|
||||
$(top_srcdir)/gst/debugutils/fpsdisplaysink.h \
|
||||
$(top_srcdir)/gst/debugutils/gstcapssetter.h \
|
||||
$(top_srcdir)/gst/dtmf/gstdtmfsrc.h \
|
||||
$(top_srcdir)/gst/dtmf/gstdtmfdetect.h \
|
||||
$(top_srcdir)/gst/dtmf/gstrtpdtmfsrc.h \
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
<xi:include href="xml/element-assrender.xml" />
|
||||
<xi:include href="xml/element-autoconvert.xml" />
|
||||
<xi:include href="xml/element-camerabin.xml" />
|
||||
<xi:include href="xml/element-capssetter.xml" />
|
||||
<xi:include href="xml/element-celtdec.xml" />
|
||||
<xi:include href="xml/element-celtenc.xml" />
|
||||
<xi:include href="xml/element-dataurisrc.xml" />
|
||||
|
|
|
@ -140,20 +140,6 @@ GST_IS_CAMERABIN_CLASS
|
|||
gst_camerabin_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>element-capssetter</FILE>
|
||||
<TITLE>capssetter</TITLE>
|
||||
GstCapsSetter
|
||||
<SUBSECTION Standard>
|
||||
GstCapsSetterClass
|
||||
GST_TYPE_CAPS_SETTER
|
||||
GST_CAPS_SETTER
|
||||
GST_IS_CAPS_SETTER
|
||||
GST_CAPS_SETTER_CLASS
|
||||
GST_IS_CAPS_SETTER_CLASS
|
||||
gst_caps_setter_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>element-celtdec</FILE>
|
||||
<TITLE>celtdec</TITLE>
|
||||
|
|
|
@ -9,27 +9,6 @@
|
|||
<package>GStreamer Bad Plug-ins git</package>
|
||||
<origin>Unknown package origin</origin>
|
||||
<elements>
|
||||
<element>
|
||||
<name>capssetter</name>
|
||||
<longname>CapsSetter</longname>
|
||||
<class>Generic</class>
|
||||
<description>Set/merge caps on stream</description>
|
||||
<author>Mark Nauwelaerts <mnauw@users.sourceforge.net></author>
|
||||
<pads>
|
||||
<caps>
|
||||
<name>src</name>
|
||||
<direction>source</direction>
|
||||
<presence>always</presence>
|
||||
<details>ANY</details>
|
||||
</caps>
|
||||
<caps>
|
||||
<name>sink</name>
|
||||
<direction>sink</direction>
|
||||
<presence>always</presence>
|
||||
<details>ANY</details>
|
||||
</caps>
|
||||
</pads>
|
||||
</element>
|
||||
<element>
|
||||
<name>fpsdisplaysink</name>
|
||||
<longname>Measure and show framerate on videosink</longname>
|
||||
|
@ -46,4 +25,4 @@
|
|||
</pads>
|
||||
</element>
|
||||
</elements>
|
||||
</plugin>
|
||||
</plugin>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
plugin_LTLIBRARIES = libgstdebugutilsbad.la
|
||||
|
||||
libgstdebugutilsbad_la_SOURCES = fpsdisplaysink.c gstcapssetter.c debugutilsbad.c
|
||||
libgstdebugutilsbad_la_SOURCES = fpsdisplaysink.c debugutilsbad.c
|
||||
libgstdebugutilsbad_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
|
||||
libgstdebugutilsbad_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-$(GST_MAJORMINOR)
|
||||
libgstdebugutilsbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
libgstdebugutilsbad_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
noinst_HEADERS = fpsdisplaysink.h gstcapssetter.h
|
||||
noinst_HEADERS = fpsdisplaysink.h
|
||||
|
||||
|
|
|
@ -24,15 +24,12 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
GType fps_display_sink_get_type (void);
|
||||
GType gst_caps_setter_get_type (void);
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
return gst_element_register (plugin, "fpsdisplaysink", GST_RANK_NONE,
|
||||
fps_display_sink_get_type ()) &&
|
||||
gst_element_register (plugin, "capssetter", GST_RANK_NONE,
|
||||
gst_caps_setter_get_type ());
|
||||
fps_display_sink_get_type ());
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
|
|
|
@ -1,337 +0,0 @@
|
|||
/* GStreamer Element
|
||||
* Copyright (C) 2006-2009 Mark Nauwelaerts <mnauw@users.sourceforge.net>
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:element-capssetter
|
||||
*
|
||||
* <refsect2>
|
||||
* <para>
|
||||
* Sets or merges caps on a stream's buffers.
|
||||
* That is, a buffer's caps are updated using (fields of)
|
||||
* <link linkend="GstCapsSetter--caps">caps</link>. Note that this may
|
||||
* contain multiple structures (though not likely recommended), but each
|
||||
* of these must be fixed (or will otherwise be rejected).
|
||||
* </para>
|
||||
* <para>
|
||||
* If <link linkend="GstCapsSetter--join">join</link>
|
||||
* is TRUE, then the incoming caps' mime-type is compared to the mime-type(s)
|
||||
* of provided caps and only matching structure(s) are considered for updating.
|
||||
* </para>
|
||||
* <para>
|
||||
* If <link linkend="GstCapsSetter--replace">replace</link>
|
||||
* is TRUE, then any caps update is preceded by clearing existing fields,
|
||||
* making provided fields (as a whole) replace incoming ones.
|
||||
* Otherwise, no clearing is performed, in which case provided fields are
|
||||
* added/merged onto incoming caps
|
||||
* </para>
|
||||
* <para>
|
||||
* Although this element might mainly serve as debug helper,
|
||||
* it can also practically be used to correct a faulty pixel-aspect-ratio,
|
||||
* or to modify a yuv fourcc value to effectively swap chroma components or such
|
||||
* alike.
|
||||
* </para>
|
||||
* </refsect2>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstcapssetter.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (caps_setter_debug);
|
||||
#define GST_CAT_DEFAULT caps_setter_debug
|
||||
|
||||
|
||||
/* signals and args */
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CAPS,
|
||||
PROP_JOIN,
|
||||
PROP_REPLACE
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
#define DEFAULT_JOIN TRUE
|
||||
#define DEFAULT_REPLACE FALSE
|
||||
|
||||
static GstStaticPadTemplate gst_caps_setter_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE (GST_BASE_TRANSFORM_SRC_NAME,
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
static GstStaticPadTemplate gst_caps_setter_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE (GST_BASE_TRANSFORM_SINK_NAME,
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
|
||||
static gboolean gst_caps_setter_transform_size (GstBaseTransform * trans,
|
||||
GstPadDirection direction, GstCaps * caps, guint size,
|
||||
GstCaps * othercaps, guint * othersize);
|
||||
static GstCaps *gst_caps_setter_transform_caps (GstBaseTransform * trans,
|
||||
GstPadDirection direction, GstCaps * caps);
|
||||
static GstFlowReturn gst_caps_setter_transform_ip (GstBaseTransform * btrans,
|
||||
GstBuffer * in);
|
||||
|
||||
static void gst_caps_setter_finalize (GObject * object);
|
||||
|
||||
static void gst_caps_setter_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void gst_caps_setter_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
GST_BOILERPLATE (GstCapsSetter, gst_caps_setter, GstBaseTransform,
|
||||
GST_TYPE_BASE_TRANSFORM);
|
||||
|
||||
static void
|
||||
gst_caps_setter_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "CapsSetter",
|
||||
"Generic",
|
||||
"Set/merge caps on stream",
|
||||
"Mark Nauwelaerts <mnauw@users.sourceforge.net>");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_caps_setter_sink_template));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_caps_setter_src_template));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_caps_setter_class_init (GstCapsSetterClass * g_class)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) g_class;
|
||||
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) g_class;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (caps_setter_debug, "capssetter", 0, "capssetter");
|
||||
|
||||
gobject_class->set_property = gst_caps_setter_set_property;
|
||||
gobject_class->get_property = gst_caps_setter_get_property;
|
||||
|
||||
gobject_class->finalize = gst_caps_setter_finalize;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CAPS,
|
||||
g_param_spec_boxed ("caps", "Merge caps",
|
||||
"Merge these caps (thereby overwriting) in the stream",
|
||||
GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_JOIN,
|
||||
g_param_spec_boolean ("join", "Join",
|
||||
"Match incoming caps' mime-type to mime-type of provided caps",
|
||||
DEFAULT_JOIN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_REPLACE,
|
||||
g_param_spec_boolean ("replace", "Replace",
|
||||
"Drop fields of incoming caps", DEFAULT_REPLACE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
trans_class->transform_size =
|
||||
GST_DEBUG_FUNCPTR (gst_caps_setter_transform_size);
|
||||
trans_class->transform_caps =
|
||||
GST_DEBUG_FUNCPTR (gst_caps_setter_transform_caps);
|
||||
/* dummy seems needed */
|
||||
trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_caps_setter_transform_ip);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_caps_setter_init (GstCapsSetter * filter, GstCapsSetterClass * g_class)
|
||||
{
|
||||
filter->caps = gst_caps_new_any ();
|
||||
filter->join = DEFAULT_JOIN;
|
||||
filter->replace = DEFAULT_REPLACE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_caps_setter_finalize (GObject * object)
|
||||
{
|
||||
GstCapsSetter *filter = GST_CAPS_SETTER (object);
|
||||
|
||||
gst_caps_replace (&filter->caps, NULL);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_caps_setter_transform_size (GstBaseTransform * trans,
|
||||
GstPadDirection direction, GstCaps * caps, guint size,
|
||||
GstCaps * othercaps, guint * othersize)
|
||||
{
|
||||
*othersize = size;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_caps_setter_transform_caps (GstBaseTransform * trans,
|
||||
GstPadDirection direction, GstCaps * caps)
|
||||
{
|
||||
GstCapsSetter *filter = GST_CAPS_SETTER (trans);
|
||||
GstCaps *ret, *filter_caps;
|
||||
GstStructure *structure, *merge;
|
||||
const gchar *name;
|
||||
gint i, j;
|
||||
|
||||
GST_DEBUG_OBJECT (trans, "receiving caps: %" GST_PTR_FORMAT, caps);
|
||||
|
||||
ret = gst_caps_copy (caps);
|
||||
|
||||
/* this function is always called with a simple caps */
|
||||
if (!GST_CAPS_IS_SIMPLE (ret) || direction != GST_PAD_SINK)
|
||||
return ret;
|
||||
|
||||
structure = gst_caps_get_structure (ret, 0);
|
||||
name = gst_structure_get_name (structure);
|
||||
|
||||
GST_OBJECT_LOCK (filter);
|
||||
filter_caps = gst_caps_ref (filter->caps);
|
||||
GST_OBJECT_UNLOCK (filter);
|
||||
|
||||
for (i = 0; i < gst_caps_get_size (filter_caps); ++i) {
|
||||
merge = gst_caps_get_structure (filter_caps, i);
|
||||
if (gst_structure_has_name (merge, name) || !filter->join) {
|
||||
|
||||
if (!filter->join)
|
||||
gst_structure_set_name (structure, gst_structure_get_name (merge));
|
||||
|
||||
if (filter->replace)
|
||||
gst_structure_remove_all_fields (structure);
|
||||
|
||||
for (j = 0; j < gst_structure_n_fields (merge); ++j) {
|
||||
const gchar *fname;
|
||||
|
||||
fname = gst_structure_nth_field_name (merge, j);
|
||||
gst_structure_set_value (structure, fname,
|
||||
gst_structure_get_value (merge, fname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret);
|
||||
|
||||
gst_caps_unref (filter_caps);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_caps_setter_transform_ip (GstBaseTransform * btrans, GstBuffer * in)
|
||||
{
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_caps_is_fixed_foreach (GQuark field_id, const GValue * value,
|
||||
gpointer unused)
|
||||
{
|
||||
return gst_value_is_fixed (value);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_caps_setter_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstCapsSetter *filter = GST_CAPS_SETTER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CAPS:{
|
||||
GstCaps *new_caps;
|
||||
const GstCaps *new_caps_val = gst_value_get_caps (value);
|
||||
gint i;
|
||||
|
||||
if (new_caps_val == NULL) {
|
||||
new_caps = gst_caps_new_any ();
|
||||
} else {
|
||||
new_caps = gst_caps_copy (new_caps_val);
|
||||
}
|
||||
|
||||
for (i = 0; new_caps && (i < gst_caps_get_size (new_caps)); ++i) {
|
||||
GstStructure *s;
|
||||
|
||||
s = gst_caps_get_structure (new_caps, i);
|
||||
if (!gst_structure_foreach (s, gst_caps_is_fixed_foreach, NULL)) {
|
||||
GST_ERROR_OBJECT (filter, "rejected unfixed caps: %" GST_PTR_FORMAT,
|
||||
new_caps);
|
||||
gst_caps_unref (new_caps);
|
||||
new_caps = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_caps) {
|
||||
GST_OBJECT_LOCK (filter);
|
||||
gst_caps_replace (&filter->caps, new_caps);
|
||||
/* drop extra ref */
|
||||
gst_caps_unref (new_caps);
|
||||
GST_OBJECT_UNLOCK (filter);
|
||||
|
||||
GST_DEBUG_OBJECT (filter, "set new caps %" GST_PTR_FORMAT, new_caps);
|
||||
}
|
||||
|
||||
/* try to activate these new caps next time around */
|
||||
gst_base_transform_reconfigure (GST_BASE_TRANSFORM (filter));
|
||||
break;
|
||||
}
|
||||
case PROP_JOIN:
|
||||
filter->join = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_REPLACE:
|
||||
filter->replace = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_caps_setter_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstCapsSetter *filter = GST_CAPS_SETTER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CAPS:
|
||||
gst_value_set_caps (value, filter->caps);
|
||||
break;
|
||||
case PROP_JOIN:
|
||||
g_value_set_boolean (value, filter->join);
|
||||
break;
|
||||
case PROP_REPLACE:
|
||||
g_value_set_boolean (value, filter->replace);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/* GStreamer Element
|
||||
* Copyright (C) 2006-2009 Mark Nauwelaerts <mnauw@users.sourceforge.net>
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_CAPS_SETTER_H__
|
||||
#define __GST_CAPS_SETTER_H__
|
||||
|
||||
#include <gst/base/gstbasetransform.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CAPS_SETTER \
|
||||
(gst_caps_setter_get_type())
|
||||
#define GST_CAPS_SETTER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAPS_SETTER,GstCapsSetter))
|
||||
#define GST_CAPS_SETTER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAPS_SETTER,GstCapsSetterClass))
|
||||
#define GST_IS_CAPS_SETTER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAPS_SETTER))
|
||||
#define GST_IS_CAPS_SETTER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAPS_SETTER))
|
||||
|
||||
GType gst_caps_setter_get_type (void);
|
||||
|
||||
typedef struct _GstCapsSetter GstCapsSetter;
|
||||
typedef struct _GstCapsSetterClass GstCapsSetterClass;
|
||||
|
||||
struct _GstCapsSetter
|
||||
{
|
||||
GstBaseTransform parent;
|
||||
|
||||
/* < private > */
|
||||
/* properties */
|
||||
GstCaps *caps;
|
||||
gboolean join;
|
||||
gboolean replace;
|
||||
};
|
||||
|
||||
|
||||
struct _GstCapsSetterClass
|
||||
{
|
||||
GstBaseTransformClass parent_class;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_CAPS_SETTER_H__ */
|
|
@ -125,7 +125,6 @@ check_PROGRAMS = \
|
|||
elements/autoconvert \
|
||||
elements/asfmux \
|
||||
elements/camerabin \
|
||||
elements/capssetter \
|
||||
elements/dataurisrc \
|
||||
elements/imagefreeze \
|
||||
elements/legacyresample \
|
||||
|
|
1
tests/check/elements/.gitignore
vendored
1
tests/check/elements/.gitignore
vendored
|
@ -5,7 +5,6 @@ asfmux
|
|||
assrender
|
||||
autoconvert
|
||||
camerabin
|
||||
capssetter
|
||||
deinterleave
|
||||
dataurisrc
|
||||
faac
|
||||
|
|
|
@ -1,228 +0,0 @@
|
|||
/* GStreamer
|
||||
*
|
||||
* unit test for capssetter
|
||||
*
|
||||
* Copyright (C) <2009> Mark Nauwelaerts <mnauw@users.sourceforge.net>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
||||
|
||||
/* For ease of programming we use globals to keep refs for our floating
|
||||
* src and sink pads we create; otherwise we always have to do get_pad,
|
||||
* get_peer, and then remove references in every test function */
|
||||
static GstPad *mysrcpad, *mysinkpad;
|
||||
|
||||
|
||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
static GstElement *
|
||||
setup_capssetter (void)
|
||||
{
|
||||
GstElement *capssetter;
|
||||
|
||||
GST_DEBUG ("setup_capssetter");
|
||||
|
||||
capssetter = gst_check_setup_element ("capssetter");
|
||||
mysrcpad = gst_check_setup_src_pad (capssetter, &srctemplate, NULL);
|
||||
mysinkpad = gst_check_setup_sink_pad (capssetter, &sinktemplate, NULL);
|
||||
gst_pad_set_active (mysrcpad, TRUE);
|
||||
gst_pad_set_active (mysinkpad, TRUE);
|
||||
|
||||
return capssetter;
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_capssetter (GstElement * capssetter)
|
||||
{
|
||||
GST_DEBUG ("cleanup_capssetter");
|
||||
|
||||
gst_pad_set_active (mysrcpad, FALSE);
|
||||
gst_pad_set_active (mysinkpad, FALSE);
|
||||
gst_check_teardown_src_pad (capssetter);
|
||||
gst_check_teardown_sink_pad (capssetter);
|
||||
gst_check_teardown_element (capssetter);
|
||||
}
|
||||
|
||||
static void
|
||||
push_and_test (GstCaps * prop_caps, gboolean join, gboolean replace,
|
||||
GstCaps * in_caps, GstCaps * out_caps)
|
||||
{
|
||||
GstElement *capssetter;
|
||||
GstBuffer *buffer;
|
||||
|
||||
capssetter = setup_capssetter ();
|
||||
fail_unless (gst_element_set_state (capssetter,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||
"could not set to playing");
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (4);
|
||||
ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
|
||||
memcpy (GST_BUFFER_DATA (buffer), "data", 4);
|
||||
|
||||
gst_buffer_set_caps (buffer, in_caps);
|
||||
gst_caps_unref (in_caps);
|
||||
|
||||
g_object_set (capssetter, "join", join, NULL);
|
||||
g_object_set (capssetter, "replace", replace, NULL);
|
||||
g_object_set (capssetter, "caps", prop_caps, NULL);
|
||||
gst_caps_unref (prop_caps);
|
||||
|
||||
/* pushing gives away my reference ... */
|
||||
fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK,
|
||||
"Failed pushing buffer to capssetter");
|
||||
|
||||
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
|
||||
|
||||
/* ... but it should end up being collected on the global buffer list */
|
||||
fail_unless (g_list_length (buffers) == 1);
|
||||
buffer = g_list_first (buffers)->data;
|
||||
ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
|
||||
|
||||
fail_unless (gst_caps_is_equal (out_caps, GST_BUFFER_CAPS (buffer)));
|
||||
gst_caps_unref (out_caps);
|
||||
|
||||
/* cleanup */
|
||||
cleanup_capssetter (capssetter);
|
||||
}
|
||||
|
||||
#define SRC_WIDTH 8
|
||||
#define SRC_HEIGHT 12
|
||||
|
||||
static GstCaps *
|
||||
make_src_caps (void)
|
||||
{
|
||||
return gst_caps_new_simple ("video/x-raw-yuv", "width", G_TYPE_INT, SRC_WIDTH,
|
||||
"height", G_TYPE_INT, SRC_HEIGHT, NULL);
|
||||
}
|
||||
|
||||
/* don't try these caps mutations at home, folks */
|
||||
|
||||
GST_START_TEST (test_n_join_n_replace)
|
||||
{
|
||||
GstCaps *in_caps, *prop_caps, *out_caps;
|
||||
|
||||
in_caps = make_src_caps ();
|
||||
prop_caps = gst_caps_new_simple ("video/x-raw-rgb",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH, NULL);
|
||||
out_caps = gst_caps_new_simple ("video/x-raw-rgb",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH,
|
||||
"height", G_TYPE_INT, SRC_HEIGHT, NULL);
|
||||
push_and_test (prop_caps, FALSE, FALSE, in_caps, out_caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_n_join_replace)
|
||||
{
|
||||
GstCaps *in_caps, *prop_caps, *out_caps;
|
||||
|
||||
in_caps = make_src_caps ();
|
||||
prop_caps = gst_caps_new_simple ("video/x-raw-rgb",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH, NULL);
|
||||
out_caps = gst_caps_copy (prop_caps);
|
||||
push_and_test (prop_caps, FALSE, TRUE, in_caps, out_caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_join_n_replace_n_match)
|
||||
{
|
||||
GstCaps *in_caps, *prop_caps, *out_caps;
|
||||
|
||||
/* non joining caps */
|
||||
in_caps = make_src_caps ();
|
||||
prop_caps = gst_caps_new_simple ("video/x-raw-rgb",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH, NULL);
|
||||
out_caps = gst_caps_copy (in_caps);
|
||||
push_and_test (prop_caps, TRUE, FALSE, in_caps, out_caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_join_n_replace_match)
|
||||
{
|
||||
GstCaps *in_caps, *prop_caps, *out_caps;
|
||||
|
||||
/* joining caps */
|
||||
in_caps = make_src_caps ();
|
||||
prop_caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH, NULL);
|
||||
out_caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH,
|
||||
"height", G_TYPE_INT, SRC_HEIGHT, NULL);
|
||||
push_and_test (prop_caps, TRUE, FALSE, in_caps, out_caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_join_replace_n_match)
|
||||
{
|
||||
GstCaps *in_caps, *prop_caps, *out_caps;
|
||||
|
||||
/* non joining caps */
|
||||
in_caps = make_src_caps ();
|
||||
prop_caps = gst_caps_new_simple ("video/x-raw-rgb",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH, NULL);
|
||||
out_caps = gst_caps_copy (in_caps);
|
||||
push_and_test (prop_caps, TRUE, TRUE, in_caps, out_caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_join_replace_match)
|
||||
{
|
||||
GstCaps *in_caps, *prop_caps, *out_caps;
|
||||
|
||||
/* joining caps */
|
||||
in_caps = make_src_caps ();
|
||||
prop_caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
"width", G_TYPE_INT, 2 * SRC_WIDTH, NULL);
|
||||
out_caps = gst_caps_copy (prop_caps);
|
||||
push_and_test (prop_caps, TRUE, TRUE, in_caps, out_caps);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
capssetter_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("capssetter");
|
||||
TCase *tc_chain = tcase_create ("general");
|
||||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_n_join_n_replace);
|
||||
tcase_add_test (tc_chain, test_n_join_replace);
|
||||
tcase_add_test (tc_chain, test_join_n_replace_n_match);
|
||||
tcase_add_test (tc_chain, test_join_n_replace_match);
|
||||
tcase_add_test (tc_chain, test_join_replace_n_match);
|
||||
tcase_add_test (tc_chain, test_join_replace_match);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
GST_CHECK_MAIN (capssetter);
|
Loading…
Reference in a new issue