mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-16 19:25:18 +00:00
gst/elements/gstfilesink.c: Fix for if we pass NULL as property to location.
Original commit message from CVS: 2004-01-07 Ronald Bultje <rbultje@ronald.bitfreak.net> * gst/elements/gstfilesink.c: (gst_filesink_set_location): Fix for if we pass NULL as property to location. * gst/elements/gstpipefilter.c: (gst_pipefilter_init), (gst_pipefilter_handle_event), (gst_pipefilter_chain): Fix for instantiate-test (see below). * gst/gststructure.c: (_gst_structure_parse_value): Fix compile error on gcc-2.96. * configure.ac: * tests/Makefile.am: * tests/instantiate/Makefile.am: * tests/instantiate/create.c: (create_all_elements), (main): Add a test that instantiates all elements. This makes it easy to track dead code for old API/design (like setting event functions on sink pads and so on).
This commit is contained in:
parent
aa40b1516b
commit
718b21bfc2
9 changed files with 114 additions and 21 deletions
|
@ -594,6 +594,7 @@ libs/gst/getbits/Makefile
|
|||
po/Makefile.in
|
||||
tests/Makefile
|
||||
tests/bufspeed/Makefile
|
||||
tests/instantiate/Makefile
|
||||
tests/memchunk/Makefile
|
||||
tests/muxing/Makefile
|
||||
tests/seeking/Makefile
|
||||
|
|
|
@ -192,8 +192,13 @@ gst_filesink_set_location (GstFileSink *sink, const gchar *location)
|
|||
|
||||
g_free (sink->filename);
|
||||
g_free (sink->uri);
|
||||
sink->filename = g_strdup (location);
|
||||
sink->uri = gst_uri_construct ("file", location);
|
||||
if (location != NULL) {
|
||||
sink->filename = g_strdup (location);
|
||||
sink->uri = gst_uri_construct ("file", location);
|
||||
} else {
|
||||
sink->filename = NULL;
|
||||
sink->uri = NULL;
|
||||
}
|
||||
|
||||
if (GST_STATE (sink) == GST_STATE_PAUSED)
|
||||
gst_filesink_open_file (sink);
|
||||
|
|
|
@ -135,7 +135,6 @@ gst_pipefilter_init (GstPipefilter *pipefilter)
|
|||
pipefilter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->sinkpad);
|
||||
gst_pad_set_chain_function (pipefilter->sinkpad, gst_pipefilter_chain);
|
||||
gst_pad_set_event_function (pipefilter->sinkpad, gst_pipefilter_handle_event);
|
||||
|
||||
pipefilter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->srcpad);
|
||||
|
@ -155,10 +154,19 @@ gst_pipefilter_handle_event (GstPad *pad, GstEvent *event)
|
|||
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
|
||||
|
||||
GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter));
|
||||
if (close (pipefilter->fdin[1]) < 0)
|
||||
perror("close");
|
||||
if (close (pipefilter->fdout[0]) < 0)
|
||||
perror("close");
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
if (close (pipefilter->fdin[1]) < 0)
|
||||
perror("close");
|
||||
if (close (pipefilter->fdout[0]) < 0)
|
||||
perror("close");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gst_pad_event_default (pad, event);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -206,7 +214,7 @@ gst_pipefilter_get (GstPad *pad)
|
|||
static void
|
||||
gst_pipefilter_chain (GstPad *pad,GstData *_data)
|
||||
{
|
||||
GstBuffer *buf = GST_BUFFER (_data);
|
||||
GstBuffer *buf;
|
||||
GstPipefilter *pipefilter;
|
||||
glong writebytes;
|
||||
guchar *data;
|
||||
|
@ -214,10 +222,15 @@ gst_pipefilter_chain (GstPad *pad,GstData *_data)
|
|||
|
||||
g_return_if_fail(pad != NULL);
|
||||
g_return_if_fail(GST_IS_PAD(pad));
|
||||
g_return_if_fail(buf != NULL);
|
||||
|
||||
if (GST_IS_EVENT (_data)) {
|
||||
gst_pipefilter_handle_event (pad, GST_EVENT (_data));
|
||||
return;
|
||||
}
|
||||
|
||||
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
|
||||
|
||||
buf = GST_BUFFER (_data);
|
||||
data = GST_BUFFER_DATA(buf);
|
||||
size = GST_BUFFER_SIZE(buf);
|
||||
|
||||
|
|
|
@ -1383,7 +1383,7 @@ _gst_structure_parse_value (gchar *str, gchar **after, GValue *value,
|
|||
gchar *value_end;
|
||||
gchar *s;
|
||||
gchar c;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
GType type = default_type;
|
||||
|
||||
|
||||
|
|
|
@ -192,8 +192,13 @@ gst_filesink_set_location (GstFileSink *sink, const gchar *location)
|
|||
|
||||
g_free (sink->filename);
|
||||
g_free (sink->uri);
|
||||
sink->filename = g_strdup (location);
|
||||
sink->uri = gst_uri_construct ("file", location);
|
||||
if (location != NULL) {
|
||||
sink->filename = g_strdup (location);
|
||||
sink->uri = gst_uri_construct ("file", location);
|
||||
} else {
|
||||
sink->filename = NULL;
|
||||
sink->uri = NULL;
|
||||
}
|
||||
|
||||
if (GST_STATE (sink) == GST_STATE_PAUSED)
|
||||
gst_filesink_open_file (sink);
|
||||
|
|
|
@ -135,7 +135,6 @@ gst_pipefilter_init (GstPipefilter *pipefilter)
|
|||
pipefilter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->sinkpad);
|
||||
gst_pad_set_chain_function (pipefilter->sinkpad, gst_pipefilter_chain);
|
||||
gst_pad_set_event_function (pipefilter->sinkpad, gst_pipefilter_handle_event);
|
||||
|
||||
pipefilter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->srcpad);
|
||||
|
@ -155,10 +154,19 @@ gst_pipefilter_handle_event (GstPad *pad, GstEvent *event)
|
|||
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
|
||||
|
||||
GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter));
|
||||
if (close (pipefilter->fdin[1]) < 0)
|
||||
perror("close");
|
||||
if (close (pipefilter->fdout[0]) < 0)
|
||||
perror("close");
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
if (close (pipefilter->fdin[1]) < 0)
|
||||
perror("close");
|
||||
if (close (pipefilter->fdout[0]) < 0)
|
||||
perror("close");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gst_pad_event_default (pad, event);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -206,7 +214,7 @@ gst_pipefilter_get (GstPad *pad)
|
|||
static void
|
||||
gst_pipefilter_chain (GstPad *pad,GstData *_data)
|
||||
{
|
||||
GstBuffer *buf = GST_BUFFER (_data);
|
||||
GstBuffer *buf;
|
||||
GstPipefilter *pipefilter;
|
||||
glong writebytes;
|
||||
guchar *data;
|
||||
|
@ -214,10 +222,15 @@ gst_pipefilter_chain (GstPad *pad,GstData *_data)
|
|||
|
||||
g_return_if_fail(pad != NULL);
|
||||
g_return_if_fail(GST_IS_PAD(pad));
|
||||
g_return_if_fail(buf != NULL);
|
||||
|
||||
if (GST_IS_EVENT (_data)) {
|
||||
gst_pipefilter_handle_event (pad, GST_EVENT (_data));
|
||||
return;
|
||||
}
|
||||
|
||||
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
|
||||
|
||||
buf = GST_BUFFER (_data);
|
||||
data = GST_BUFFER_DATA(buf);
|
||||
size = GST_BUFFER_SIZE(buf);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
SUBDIRS = memchunk muxing sched threadstate seeking # bufspeed
|
||||
SUBDIRS = instantiate memchunk muxing sched threadstate seeking # bufspeed
|
||||
|
||||
if !GST_DISABLE_TRACE
|
||||
noinst_PROGRAMS = lat
|
||||
|
@ -9,4 +9,4 @@ lat_LDFLAGS = $(GST_LIBS)
|
|||
endif
|
||||
|
||||
EXTRA_DIST = README
|
||||
DIST_SUBDIRS= bufspeed memchunk muxing sched threadstate seeking
|
||||
DIST_SUBDIRS= bufspeed instantiate memchunk muxing sched threadstate seeking
|
||||
|
|
4
tests/instantiate/Makefile.am
Normal file
4
tests/instantiate/Makefile.am
Normal file
|
@ -0,0 +1,4 @@
|
|||
noinst_PROGRAMS = create
|
||||
|
||||
LDADD = $(GST_LIBS)
|
||||
AM_CFLAGS = $(GST_CFLAGS)
|
52
tests/instantiate/create.c
Normal file
52
tests/instantiate/create.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
*
|
||||
* create.c: test which instantiates all elements and unrefs them
|
||||
*
|
||||
* 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/gst.h>
|
||||
|
||||
static void
|
||||
create_all_elements (void)
|
||||
{
|
||||
const GList *elements;
|
||||
GstElementFactory *factory;
|
||||
GstElement *element;
|
||||
|
||||
/* get list of elements */
|
||||
for (elements = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
|
||||
elements != NULL; elements = elements->next) {
|
||||
factory = (GstElementFactory *) elements->data;
|
||||
if ((element = gst_element_factory_create (factory, "test"))) {
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc,
|
||||
gchar *argv[])
|
||||
{
|
||||
gst_init (&argc, &argv);
|
||||
create_all_elements ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue