mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
gst/: Maintain API and ABI when --disable-parse is used. Now that we have an appropriate error code, we can just retu...
Original commit message from CVS: Based on patch by: Peter Kjellerstedt <pkj at axis com> * gst/Makefile.am: * gst/gstparse.c: (gst_parse_launchv), (gst_parse_launch): * gst/gstparse.h: * gst/gstutils.c: (gst_parse_bin_from_description): * gst/gstutils.h: Maintain API and ABI when --disable-parse is used. Now that we have an appropriate error code, we can just return NULL and the appropriate error when gst_parse_launch() is used despite it having been disabled (#342564). * tests/check/Makefile.am: * tests/check/pipelines/.cvsignore: * tests/check/pipelines/parse-disabled.c: Make sure these functions exist and return NULL plus a GError when --disable-parse is used.
This commit is contained in:
parent
cb67757934
commit
f38b77d70b
9 changed files with 136 additions and 37 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2007-05-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Based on patch by: Peter Kjellerstedt <pkj at axis com>
|
||||
|
||||
* gst/Makefile.am:
|
||||
* gst/gstparse.c: (gst_parse_launchv), (gst_parse_launch):
|
||||
* gst/gstparse.h:
|
||||
* gst/gstutils.c: (gst_parse_bin_from_description):
|
||||
* gst/gstutils.h:
|
||||
Maintain API and ABI when --disable-parse is used. Now that
|
||||
we have an appropriate error code, we can just return NULL and the
|
||||
appropriate error when gst_parse_launch() is used despite it having
|
||||
been disabled (#342564).
|
||||
|
||||
* tests/check/Makefile.am:
|
||||
* tests/check/pipelines/.cvsignore:
|
||||
* tests/check/pipelines/parse-disabled.c:
|
||||
Make sure these functions exist and return NULL plus a GError when
|
||||
--disable-parse is used.
|
||||
|
||||
2007-05-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* tests/benchmarks/complexity.c: (main):
|
||||
|
|
|
@ -17,13 +17,9 @@ endif
|
|||
endif
|
||||
|
||||
if GST_DISABLE_PARSE
|
||||
GST_PARSE_SRC =
|
||||
GST_PARSE_H =
|
||||
SUBDIRS_PARSE =
|
||||
GST_PARSE_LA =
|
||||
else
|
||||
GST_PARSE_SRC = gstparse.c
|
||||
GST_PARSE_H = gstparse.h
|
||||
SUBDIRS_PARSE = parse
|
||||
GST_PARSE_LA = parse/libgstparse.la
|
||||
endif
|
||||
|
@ -70,7 +66,7 @@ built_header_make = gstenumtypes.h gstmarshal.h
|
|||
built_source_make = $(GST_ENUMTYPES_SRC) gstmarshal.c
|
||||
|
||||
EXTRA_libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
|
||||
gstmarshal.list gstparse.c gsttrace.c gstxml.c \
|
||||
gstmarshal.list gsttrace.c gstxml.c \
|
||||
gstregistryxml.c gstregistrybinary.c
|
||||
|
||||
|
||||
|
@ -119,7 +115,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
|
|||
$(GST_URI_SRC) \
|
||||
gstutils.c \
|
||||
gstvalue.c \
|
||||
$(GST_PARSE_SRC) \
|
||||
gstparse.c \
|
||||
$(GST_REGISTRY_SRC) \
|
||||
$(GST_LOADSAVE_SRC)
|
||||
|
||||
|
@ -199,16 +195,13 @@ gst_headers = \
|
|||
gstutils.h \
|
||||
gstvalue.h \
|
||||
gstregistry.h \
|
||||
$(GST_PARSE_H) \
|
||||
gstparse.h \
|
||||
gstxml.h
|
||||
|
||||
libgstreamer_@GST_MAJORMINOR@include_HEADERS = $(gst_headers)
|
||||
nodist_libgstreamer_@GST_MAJORMINOR@include_HEADERS = \
|
||||
$(built_header_configure) $(built_header_make)
|
||||
|
||||
EXTRA_DIST = \
|
||||
gstparse.h
|
||||
|
||||
noinst_HEADERS = \
|
||||
gettext.h \
|
||||
glib-compat-private.h \
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "gstparse.h"
|
||||
#include "gsterror.h"
|
||||
#include "gstinfo.h"
|
||||
|
||||
extern GstElement *_gst_parse_launch (const gchar *, GError **);
|
||||
|
@ -55,6 +56,7 @@ gst_parse_error_quark (void)
|
|||
return quark;
|
||||
}
|
||||
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
static gchar *
|
||||
_gst_parse_escape (const gchar * str)
|
||||
{
|
||||
|
@ -77,6 +79,7 @@ _gst_parse_escape (const gchar * str)
|
|||
|
||||
return newstr;
|
||||
}
|
||||
#endif /* !GST_DISABLE_PARSE */
|
||||
|
||||
/**
|
||||
* gst_parse_launchv:
|
||||
|
@ -92,6 +95,7 @@ _gst_parse_escape (const gchar * str)
|
|||
GstElement *
|
||||
gst_parse_launchv (const gchar ** argv, GError ** error)
|
||||
{
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
GstElement *element;
|
||||
GString *str;
|
||||
const gchar **argvp, *arg;
|
||||
|
@ -117,6 +121,17 @@ gst_parse_launchv (const gchar ** argv, GError ** error)
|
|||
g_string_free (str, TRUE);
|
||||
|
||||
return element;
|
||||
#else
|
||||
gchar *msg;
|
||||
|
||||
GST_WARNING ("Disabled API called: gst_parse_launchv()");
|
||||
|
||||
msg = gst_error_get_message (GST_CORE_ERROR, GST_CORE_ERROR_DISABLED);
|
||||
g_set_error (error, GST_CORE_ERROR, GST_CORE_ERROR_DISABLED, "%s", msg);
|
||||
g_free (msg);
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,6 +151,7 @@ gst_parse_launchv (const gchar ** argv, GError ** error)
|
|||
GstElement *
|
||||
gst_parse_launch (const gchar * pipeline_description, GError ** error)
|
||||
{
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
GstElement *element;
|
||||
|
||||
g_return_val_if_fail (pipeline_description != NULL, NULL);
|
||||
|
@ -146,6 +162,15 @@ gst_parse_launch (const gchar * pipeline_description, GError ** error)
|
|||
element = _gst_parse_launch (pipeline_description, error);
|
||||
|
||||
return element;
|
||||
#else
|
||||
gchar *msg;
|
||||
|
||||
/* ERRORS */
|
||||
GST_WARNING ("Disabled API called: gst_parse_launch()");
|
||||
|
||||
msg = gst_error_get_message (GST_CORE_ERROR, GST_CORE_ERROR_DISABLED);
|
||||
g_set_error (error, GST_CORE_ERROR, GST_CORE_ERROR_DISABLED, "%s", msg);
|
||||
g_free (msg);
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -23,14 +23,10 @@
|
|||
#ifndef __GST_PARSE_H__
|
||||
#define __GST_PARSE_H__
|
||||
|
||||
#include <gst/gstconfig.h>
|
||||
|
||||
#include <gst/gstelement.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
|
||||
GQuark gst_parse_error_quark (void);
|
||||
/**
|
||||
* GST_PARSE_ERROR:
|
||||
|
@ -66,15 +62,6 @@ typedef enum
|
|||
GstElement* gst_parse_launch (const gchar *pipeline_description, GError **error);
|
||||
GstElement* gst_parse_launchv (const gchar **argv, GError **error);
|
||||
|
||||
#else /* GST_DISABLE_PARSE */
|
||||
|
||||
#if defined _GNUC_ && _GNUC_ >= 3
|
||||
#pragma GCC poison gst_parse_launch
|
||||
#pragma GCC poison gst_parse_launchv
|
||||
#endif
|
||||
|
||||
#endif /* GST_DISABLE_PARSE */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_PARSE_H__ */
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "gstghostpad.h"
|
||||
#include "gstutils.h"
|
||||
#include "gsterror.h"
|
||||
#include "gstinfo.h"
|
||||
#include "gstparse.h"
|
||||
#include "gst-i18n-lib.h"
|
||||
|
@ -3181,7 +3182,6 @@ gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction)
|
|||
return pad;
|
||||
}
|
||||
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
/**
|
||||
* gst_parse_bin_from_description:
|
||||
* @bin_description: command line describing the bin
|
||||
|
@ -3208,6 +3208,7 @@ GstElement *
|
|||
gst_parse_bin_from_description (const gchar * bin_description,
|
||||
gboolean ghost_unconnected_pads, GError ** err)
|
||||
{
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
GstPad *pad = NULL;
|
||||
GstBin *bin;
|
||||
gchar *desc;
|
||||
|
@ -3241,5 +3242,15 @@ gst_parse_bin_from_description (const gchar * bin_description,
|
|||
}
|
||||
|
||||
return GST_ELEMENT (bin);
|
||||
}
|
||||
#else
|
||||
gchar *msg;
|
||||
|
||||
GST_WARNING ("Disabled API called: gst_parse_bin_from_description()");
|
||||
|
||||
msg = gst_error_get_message (GST_CORE_ERROR, GST_CORE_ERROR_DISABLED);
|
||||
g_set_error (err, GST_CORE_ERROR, GST_CORE_ERROR_DISABLED, "%s", msg);
|
||||
g_free (msg);
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#ifndef __GST_UTILS_H__
|
||||
#define __GST_UTILS_H__
|
||||
|
||||
#include <gst/gstconfig.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gst/gstbin.h>
|
||||
|
||||
|
@ -670,18 +668,10 @@ void gst_element_found_tags_for_pad (GstElement * element,
|
|||
void gst_element_found_tags (GstElement * element,
|
||||
GstTagList * list);
|
||||
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
/* parse utility functions */
|
||||
GstElement * gst_parse_bin_from_description (const gchar * bin_description,
|
||||
gboolean ghost_unconnected_pads,
|
||||
GError ** err);
|
||||
#else /* GST_DISABLE_PARSE */
|
||||
|
||||
#if defined _GNUC_ && _GNUC_ >= 3
|
||||
#pragma GCC poison gst_parse_bin_from_description
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ SUPPRESSIONS = $(top_srcdir)/common/gst.supp
|
|||
clean-local: clean-local-check
|
||||
|
||||
if GST_DISABLE_PARSE
|
||||
PARSE_CHECKS =
|
||||
PARSE_CHECKS = pipelines/parse-disabled
|
||||
else
|
||||
PARSE_CHECKS = pipelines/simple-launch-lines pipelines/cleanup pipelines/parse-launch
|
||||
endif
|
||||
|
|
1
tests/check/pipelines/.gitignore
vendored
1
tests/check/pipelines/.gitignore
vendored
|
@ -4,3 +4,4 @@ simple-launch-lines
|
|||
stress
|
||||
parse-launch
|
||||
*.check.xml
|
||||
parse-disabled
|
||||
|
|
72
tests/check/pipelines/parse-disabled.c
Normal file
72
tests/check/pipelines/parse-disabled.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* GStreamer unit test for disabled gst-parse
|
||||
* Copyright (C) 2007 Tim-Philipp Müller <tim centricular 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
||||
#include <gst/gstconfig.h>
|
||||
|
||||
GST_START_TEST (test_parse_launch_errors)
|
||||
{
|
||||
GstElement *pipe;
|
||||
GError *err;
|
||||
const gchar *arr[] = { "fakesrc", "fakesink", NULL };
|
||||
|
||||
err = NULL;
|
||||
pipe = gst_parse_launch ("fakesrc ! fakesink", &err);
|
||||
fail_unless (err != NULL, "expected an error, but did not get one");
|
||||
fail_unless (pipe == NULL, "got pipeline, but expected NULL");
|
||||
fail_unless (err->domain == GST_CORE_ERROR);
|
||||
fail_unless (err->code == GST_CORE_ERROR_DISABLED);
|
||||
g_error_free (err);
|
||||
|
||||
err = NULL;
|
||||
pipe = gst_parse_bin_from_description ("fakesrc ! fakesink", TRUE, &err);
|
||||
fail_unless (err != NULL, "expected an error, but did not get one");
|
||||
fail_unless (pipe == NULL, "got pipeline, but expected NULL");
|
||||
fail_unless (err->domain == GST_CORE_ERROR);
|
||||
fail_unless (err->code == GST_CORE_ERROR_DISABLED);
|
||||
g_error_free (err);
|
||||
|
||||
err = NULL;
|
||||
pipe = gst_parse_launchv (arr, &err);
|
||||
fail_unless (err != NULL, "expected an error, but did not get one");
|
||||
fail_unless (pipe == NULL, "got pipeline, but expected NULL");
|
||||
fail_unless (err->domain == GST_CORE_ERROR);
|
||||
fail_unless (err->code == GST_CORE_ERROR_DISABLED);
|
||||
g_error_free (err);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
parsedisabled_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("Parse Launch (Disabled Mode)");
|
||||
TCase *tc_chain = tcase_create ("parselaunchdisabled");
|
||||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_parse_launch_errors);
|
||||
return s;
|
||||
}
|
||||
|
||||
GST_CHECK_MAIN (parsedisabled);
|
Loading…
Reference in a new issue