Commit 0ff70da6 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

examples: motioncells: remove GPL3 code we don't need

If 95% of the code of an example app consists of GObject
code, maybe that's defeating the point a little. So just
remove a lot of that and trim down the example to the
absolute minimum. Also removes the last remaining GPL3
licensed code in -bad.
parent b800bba7
noinst_PROGRAMS = gstmotioncells_dynamic_test \
gsthanddetect_test
gstmotioncells_dynamic_test_SOURCES = \
gstmotioncells_dynamic_test.c \
gst_element_print_properties.c
gstmotioncells_dynamic_test_SOURCES = gstmotioncells_dynamic_test.c
gsthanddetect_test_SOURCES = gsthanddetect_test.c
gstmotioncells_dynamic_test_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
......@@ -11,6 +9,4 @@ gstmotioncells_dynamic_test_LDFLAGS = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS
gsthanddetect_test_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
gsthanddetect_test_LDFLAGS = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GSTPB_BASE_LIBS)
noinst_HEADERS = \
gstmotioncells_dynamic_test.h \
gst_element_print_properties.h
This diff is collapsed.
/* GStreamer
* Copyright (C) 2010 Wesley Miller <wmiller@sdr.com>
*
*
* gst_element_print_properties(): a tool to inspect GStreamer
* element properties
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GST_ELEMENT_PRINT_PROPERTIES_H
#define GST_ELEMENT_PRINT_PROPERTIES_H
extern void gst_element_print_properties (GstElement * element);
extern void print_column_titles (guint c2w, guint c3w, guint c4w);
extern void print_element_info (GstElement * element, guint c2w, guint c3w,
guint c4w);
extern gchar *flags_to_string (GFlagsValue * vals, guint flags);
extern void print_caps (const GstCaps * caps, const gchar * pfx);
extern gboolean print_field (GQuark field, const GValue * value, gpointer pfx);
#endif
......@@ -21,12 +21,61 @@
*
*/
#include <gst/gst.h>
#include <glib.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "gstmotioncells_dynamic_test.h"
#include "gst_element_print_properties.h"
static void
print_element_properties (GstElement * element)
{
GParamSpec **pspecs, *pspec;
guint num, i;
g_print ("\tProperty : value (type)\n");
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element), &num);
for (i = 0; i < num; ++i) {
GValue val = G_VALUE_INIT;
const gchar *type_name;
gchar *s;
pspec = pspecs[i];
/* only care about properties we can read and write */
if ((pspec->flags & G_PARAM_READWRITE) != G_PARAM_READWRITE)
continue;
/* and which can be changed after construction */
if ((pspec->flags & G_PARAM_CONSTRUCT_ONLY))
continue;
/* ignore some GstObject properties which are not interesting */
if (!strcmp (pspec->name, "name") || !strcmp (pspec->name, "parent"))
continue;
/* ignore properties we can't change in a meaningful way */
if (G_IS_PARAM_SPEC_BOXED (pspec) || G_IS_PARAM_SPEC_OBJECT (pspec)
|| G_IS_PARAM_SPEC_POINTER (pspec))
continue;
g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property (G_OBJECT (element), pspec->name, &val);
s = gst_value_serialize (&val);
if (G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_STRING) {
type_name = "string";
g_free (s);
g_object_get (G_OBJECT (element), pspec->name, &s, NULL);
if (s == NULL)
s = g_strdup ("(null)");
} else {
type_name = g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec));
}
g_print ("\t%s: %s (%s)\n", pspec->name, s, type_name);
g_free (s);
g_value_unset (&val);
}
g_free (pspecs);
}
int
main (int argc, char *argv[])
......@@ -71,9 +120,12 @@ main (int argc, char *argv[])
g_print ("Going to playing..\n");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("You can use these properties: \n");
gst_element_print_properties (mcells);
g_print ("See 'gst-inspect-1.0 motioncells' for all the details.\n");
g_print ("You can use these properties: \n\n");
print_element_properties (mcells);
g_print ("\nSee 'gst-inspect-1.0 motioncells' for all the details.\n");
g_print ("Change properties like this: propertyname=value\n");
g_print ("Quit with 'q'\n");
......
/* GStreamer
* Copyright (C) 2011 Robert Jobbagy <jobbagy.robert@gmail.com>
*
*
* gst_motioncells_dynamic_test(): a test tool what can to do dynamic change properties
*
*
* 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 St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef GST_MOTIONCELLS_DYNAMIC_TEST_H
#define GST_MOTIONCELLS_DYNAMIC_TEST_H
extern void setProperty (GstElement * mcells, char *property, char *prop_value,
GType type, GValue * value);
#endif
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