mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
adding dv, raw1934, gnomevfs, rtp
Original commit message from CVS: adding dv, raw1934, gnomevfs, rtp
This commit is contained in:
parent
b103fabdb0
commit
25261025ef
6 changed files with 998 additions and 6 deletions
5
TODO
5
TODO
|
@ -31,3 +31,8 @@
|
|||
* make sidplay stuff ok, the source is on the net ;)
|
||||
|
||||
* fix xmms plugin, doesn't register atm
|
||||
|
||||
* arts and artsd need a good onceover
|
||||
|
||||
|
||||
* check if we can drop some of the AC_SUBST's for libs and cflags
|
||||
|
|
|
@ -545,6 +545,7 @@ dnl *** raw1394 ***
|
|||
translit(dnm, m, l) AM_CONDITIONAL(USE_RAW1394, true)
|
||||
GST_CHECK_FEATURE(RAW1394, [raw1394 library], dv1394src, [
|
||||
GST_CHECK_LIBHEADER(RAW1394, raw1934, raw1934_get_handle,, libraw1394/raw1394.h, RAW1394_LIBS="-raw1394")
|
||||
AC_SUBST(RAW1394_LIBS)
|
||||
])
|
||||
|
||||
dnl Check for librtp
|
||||
|
@ -1067,6 +1068,7 @@ ext/cdparanoia/Makefile
|
|||
ext/dvdread/Makefile
|
||||
ext/esd/Makefile
|
||||
ext/flac/Makefile
|
||||
ext/gnomevfs/Makefile
|
||||
ext/gsm/Makefile
|
||||
ext/hermes/Makefile
|
||||
ext/jpeg/Makefile
|
||||
|
@ -1074,6 +1076,8 @@ ext/lame/Makefile
|
|||
ext/mad/Makefile
|
||||
ext/mpeg2dec/Makefile
|
||||
ext/openquicktime/Makefile
|
||||
ext/raw1394/Makefile
|
||||
ext/rtp/Makefile
|
||||
ext/shout/Makefile
|
||||
ext/sdl/Makefile
|
||||
ext/vorbis/Makefile
|
||||
|
|
|
@ -34,6 +34,12 @@ else
|
|||
CDPARANOIA_DIR=
|
||||
endif
|
||||
|
||||
if USE_DV
|
||||
DV_DIR=dv
|
||||
else
|
||||
DV_DIR=
|
||||
endif
|
||||
|
||||
if USE_DVDREAD
|
||||
DVDREAD_DIR=dvdread
|
||||
else
|
||||
|
@ -64,6 +70,12 @@ else
|
|||
FLAC_DIR=
|
||||
endif
|
||||
|
||||
if USE_GNOME_VFS
|
||||
GNOME_VFS_DIR=gnomevfs
|
||||
else
|
||||
GNOME_VFS_DIR=
|
||||
endif
|
||||
|
||||
if USE_HERMES
|
||||
HERMES_DIR=hermes
|
||||
else
|
||||
|
@ -106,6 +118,12 @@ else
|
|||
OPENQUICKTIME_DIR=
|
||||
endif
|
||||
|
||||
if USE_RTP
|
||||
RTP_DIR=rtp
|
||||
else
|
||||
RTP_DIR=
|
||||
endif
|
||||
|
||||
if USE_SDL
|
||||
SDL_DIR=sdl
|
||||
else
|
||||
|
@ -131,12 +149,12 @@ XMMS_DIR=
|
|||
endif
|
||||
|
||||
SUBDIRS=$(A52_DIR) $(AALIB_DIR) $(ALSA_DIR) $(AUDIOFILE_DIR) \
|
||||
$(AVIFILE_DIR) $(CDPARANOIA_DIR) $(DVDREAD_DIR) $(ESD_DIR) \
|
||||
$(FESTIVAL_DIR) $(FLAC_DIR) $(GSM_DIR) $(HERMES_DIR) \
|
||||
$(AVIFILE_DIR) $(CDPARANOIA_DIR) $(DV_DIR) $(DVDREAD_DIR) $(ESD_DIR) \
|
||||
$(FESTIVAL_DIR) $(FLAC_DIR) $(GNOMEVFS_DIR) $(GSM_DIR) $(HERMES_DIR) \
|
||||
$(JPEG_DIR) $(LAME_DIR) $(MAD_DIR) $(MIKMOD_DIR) $(MPEG2DEC_DIR) \
|
||||
$(OPENQUICKTIME_DIR) $(SDL_DIR) $(SHOUT_DIR) $(VORBIS_DIR) \
|
||||
$(OPENQUICKTIME_DIR) $(RTP_DIR) $(SDL_DIR) $(SHOUT_DIR) $(VORBIS_DIR) \
|
||||
$(XMMS_DIR)
|
||||
|
||||
DIST_SUBDIRS=a52 aalib alsa avifile audiofile cdparanoia dvdread esd \
|
||||
festival flac gsm hermes jpeg lame mad mikmod mpeg2dec \
|
||||
openquicktime sdl shout vorbis xmms
|
||||
DIST_SUBDIRS=a52 aalib alsa avifile audiofile cdparanoia dv dvdread esd \
|
||||
festival flac gnomevfs gsm hermes jpeg lame mad mikmod mpeg2dec \
|
||||
openquicktime rtp sdl shout vorbis xmms
|
||||
|
|
13
ext/gnomevfs/Makefile.am
Normal file
13
ext/gnomevfs/Makefile.am
Normal file
|
@ -0,0 +1,13 @@
|
|||
plugindir = $(libdir)/gst
|
||||
|
||||
plugin_LTLIBRARIES = libgstgnomevfssrc.la libgstgnomevfssink.la
|
||||
|
||||
libgstgnomevfssrc_la_SOURCES = gstgnomevfssrc.c
|
||||
libgstgnomevfssink_la_SOURCES = gstgnomevfssink.c
|
||||
|
||||
libgstgnomevfssrc_la_CFLAGS = $(GNOME_VFS_CFLAGS) $(GST_CFLAGS)
|
||||
libgstgnomevfssrc_la_LIBADD = $(GNOME_VFS_LIBS) $(GST_LIBS)
|
||||
|
||||
libgstgnomevfssink_la_CFLAGS = $(GNOME_VFS_CFLAGS) $(GST_CFLAGS)
|
||||
libgstgnomevfssink_la_LIBADD = $(GNOME_VFS_LIBS) $(GST_LIBS)
|
||||
|
374
ext/gnomevfs/gstgnomevfssink.c
Normal file
374
ext/gnomevfs/gstgnomevfssink.c
Normal file
|
@ -0,0 +1,374 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
* 2001 Bastien Nocera <hadess@hadess.net>
|
||||
*
|
||||
* gstgnomevfssink.c:
|
||||
*
|
||||
* 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 <gst/gst.h>
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
|
||||
GstElementDetails gst_gnomevfssink_details;
|
||||
|
||||
|
||||
#define GST_TYPE_GNOMEVFSSINK \
|
||||
(gst_gnomevfssink_get_type())
|
||||
#define GST_GNOMEVFSSINK(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GNOMEVFSSINK,GstGnomeVFSSink))
|
||||
#define GST_GNOMEVFSSINK_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GNOMEVFSSINK,GstGnomeVFSSinkClass))
|
||||
#define GST_IS_GNOMEVFSSINK(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GNOMEVFSSINK))
|
||||
#define GST_IS_GNOMEVFSSINK_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GNOMEVFSSINK))
|
||||
|
||||
typedef struct _GstGnomeVFSSink GstGnomeVFSSink;
|
||||
typedef struct _GstGnomeVFSSinkClass GstGnomeVFSSinkClass;
|
||||
|
||||
typedef enum {
|
||||
GST_GNOMEVFSSINK_OPEN = GST_ELEMENT_FLAG_LAST,
|
||||
|
||||
GST_GNOMEVFSSINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
|
||||
} GstGnomeVFSSinkFlags;
|
||||
|
||||
struct _GstGnomeVFSSink {
|
||||
GstElement element;
|
||||
|
||||
/* filename */
|
||||
gchar *filename;
|
||||
/* uri */
|
||||
GnomeVFSURI *uri;
|
||||
/* handle */
|
||||
GnomeVFSHandle *handle;
|
||||
/* wether to erase a file or not */
|
||||
gboolean erase;
|
||||
};
|
||||
|
||||
struct _GstGnomeVFSSinkClass {
|
||||
GstElementClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*handoff) (GstElement *element,GstPad *pad);
|
||||
void (*erase_ask) (GstElement *element,GstPad *pad);
|
||||
};
|
||||
|
||||
GType gst_gnomevfssink_get_type(void);
|
||||
|
||||
GstElementDetails gst_gnomevfssink_details = {
|
||||
"GnomeVFS Sink",
|
||||
"Sink",
|
||||
"GnomeVFS hole for data",
|
||||
VERSION,
|
||||
"Bastien Nocera <hadess@hadess.net>",
|
||||
"(C) 2001"
|
||||
};
|
||||
|
||||
|
||||
/* GnomeVFSSink signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
SIGNAL_HANDOFF,
|
||||
SIGNAL_ERASE_ASK,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_LOCATION,
|
||||
ARG_ERASE
|
||||
};
|
||||
|
||||
|
||||
static void gst_gnomevfssink_class_init (GstGnomeVFSSinkClass *klass);
|
||||
static void gst_gnomevfssink_init (GstGnomeVFSSink *gnomevfssink);
|
||||
|
||||
static void gst_gnomevfssink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_gnomevfssink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
static gboolean gst_gnomevfssink_open_file (GstGnomeVFSSink *sink);
|
||||
static void gst_gnomevfssink_close_file (GstGnomeVFSSink *sink);
|
||||
|
||||
static void gst_gnomevfssink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstElementStateReturn gst_gnomevfssink_change_state (GstElement *element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_gnomevfssink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_gnomevfssink_get_type (void)
|
||||
{
|
||||
static GType gnomevfssink_type = 0;
|
||||
|
||||
if (!gnomevfssink_type) {
|
||||
static const GTypeInfo gnomevfssink_info = {
|
||||
sizeof(GstGnomeVFSSinkClass), NULL,
|
||||
NULL,
|
||||
(GClassInitFunc)gst_gnomevfssink_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GstGnomeVFSSink),
|
||||
0,
|
||||
(GInstanceInitFunc)gst_gnomevfssink_init,
|
||||
};
|
||||
gnomevfssink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstGnomeVFSSink", &gnomevfssink_info, 0);
|
||||
}
|
||||
return gnomevfssink_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_gnomevfssink_class_init (GstGnomeVFSSinkClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = (GObjectClass*)klass;
|
||||
gstelement_class = (GstElementClass*)klass;
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
|
||||
gst_element_install_std_props (
|
||||
GST_ELEMENT_CLASS (klass),
|
||||
"location", ARG_LOCATION, G_PARAM_READWRITE,
|
||||
NULL);
|
||||
|
||||
gst_gnomevfssink_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstGnomeVFSSinkClass, handoff), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
|
||||
gst_gnomevfssink_signals[SIGNAL_ERASE_ASK] =
|
||||
g_signal_new ("erase-ask", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstGnomeVFSSinkClass, erase_ask), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
|
||||
|
||||
gobject_class->set_property = gst_gnomevfssink_set_property;
|
||||
gobject_class->get_property = gst_gnomevfssink_get_property;
|
||||
|
||||
gstelement_class->change_state = gst_gnomevfssink_change_state;
|
||||
|
||||
/* gnome vfs engine init */
|
||||
if (gnome_vfs_initialized() == FALSE)
|
||||
gnome_vfs_init();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_gnomevfssink_init (GstGnomeVFSSink *gnomevfssink)
|
||||
{
|
||||
GstPad *pad;
|
||||
pad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (gnomevfssink), pad);
|
||||
gst_pad_set_chain_function (pad, gst_gnomevfssink_chain);
|
||||
|
||||
gnomevfssink->filename = NULL;
|
||||
gnomevfssink->uri = NULL;
|
||||
gnomevfssink->handle = NULL;
|
||||
gnomevfssink->erase = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_gnomevfssink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstGnomeVFSSink *sink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
sink = GST_GNOMEVFSSINK (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_LOCATION:
|
||||
if (sink->filename)
|
||||
g_free (sink->filename);
|
||||
if (sink->uri)
|
||||
g_free (sink->uri);
|
||||
if (sink->handle)
|
||||
g_free (sink->handle);
|
||||
sink->filename = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
case ARG_ERASE:
|
||||
sink->erase = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_gnomevfssink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstGnomeVFSSink *sink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_GNOMEVFSSINK (object));
|
||||
|
||||
sink = GST_GNOMEVFSSINK (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_LOCATION:
|
||||
g_value_set_string (value, sink->filename);
|
||||
break;
|
||||
case ARG_ERASE:
|
||||
g_value_set_boolean (value, sink->erase);
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_gnomevfssink_open_file (GstGnomeVFSSink *sink)
|
||||
{
|
||||
GnomeVFSResult result;
|
||||
|
||||
g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_GNOMEVFSSINK_OPEN), FALSE);
|
||||
|
||||
/* create the GnomeVFSURI from the url */
|
||||
sink->uri = gnome_vfs_uri_new(sink->filename);
|
||||
if (!sink->uri) {
|
||||
perror ("open");
|
||||
gst_element_error (GST_ELEMENT (sink), g_strconcat("opening file \"", sink->filename, "\"", NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* open the file */
|
||||
result = gnome_vfs_create_uri(&(sink->handle), sink->uri,
|
||||
GNOME_VFS_OPEN_WRITE, sink->erase,
|
||||
GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE
|
||||
| GNOME_VFS_PERM_GROUP_READ);
|
||||
GST_DEBUG (0, "open: %s\n", gnome_vfs_result_to_string(result));
|
||||
if (result != GNOME_VFS_OK) {
|
||||
if (sink->erase == FALSE) {
|
||||
g_signal_emit (G_OBJECT (sink),
|
||||
gst_gnomevfssink_signals[SIGNAL_ERASE_ASK], 0,
|
||||
sink->erase);
|
||||
}
|
||||
perror ("open");
|
||||
gst_element_error (GST_ELEMENT (sink), g_strconcat("opening file \"", sink->filename, "\"", NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_FLAG_SET (sink, GST_GNOMEVFSSINK_OPEN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_gnomevfssink_close_file (GstGnomeVFSSink *sink)
|
||||
{
|
||||
GnomeVFSResult result;
|
||||
|
||||
g_return_if_fail (GST_FLAG_IS_SET (sink, GST_GNOMEVFSSINK_OPEN));
|
||||
|
||||
/* close the file */
|
||||
result = gnome_vfs_close(sink->handle);
|
||||
|
||||
/* zero out the handle */
|
||||
if (sink->handle)
|
||||
g_free (sink->handle);
|
||||
|
||||
if (result != GNOME_VFS_OK)
|
||||
{
|
||||
perror ("close");
|
||||
gst_element_error (GST_ELEMENT (sink), g_strconcat("closing file \"", sink->filename, "\"", NULL));
|
||||
}
|
||||
else {
|
||||
GST_FLAG_UNSET (sink, GST_GNOMEVFSSINK_OPEN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gnomevfssink_chain:
|
||||
* @pad: the pad this gnomevfssink is connected to
|
||||
* @buf: the buffer that has to be absorbed
|
||||
*
|
||||
* take the buffer from the pad and write to file if it's open
|
||||
*/
|
||||
static void
|
||||
gst_gnomevfssink_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstGnomeVFSSink *sink;
|
||||
GnomeVFSResult result;
|
||||
GnomeVFSFileSize bytes_written;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (buf != NULL);
|
||||
|
||||
sink = GST_GNOMEVFSSINK (gst_pad_get_parent (pad));
|
||||
|
||||
if (GST_FLAG_IS_SET (sink, GST_GNOMEVFSSINK_OPEN))
|
||||
{
|
||||
result = gnome_vfs_write(sink->handle, GST_BUFFER_DATA(buf), GST_BUFFER_SIZE (buf), &bytes_written);
|
||||
GST_DEBUG (0, "write: %s, written_bytes: %Lu\n", gnome_vfs_result_to_string(result), bytes_written);
|
||||
if (bytes_written < GST_BUFFER_SIZE (buf))
|
||||
{
|
||||
printf ("gnomevfssink : Warning : %d bytes should be written, only %Lu bytes written\n",
|
||||
GST_BUFFER_SIZE (buf), bytes_written);
|
||||
}
|
||||
}
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
g_signal_emit (G_OBJECT (sink), gst_gnomevfssink_signals[SIGNAL_HANDOFF], 0,
|
||||
sink);
|
||||
}
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_gnomevfssink_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_GNOMEVFSSINK (element), GST_STATE_FAILURE);
|
||||
|
||||
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
||||
if (GST_FLAG_IS_SET (element, GST_GNOMEVFSSINK_OPEN))
|
||||
gst_gnomevfssink_close_file (GST_GNOMEVFSSINK (element));
|
||||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_GNOMEVFSSINK_OPEN)) {
|
||||
if (!gst_gnomevfssink_open_file (GST_GNOMEVFSSINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||
|
||||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
|
||||
/* create an elementfactory for the aasink element */
|
||||
factory = gst_elementfactory_new("gnomevfssink", GST_TYPE_GNOMEVFSSINK,
|
||||
&gst_gnomevfssink_details);
|
||||
g_return_val_if_fail(factory != NULL, FALSE);
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GstPluginDesc plugin_desc = {
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gnomevfssink",
|
||||
plugin_init
|
||||
};
|
578
ext/gnomevfs/gstgnomevfssrc.c
Normal file
578
ext/gnomevfs/gstgnomevfssrc.c
Normal file
|
@ -0,0 +1,578 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
* 2001 Bastien Nocera <hadess@hadess.net>
|
||||
*
|
||||
* gnomevfssrc.c:
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define BROKEN_SIG 1
|
||||
/*#undef BROKEN_SIG */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
|
||||
GstElementDetails gst_gnomevfssrc_details;
|
||||
|
||||
#define GST_TYPE_GNOMEVFSSRC \
|
||||
(gst_gnomevfssrc_get_type())
|
||||
#define GST_GNOMEVFSSRC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GNOMEVFSSRC,GstGnomeVFSSrc))
|
||||
#define GST_GNOMEVFSSRC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GNOMEVFSSRC,GstGnomeVFSSrcClass))
|
||||
#define GST_IS_GNOMEVFSSRC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GNOMEVFSSRC))
|
||||
#define GST_IS_GNOMEVFSSRC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GNOMEVFSSRC))
|
||||
|
||||
typedef enum {
|
||||
GST_GNOMEVFSSRC_OPEN = GST_ELEMENT_FLAG_LAST,
|
||||
|
||||
GST_GNOMEVFSSRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
|
||||
} GstGnomeVFSSrcFlags;
|
||||
|
||||
typedef struct _GstGnomeVFSSrc GstGnomeVFSSrc;
|
||||
typedef struct _GstGnomeVFSSrcClass GstGnomeVFSSrcClass;
|
||||
|
||||
struct _GstGnomeVFSSrc {
|
||||
GstElement element;
|
||||
/* pads */
|
||||
GstPad *srcpad;
|
||||
|
||||
/* filename */
|
||||
gchar *filename;
|
||||
/* is it a local file ? */
|
||||
gboolean is_local;
|
||||
/* uri */
|
||||
GnomeVFSURI *uri;
|
||||
|
||||
/* handle */
|
||||
GnomeVFSHandle *handle;
|
||||
|
||||
/* local filename */
|
||||
gchar *local_name;
|
||||
/* fd for local file fallback */
|
||||
gint fd;
|
||||
/* mmap */
|
||||
guchar *map; /* where the file is mapped to */
|
||||
|
||||
/* details for fallback synchronous read */
|
||||
GnomeVFSFileSize size;
|
||||
GnomeVFSFileOffset curoffset; /* current offset in file */
|
||||
gulong bytes_per_read; /* bytes per read */
|
||||
gboolean new_seek;
|
||||
};
|
||||
|
||||
struct _GstGnomeVFSSrcClass {
|
||||
GstElementClass parent_class;
|
||||
#ifdef BROKEN_SIG
|
||||
void (*eos_hack) (GstGnomeVFSSrc * src);
|
||||
#endif
|
||||
};
|
||||
|
||||
GstElementDetails gst_gnomevfssrc_details = {
|
||||
"GnomeVFS Source",
|
||||
"Source/File",
|
||||
"Read from any GnomeVFS file",
|
||||
VERSION,
|
||||
"Bastien Nocera <hadess@hadess.net>",
|
||||
"(C) 2001",
|
||||
};
|
||||
|
||||
/* GnomeVFSSrc signals and args */
|
||||
enum {
|
||||
#ifdef BROKEN_SIG
|
||||
EOS_HACK,
|
||||
#endif
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_LOCATION,
|
||||
ARG_BYTESPERREAD,
|
||||
ARG_OFFSET,
|
||||
ARG_FILESIZE,
|
||||
};
|
||||
|
||||
GType gst_gnomevfssrc_get_type(void);
|
||||
|
||||
static void gst_gnomevfssrc_class_init(GstGnomeVFSSrcClass *klass);
|
||||
static void gst_gnomevfssrc_init(GstGnomeVFSSrc *gnomevfssrc);
|
||||
|
||||
static void gst_gnomevfssrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_gnomevfssrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
static GstBuffer *gst_gnomevfssrc_get(GstPad *pad);
|
||||
|
||||
static GstElementStateReturn gst_gnomevfssrc_change_state(GstElement *element);
|
||||
|
||||
static void gst_gnomevfssrc_close_file(GstGnomeVFSSrc *src);
|
||||
static gboolean gst_gnomevfssrc_open_file(GstGnomeVFSSrc *src);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
#ifdef BROKEN_SIG
|
||||
static guint gst_gnomevfssrc_signals[LAST_SIGNAL] = { 0 };
|
||||
#endif
|
||||
|
||||
GType gst_gnomevfssrc_get_type(void)
|
||||
{
|
||||
static GType gnomevfssrc_type = 0;
|
||||
|
||||
if (!gnomevfssrc_type) {
|
||||
static const GTypeInfo gnomevfssrc_info = {
|
||||
sizeof(GstGnomeVFSSrcClass), NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_gnomevfssrc_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GstGnomeVFSSrc),
|
||||
0,
|
||||
(GInstanceInitFunc) gst_gnomevfssrc_init,
|
||||
};
|
||||
gnomevfssrc_type =
|
||||
g_type_register_static(GST_TYPE_ELEMENT, "GstGnomeVFSSrc", &gnomevfssrc_info, 0);
|
||||
}
|
||||
return gnomevfssrc_type;
|
||||
}
|
||||
|
||||
static void gst_gnomevfssrc_class_init(GstGnomeVFSSrcClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||
|
||||
gst_element_install_std_props (
|
||||
GST_ELEMENT_CLASS (klass),
|
||||
"offset", ARG_OFFSET, G_PARAM_READWRITE,
|
||||
"filesize", ARG_FILESIZE, G_PARAM_READABLE,
|
||||
"bytesperread", ARG_BYTESPERREAD, G_PARAM_READWRITE,
|
||||
"location", ARG_LOCATION, G_PARAM_READWRITE,
|
||||
NULL);
|
||||
|
||||
#ifdef BROKEN_SIG
|
||||
gst_gnomevfssrc_signals[EOS_HACK] =
|
||||
g_signal_new("eos-hack", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GstGnomeVFSSrcClass, eos_hack), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,0);
|
||||
|
||||
#endif /* BROKEN_SIG */
|
||||
|
||||
/*FIXME was for the old cothread scheduling code */
|
||||
/* gobject_class->set_property = gst_gnomevfssrc_set_property; */
|
||||
/* gobject_class->get_property = gst_gnomevfssrc_get_property; */
|
||||
gstelement_class->set_property = gst_gnomevfssrc_set_property;
|
||||
gstelement_class->get_property = gst_gnomevfssrc_get_property;
|
||||
|
||||
gstelement_class->change_state = gst_gnomevfssrc_change_state;
|
||||
|
||||
/* gnome vfs engine init */
|
||||
if (gnome_vfs_initialized() == FALSE)
|
||||
gnome_vfs_init();
|
||||
}
|
||||
|
||||
static void gst_gnomevfssrc_init(GstGnomeVFSSrc *gnomevfssrc)
|
||||
{
|
||||
/* GST_FLAG_SET (gnomevfssrc, GST_SRC_); */
|
||||
|
||||
gnomevfssrc->srcpad = gst_pad_new("src", GST_PAD_SRC);
|
||||
gst_pad_set_get_function(gnomevfssrc->srcpad, gst_gnomevfssrc_get);
|
||||
gst_element_add_pad(GST_ELEMENT(gnomevfssrc), gnomevfssrc->srcpad);
|
||||
|
||||
gnomevfssrc->filename = NULL;
|
||||
gnomevfssrc->is_local = FALSE;
|
||||
gnomevfssrc->uri = NULL;
|
||||
gnomevfssrc->handle = NULL;
|
||||
gnomevfssrc->fd = 0;
|
||||
gnomevfssrc->curoffset = 0;
|
||||
gnomevfssrc->bytes_per_read = 4096;
|
||||
gnomevfssrc->new_seek = FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void gst_gnomevfssrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstGnomeVFSSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail(GST_IS_GNOMEVFSSRC(object));
|
||||
|
||||
src = GST_GNOMEVFSSRC(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_LOCATION:
|
||||
/* the element must be stopped or paused in order to do this */
|
||||
g_return_if_fail((GST_STATE(src) < GST_STATE_PLAYING)
|
||||
|| (GST_STATE(src) == GST_STATE_PAUSED));
|
||||
|
||||
if (src->filename)
|
||||
g_free(src->filename);
|
||||
|
||||
/* clear the filename if we get a NULL (is that possible?) */
|
||||
if (g_value_get_string (value) == NULL) {
|
||||
gst_element_set_state(GST_ELEMENT(object),
|
||||
GST_STATE_NULL);
|
||||
src->filename = NULL;
|
||||
} else {
|
||||
/* otherwise set the new filename */
|
||||
src->filename = g_strdup(g_value_get_string (value));
|
||||
}
|
||||
|
||||
if ((GST_STATE(src) == GST_STATE_PAUSED)
|
||||
&& (src->filename != NULL)) {
|
||||
gst_gnomevfssrc_close_file(src);
|
||||
gst_gnomevfssrc_open_file(src);
|
||||
}
|
||||
break;
|
||||
case ARG_BYTESPERREAD:
|
||||
src->bytes_per_read = g_value_get_int (value);
|
||||
break;
|
||||
case ARG_OFFSET:
|
||||
src->curoffset = g_value_get_long (value);
|
||||
src->new_seek = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void gst_gnomevfssrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstGnomeVFSSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail(GST_IS_GNOMEVFSSRC(object));
|
||||
|
||||
src = GST_GNOMEVFSSRC(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_LOCATION:
|
||||
g_value_set_string (value, src->filename);
|
||||
break;
|
||||
case ARG_BYTESPERREAD:
|
||||
g_value_set_int (value, src->bytes_per_read);
|
||||
break;
|
||||
case ARG_OFFSET:
|
||||
g_value_set_long (value, src->curoffset);
|
||||
break;
|
||||
case ARG_FILESIZE:
|
||||
g_value_set_long (value, src->size);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gnomevfssrc_get:
|
||||
* @pad: #GstPad to push a buffer from
|
||||
*
|
||||
* Push a new buffer from the gnomevfssrc at the current offset.
|
||||
*/
|
||||
static GstBuffer *gst_gnomevfssrc_get(GstPad *pad)
|
||||
{
|
||||
GstGnomeVFSSrc *src;
|
||||
GnomeVFSResult result = 0;
|
||||
GstBuffer *buf;
|
||||
GnomeVFSFileSize readbytes;
|
||||
|
||||
g_return_val_if_fail(pad != NULL, NULL);
|
||||
src = GST_GNOMEVFSSRC(gst_pad_get_parent(pad));
|
||||
g_return_val_if_fail(GST_FLAG_IS_SET(src, GST_GNOMEVFSSRC_OPEN),
|
||||
NULL);
|
||||
|
||||
/* deal with EOF state */
|
||||
if ((src->curoffset >= src->size) && (src->size != 0))
|
||||
{
|
||||
#ifdef BROKEN_SIG
|
||||
g_signal_emit(G_OBJECT(src),
|
||||
gst_gnomevfssrc_signals[EOS_HACK], 0);
|
||||
#endif /* BROKEN_SIG */
|
||||
/*gst_pad_set_eos (pad); */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* create the buffer */
|
||||
/* FIXME: should eventually use a bufferpool for this */
|
||||
buf = gst_buffer_new();
|
||||
g_return_val_if_fail(buf, NULL);
|
||||
|
||||
/* read it in from the file */
|
||||
if (src->is_local)
|
||||
{
|
||||
/* simply set the buffer to point to the correct region of the
|
||||
* file */
|
||||
GST_BUFFER_DATA (buf) = src->map + src->curoffset;
|
||||
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
|
||||
|
||||
if ((src->curoffset + src->bytes_per_read) > src->size)
|
||||
{
|
||||
GST_BUFFER_SIZE (buf) = src->size - src->curoffset;
|
||||
/* set the buffer's EOF bit here */
|
||||
#ifdef BROKEN_SIG
|
||||
g_signal_emit(G_OBJECT(src),
|
||||
gst_gnomevfssrc_signals[EOS_HACK], 0);
|
||||
#endif /* BROKEN_SIG */
|
||||
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_EOS);
|
||||
} else {
|
||||
GST_BUFFER_SIZE (buf) = src->bytes_per_read;
|
||||
}
|
||||
|
||||
src->curoffset += GST_BUFFER_SIZE (buf);
|
||||
|
||||
if (src->new_seek)
|
||||
{
|
||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
|
||||
GST_DEBUG (0,"new seek\n");
|
||||
src->new_seek = FALSE;
|
||||
}
|
||||
} else {
|
||||
/* allocate the space for the buffer data */
|
||||
GST_BUFFER_DATA(buf) = g_malloc(src->bytes_per_read);
|
||||
g_return_val_if_fail(GST_BUFFER_DATA(buf) != NULL, NULL);
|
||||
|
||||
if (src->new_seek)
|
||||
{
|
||||
result = gnome_vfs_seek(src->handle,
|
||||
GNOME_VFS_SEEK_START, src->curoffset);
|
||||
GST_DEBUG(0, "new_seek: %s\n",
|
||||
gnome_vfs_result_to_string(result));
|
||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
|
||||
src->new_seek = FALSE;
|
||||
}
|
||||
|
||||
result = gnome_vfs_read(src->handle, GST_BUFFER_DATA(buf),
|
||||
src->bytes_per_read, &readbytes);
|
||||
|
||||
GST_DEBUG(0, "read: %s, readbytes: %Lu\n",
|
||||
gnome_vfs_result_to_string(result), readbytes);
|
||||
/* deal with EOS */
|
||||
if (readbytes == 0)
|
||||
{
|
||||
gst_buffer_unref(buf);
|
||||
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_EOS);
|
||||
gst_element_signal_eos(GST_ELEMENT(src));
|
||||
#ifdef BROKEN_SIG
|
||||
g_signal_emit(G_OBJECT(src),
|
||||
gst_gnomevfssrc_signals[EOS_HACK], 0);
|
||||
#endif /* BROKEN_SIG */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* if we didn't get as many bytes as we asked for, we're at
|
||||
* EOF */
|
||||
if (readbytes < src->bytes_per_read)
|
||||
{
|
||||
/* set the buffer's EOF bit here */
|
||||
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_EOS);
|
||||
#ifdef BROKEN_SIG
|
||||
g_signal_emit(G_OBJECT(src),
|
||||
gst_gnomevfssrc_signals[EOS_HACK], 0);
|
||||
#endif /* BROKEN_SIG */
|
||||
}
|
||||
GST_BUFFER_OFFSET(buf) = src->curoffset;
|
||||
GST_BUFFER_SIZE(buf) = readbytes;
|
||||
src->curoffset += readbytes;
|
||||
|
||||
}
|
||||
|
||||
/* we're done, return the buffer */
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* open the file and mmap it, necessary to go to READY state */
|
||||
static gboolean gst_gnomevfssrc_open_file(GstGnomeVFSSrc *src)
|
||||
{
|
||||
GnomeVFSResult result;
|
||||
|
||||
g_return_val_if_fail(!GST_FLAG_IS_SET(src, GST_GNOMEVFSSRC_OPEN),
|
||||
FALSE);
|
||||
|
||||
/* create the uri */
|
||||
src->uri = gnome_vfs_uri_new(src->filename);
|
||||
if (!src->uri) {
|
||||
perror("open");
|
||||
gst_element_error(GST_ELEMENT(src),
|
||||
g_strconcat("creating uri \"",
|
||||
src->filename, "\"", NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* open the file using open() if the file is local */
|
||||
src->is_local = gnome_vfs_uri_is_local(src->uri);
|
||||
|
||||
if (src->is_local) {
|
||||
src->local_name =
|
||||
gnome_vfs_get_local_path_from_uri(src->filename);
|
||||
src->fd = open(src->local_name, O_RDONLY);
|
||||
if (src->fd < 0)
|
||||
{
|
||||
perror("open");
|
||||
gst_element_error(GST_ELEMENT(src),
|
||||
g_strconcat("opening local file \"",
|
||||
src->filename, "\"",
|
||||
NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* find the file length */
|
||||
src->size = lseek (src->fd, 0, SEEK_END);
|
||||
lseek (src->fd, 0, SEEK_SET);
|
||||
src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED,
|
||||
src->fd, 0);
|
||||
madvise (src->map,src->size, 2);
|
||||
/* collapse state if that failed */
|
||||
if (src->map == NULL)
|
||||
{
|
||||
gst_gnomevfssrc_close_file(src);
|
||||
gst_element_error (GST_ELEMENT (src),"mmapping file");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
src->new_seek = TRUE;
|
||||
} else {
|
||||
result =
|
||||
gnome_vfs_open_uri(&(src->handle), src->uri,
|
||||
GNOME_VFS_OPEN_READ);
|
||||
if (result != GNOME_VFS_OK)
|
||||
{
|
||||
perror("open");
|
||||
gst_element_error(GST_ELEMENT(src),
|
||||
g_strconcat("opening vfs file \"",
|
||||
src->filename, "\": ",
|
||||
gnome_vfs_result_to_string(result),
|
||||
NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* find the file length */
|
||||
{
|
||||
GnomeVFSResult size_result;
|
||||
GnomeVFSFileInfo *info;
|
||||
|
||||
info = gnome_vfs_file_info_new ();
|
||||
size_result = gnome_vfs_get_file_info_uri(src->uri,
|
||||
info, GNOME_VFS_FILE_INFO_DEFAULT);
|
||||
|
||||
if (size_result != GNOME_VFS_OK)
|
||||
src->size = 0;
|
||||
else
|
||||
src->size = info->size;
|
||||
|
||||
gnome_vfs_file_info_unref(info);
|
||||
}
|
||||
|
||||
GST_DEBUG(0, "open %s\n", gnome_vfs_result_to_string(result));
|
||||
}
|
||||
|
||||
GST_FLAG_SET(src, GST_GNOMEVFSSRC_OPEN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* unmap and close the file */
|
||||
static void gst_gnomevfssrc_close_file(GstGnomeVFSSrc *src)
|
||||
{
|
||||
g_return_if_fail(GST_FLAG_IS_SET(src, GST_GNOMEVFSSRC_OPEN));
|
||||
|
||||
/* close the file */
|
||||
if (src->is_local)
|
||||
{
|
||||
/* unmap the file from memory */
|
||||
munmap (src->map, src->size);
|
||||
close(src->fd);
|
||||
} else {
|
||||
gnome_vfs_close(src->handle);
|
||||
}
|
||||
|
||||
/* zero out a lot of our state */
|
||||
src->is_local = FALSE;
|
||||
if (src->uri)
|
||||
g_free(src->uri);
|
||||
if (src->handle)
|
||||
g_free(src->handle);
|
||||
if (src->local_name)
|
||||
g_free(src->local_name);
|
||||
src->fd = 0;
|
||||
src->map = NULL;
|
||||
src->size = 0;
|
||||
src->curoffset = 0;
|
||||
src->new_seek = FALSE;
|
||||
|
||||
GST_FLAG_UNSET(src, GST_GNOMEVFSSRC_OPEN);
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_gnomevfssrc_change_state(GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail(GST_IS_GNOMEVFSSRC(element),
|
||||
GST_STATE_FAILURE);
|
||||
|
||||
if (GST_STATE_TRANSITION(element) == GST_STATE_NULL_TO_READY) {
|
||||
if (!GST_FLAG_IS_SET(element, GST_GNOMEVFSSRC_OPEN)) {
|
||||
if (!gst_gnomevfssrc_open_file
|
||||
(GST_GNOMEVFSSRC(element)))
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
} else if (GST_STATE_TRANSITION(element) ==
|
||||
GST_STATE_READY_TO_NULL) {
|
||||
if (GST_FLAG_IS_SET(element, GST_GNOMEVFSSRC_OPEN))
|
||||
gst_gnomevfssrc_close_file(GST_GNOMEVFSSRC
|
||||
(element));
|
||||
}
|
||||
|
||||
if (GST_ELEMENT_CLASS(parent_class)->change_state)
|
||||
return GST_ELEMENT_CLASS(parent_class)->
|
||||
change_state(element);
|
||||
|
||||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
static gboolean plugin_init(GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
|
||||
/* create an elementfactory for the aasink element */
|
||||
factory =
|
||||
gst_elementfactory_new("gnomevfssrc", GST_TYPE_GNOMEVFSSRC,
|
||||
&gst_gnomevfssrc_details);
|
||||
g_return_val_if_fail(factory != NULL, FALSE);
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GstPluginDesc plugin_desc = {
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gnomevfssrc",
|
||||
plugin_init
|
||||
};
|
Loading…
Reference in a new issue