Removed the final bits of GstMeta.

Original commit message from CVS:
Removed the final bits of GstMeta.
Added conditional compilation of various subsystems.
This commit is contained in:
Wim Taymans 2001-06-25 20:36:02 +00:00
parent 71beaf9179
commit 6f0bce54fa
15 changed files with 88 additions and 365 deletions

View file

@ -1,5 +1,4 @@
# cheap trick to build . first...
SUBDIRS = . types elements autoplug
lib_LTLIBRARIES = libgst.la
@ -40,8 +39,10 @@ endif
if GST_DISABLE_AUTOPLUG
GST_AUTOPLUG_SRC =
GST_AUTOPLUG_DIRS =
else
GST_AUTOPLUG_SRC = gstautoplug.c
GST_AUTOPLUG_DIRS = autoplug
endif
if GST_DISABLE_TRACE
@ -50,6 +51,8 @@ else
GST_TRACE_SRC = gsttrace.c
endif
SUBDIRS = . types elements $(GST_AUTOPLUG_DIRS)
libgst_la_SOURCES = \
cothreads.c \
gst.c \
@ -66,7 +69,6 @@ libgst_la_SOURCES = \
gstelementfactory.c \
gstextratypes.c \
gstinfo.c \
gstmeta.c \
gstpad.c \
gstpipeline.c \
gstplugin.c \
@ -154,7 +156,6 @@ libgstinclude_HEADERS = \
gstextratypes.h \
gstinfo.h \
gstlog.h \
gstmeta.h \
gstpad.h \
gstpipeline.h \
gstplugin.h \

View file

@ -32,7 +32,9 @@
#include "gstpipeline.h"
#include "gstthread.h"
#include "gstqueue.h"
#ifndef GST_DISABLE_TYPEFIND
#include "gsttypefind.h"
#endif
#define MAX_PATH_SPLIT 16
@ -56,7 +58,9 @@ static gboolean gst_init_check (int *argc, gchar ***argv);
void
gst_init (int *argc, char **argv[])
{
#ifndef GST_DISABLE_TRACE
GstTrace *gst_trace;
#endif
if (!g_thread_supported ()) g_thread_init (NULL);
@ -97,13 +101,17 @@ gst_init (int *argc, char **argv[])
gst_elementfactory_new ("pipeline", gst_pipeline_get_type (), &gst_pipeline_details);
gst_elementfactory_new ("thread", gst_thread_get_type (), &gst_thread_details);
gst_elementfactory_new ("queue", gst_queue_get_type (), &gst_queue_details);
#ifndef GST_DISABLE_TYPEFIND
gst_elementfactory_new ("typefind", gst_typefind_get_type (), &gst_typefind_details);
#endif
#ifndef GST_DISABLE_TRACE
_gst_trace_on = 0;
if (_gst_trace_on) {
gst_trace = gst_trace_new ("gst.trace",1024);
gst_trace_set_default (gst_trace);
}
#endif // GST_DISABLE_TRACE
}
static void

View file

@ -24,6 +24,8 @@
#ifndef __GST_AUTOPLUG_H__
#define __GST_AUTOPLUG_H__
#ifndef GST_DISABLE_AUTOPLUG
#include <gst/gstelement.h>
#ifdef __cplusplus
@ -104,6 +106,26 @@ GstAutoplugFactory* gst_autoplugfactory_load_thyself (xmlNodePtr parent);
}
#endif /* __cplusplus */
#else // GST_DISABLE_AUTOPLUG
#pragma GCC poison gst_autoplug_get_type
#pragma GCC poison gst_autoplug_signal_new_object
#pragma GCC poison gst_autoplug_to_caps
#pragma GCC poison gst_autoplug_to_renderers
#pragma GCC poison gst_autoplugfactory_new
#pragma GCC poison gst_autoplugfactory_destroy
#pragma GCC poison gst_autoplugfactory_find
#pragma GCC poison gst_autoplugfactory_get_list
#pragma GCC poison gst_autoplugfactory_create
#pragma GCC poison gst_autoplugfactory_make
#pragma GCC poison gst_autoplugfactory_save_thyself
#pragma GCC poison gst_autoplugfactory_load_thyself
#endif // GST_DISABLE_AUTOPLUG
#endif /* __GST_AUTOPLUG_H__ */

View file

@ -73,7 +73,6 @@ gst_buffer_new(void)
buffer->maxsize = 0;
buffer->offset = 0;
buffer->timestamp = 0;
// buffer->metas = NULL;
buffer->parent = NULL;
buffer->pool = NULL;
buffer->free = NULL;
@ -142,9 +141,6 @@ gst_buffer_create_sub (GstBuffer *parent,
buffer->timestamp = parent->timestamp;
buffer->maxage = parent->maxage;
// no metas, this is sane I think
// buffer->metas = NULL;
// if the parent buffer is a subbuffer itself, use its parent, a real buffer
if (parent->parent != NULL)
parent = parent->parent;
@ -214,7 +210,6 @@ gst_buffer_append (GstBuffer *buffer,
*/
void gst_buffer_destroy (GstBuffer *buffer)
{
// GSList *metas;
g_return_if_fail (buffer != NULL);
@ -232,16 +227,6 @@ void gst_buffer_destroy (GstBuffer *buffer)
}
}
/* DEPRACATED!!!
// unreference any metadata attached to this buffer
metas = buffer->metas;
while (metas) {
gst_meta_unref ((GstMeta *)(metas->data));
metas = g_slist_next (metas);
}
g_slist_free (buffer->metas);
*/
// unreference the parent if there is one
if (buffer->parent != NULL)
gst_buffer_unref (buffer->parent);
@ -343,88 +328,6 @@ gst_buffer_unref (GstBuffer *buffer)
}
}
/**
* gst_buffer_add_meta:
* @buffer: the GstBuffer to add the metadata to
* @meta: the metadata to add to this buffer
*
* Add the meta data to the buffer.
* DEPRACATED!!!
*/
/* DEPRACATED!!!
void
gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta)
{
g_return_if_fail (buffer != NULL);
g_return_if_fail (meta != NULL);
gst_meta_ref (meta);
buffer->metas = g_slist_append (buffer->metas,meta);
}
*/
/**
* gst_buffer_get_metas:
* @buffer: the GstBuffer to get the metadata from
*
* Get the metadatas from the buffer.
* DEPRACATED!!!
*
* Returns: a GSList of metadata
*/
/* DEPRACATED!!!
GSList*
gst_buffer_get_metas (GstBuffer *buffer)
{
g_return_val_if_fail (buffer != NULL, NULL);
return buffer->metas;
}
*/
/**
* gst_buffer_get_first_meta:
* @buffer: the GstBuffer to get the metadata from
*
* Get the first metadata from the buffer.
* DEPRACATED!!!
*
* Returns: the first metadata from the buffer
*/
/* DEPRACATED!!!
GstMeta*
gst_buffer_get_first_meta (GstBuffer *buffer)
{
g_return_val_if_fail (buffer != NULL, NULL);
if (buffer->metas == NULL)
return NULL;
return GST_META (buffer->metas->data);
}
*/
/**
* gst_buffer_remove_meta:
* @buffer: the GstBuffer to remove the metadata from
* @meta: the metadata to remove
*
* Remove the given metadata from the buffer.
* DEPRACATED!!!
*/
/* DEPRACATED!!!
void
gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta)
{
g_return_if_fail (buffer != NULL);
g_return_if_fail (meta != NULL);
buffer->metas = g_slist_remove (buffer->metas, meta);
gst_meta_unref (meta);
}
*/
/**
* gst_buffer_copy:
* @buffer: the orignal GstBuffer to make a copy of

View file

@ -25,7 +25,6 @@
#define __GST_BUFFER_H__
#include <gst/gstobject.h>
//#include <gst/gstmeta.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -117,9 +116,6 @@ struct _GstBuffer {
/* max age */
guint64 maxage;
/* pointer to metadata, is really lame right now */
// GSList *metas;
/* subbuffer support, who's my parent? */
GstBuffer *parent;
@ -155,14 +151,6 @@ void gst_buffer_destroy (GstBuffer *buffer);
/* copy buffer */
GstBuffer* gst_buffer_copy (GstBuffer *buffer);
/* add, retrieve, and remove metadata from the buffer */
/* DEPRECATED!!!
void gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta);
void gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta);
GstMeta* gst_buffer_get_first_meta (GstBuffer *buffer);
GSList* gst_buffer_get_metas (GstBuffer *buffer);
*/
#ifdef __cplusplus
}
#endif /* __cplusplus */

View file

@ -1,111 +0,0 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstmeta.c: Metadata subsystem for describing buffer 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gst_private.h"
#include "gstmeta.h"
#include "gsttrace.h"
/**
* gst_meta_new_size:
* @size: the size of the new meta data
*
* Create a new metadata object with a given size.
*
* Returns: new meta object
*/
GstMeta*
gst_meta_new_size (gint size)
{
GstMeta *meta;
meta = g_malloc0 (size);
gst_meta_ref (meta);
return meta;
}
/**
* gst_meta_ref:
* @meta: the meta object to ref
*
* Increases the refcount of a meta object.
*/
void
gst_meta_ref (GstMeta *meta)
{
g_return_if_fail (meta != NULL);
gst_trace_add_entry (NULL, 0, meta, "ref meta");
#ifdef HAVE_ATOMIC_H
atomic_inc (&(meta->refcount));
#else
meta->refcount++;
#endif
}
/**
* gst_meta_unref:
* @meta: the meta object to unref
*
* Decreases the refcount of a meta object. If the refcount is zero, the
* meta object is freed.
*/
void
gst_meta_unref (GstMeta *meta)
{
gint zero;
g_return_if_fail (meta != NULL);
gst_trace_add_entry (NULL, 0, meta, "unref meta");
#ifdef HAVE_ATOMIC_H
zero = atomic_dec_and_test (&(meta->refcount));
#else
meta->refcount--;
zero = (meta->refcount == 0);
#endif
if (zero) {
// gst_trace_add_entry(NULL,0,meta,"destroy meta");
g_free (meta);
// g_print("freeing metadata\n");
}
}
/**
* gst_meta_cow:
* @meta: the meta object prepare for write
*
* Prepares a meta object for writing. A copy of the meta
* object is returned if needed.
*
* Returns: the meta object or a copy.
*/
GstMeta*
gst_meta_cow (GstMeta *meta)
{
g_return_val_if_fail (meta != NULL, NULL);
return NULL;
}

View file

@ -1,94 +0,0 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstmeta.h: Header for metadata subsystem
*
* 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.
*/
#ifndef __GST_META_H__
#define __GST_META_H__
#include <glib.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_ATOMIC_H
#include <asm/atomic.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GST_META(meta) ((GstMeta *)(meta))
#define GST_META_FLAGS(meta) \
(GST_META(meta)->flags)
#define GST_META_FLAG_IS_SET(meta,flag) \
(GST_META_FLAGS(meta) & (flag))
#define GST_META_FLAG_SET(meta,flag) \
G_STMT_START{ (GST_META_FLAGS(meta) |= (flag)); }G_STMT_END
#define GST_META_FLAG_UNSET(meta,flag) \
G_STMT_START{ (GST_META_FLAGS(meta) &= ~(flag)); }G_STMT_END
typedef enum {
GST_META_FREEABLE = 1 << 0,
} GstMetaFlags;
typedef struct _GstMeta GstMeta;
struct _GstMeta {
/* locking */
GMutex *lock;
/* refcounting */
#ifdef HAVE_ATOMIC_H
atomic_t refcount;
#else
int refcount;
#endif
guint16 type;
guint16 flags;
void *data;
guint16 size;
};
GstMeta* gst_meta_new_size (gint size);
#define gst_meta_new(type) (type *)gst_meta_new_size(sizeof(type))
/* refcounting */
void gst_meta_ref (GstMeta *meta);
void gst_meta_unref (GstMeta *meta);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GST_BUFFER_H__ */

View file

@ -23,8 +23,16 @@
#ifndef __GST_PARSE_H__
#define __GST_PARSE_H__
#ifndef GST_DISABLE_PARSE
#include <gst/gstbin.h>
gint gst_parse_launch (const gchar *cmdline, GstBin *parent);
#else // GST_DISABLE_PARSE
#pragma GCC poison gst_parse_launch
#endif // GST_DISABLE_PARSE
#endif /* __GST_PARSE_H__ */

View file

@ -438,8 +438,10 @@ gst_plugin_new (const gchar *name, gint major, gint minor)
plugin->numelements = 0;
plugin->types = NULL;
plugin->numtypes = 0;
#ifndef GST_DISABLE_AUTOPLUG
plugin->autopluggers = NULL;
plugin->numautopluggers = 0;
#endif // GST_DISABLE_AUTOPLUG
plugin->loaded = TRUE;
return plugin;
@ -646,6 +648,7 @@ gst_plugin_load_elementfactory (const gchar *name)
return factory;
}
#ifndef GST_DISABLE_AUTOPLUG
static GstAutoplugFactory*
gst_plugin_find_autoplugfactory (const gchar *name)
{
@ -716,6 +719,7 @@ gst_plugin_load_autoplugfactory (const gchar *name)
return factory;
}
#endif // GST_DISABLE_AUTOPLUG
/**
* gst_plugin_load_typefactory:
@ -811,6 +815,7 @@ gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory)
*
* Add an autoplugfactory to the list of those provided by the plugin.
*/
#ifndef GST_DISABLE_AUTOPLUG
void
gst_plugin_add_autoplugger (GstPlugin *plugin, GstAutoplugFactory *factory)
{
@ -821,6 +826,7 @@ gst_plugin_add_autoplugger (GstPlugin *plugin, GstAutoplugFactory *factory)
plugin->autopluggers = g_list_prepend (plugin->autopluggers, factory);
plugin->numautopluggers++;
}
#endif // GST_DISABLE_AUTOPLUG
/**
* gst_plugin_get_list:
@ -876,6 +882,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
elements = g_list_next (elements);
}
#ifndef GST_DISABLE_AUTOPLUG
autopluggers = plugin->autopluggers;
while (autopluggers) {
GstAutoplugFactory *factory = (GstAutoplugFactory *)autopluggers->data;
@ -885,6 +892,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
autopluggers = g_list_next (autopluggers);
}
#endif // GST_DISABLE_AUTOPLUG
plugins = g_list_next (plugins);
}
g_list_free (plugins);
@ -939,11 +947,13 @@ gst_plugin_load_thyself (xmlNodePtr parent)
gst_plugin_add_factory (plugin, factory);
elementcount++;
}
#ifndef GST_DISABLE_AUTOPLUG
else if (!strcmp (field->name, "autoplugfactory")) {
GstAutoplugFactory *factory = gst_autoplugfactory_load_thyself (field);
gst_plugin_add_autoplugger (plugin, factory);
autoplugcount++;
}
#endif // GST_DISABLE_AUTOPLUG
else if (!strcmp (field->name, "typefactory")) {
GstTypeFactory *factory = gst_typefactory_load_thyself (field);
gst_plugin_add_type (plugin, factory);
@ -1006,6 +1016,7 @@ gst_plugin_get_type_list (GstPlugin *plugin)
*
* Returns: a GList of factories
*/
#ifndef GST_DISABLE_AUTOPLUG
GList*
gst_plugin_get_autoplug_list (GstPlugin *plugin)
{
@ -1013,3 +1024,4 @@ gst_plugin_get_autoplug_list (GstPlugin *plugin)
return plugin->autopluggers;
}
#endif // GST_DISABLE_AUTOPLUG

View file

@ -51,8 +51,10 @@ struct _GstPlugin {
gint numtypes;
GList *elements; /* list of elements provided */
gint numelements;
#ifndef GST_DISABLE_AUTOPLUG
GList *autopluggers; /* list of autopluggers provided */
gint numautopluggers;
#endif // GST_DISABLE_AUTOPLUG
gboolean loaded; /* if the plugin is in memory */
};
@ -83,7 +85,11 @@ gboolean gst_plugin_is_loaded (GstPlugin *plugin);
GList* gst_plugin_get_type_list (GstPlugin *plugin);
GList* gst_plugin_get_factory_list (GstPlugin *plugin);
#ifndef GST_DISABLE_AUTOPLUG
GList* gst_plugin_get_autoplug_list (GstPlugin *plugin);
#else
#pragma GCC poison gst_plugin_get_autoplug_list
#endif // GST_DISABLE_AUTOPLUG
void gst_plugin_load_all (void);
gboolean gst_plugin_load (const gchar *name);
@ -92,14 +98,22 @@ gboolean gst_library_load (const gchar *name);
void gst_plugin_add_factory (GstPlugin *plugin, GstElementFactory *factory);
void gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory);
#ifndef GST_DISABLE_AUTOPLUG
void gst_plugin_add_autoplugger (GstPlugin *plugin, GstAutoplugFactory *factory);
#else
#pragma GCC poison gst_plugin_add_autoplugger
#endif // GST_DISABLE_AUTOPLUG
GstPlugin* gst_plugin_find (const gchar *name);
GList* gst_plugin_get_list (void);
GstElementFactory* gst_plugin_load_elementfactory (const gchar *name);
void gst_plugin_load_typefactory (const gchar *mime);
#ifndef GST_DISABLE_AUTOPLUG
GstAutoplugFactory* gst_plugin_load_autoplugfactory (const gchar *name);
#else
#pragma GCC poison gst_plugin_add_autoplugger
#endif // GST_DISABLE_AUTOPLUG
xmlNodePtr gst_plugin_save_thyself (xmlNodePtr parent);
void gst_plugin_load_thyself (xmlNodePtr parent);

View file

@ -24,6 +24,8 @@
#ifndef __GST_TRACE_H__
#define __GST_TRACE_H__
#ifndef GST_DISABLE_TRACE
#include <glib.h>
@ -75,4 +77,20 @@ extern gint _gst_trace_on;
#define gst_trace_add_entry(trace,seq,data,msg)
#endif
#else // GST_DISABLE_TRACE
#pragma GCC poison gst_trace_new
#pragma GCC poison gst_trace_destroy
#pragma GCC poison gst_trace_flush
#pragma GCC poison gst_trace_text_flush
#pragma GCC poison gst_trace_get_size
#pragma GCC poison gst_trace_get_offset
#pragma GCC poison gst_trace_get_remaining
#pragma GCC poison gst_trace_set_default
#pragma GCC poison _gst_trace_add_entry
#pragma GCC poison gst_trace_read_tsc
#pragma GCC poison gst_trace_add_entry
#endif // GST_DISABLE_TRACE
#endif /* __GST_TRACE_H__ */

View file

@ -24,6 +24,7 @@
#ifndef __GST_TYPEFIND_H__
#define __GST_TYPEFIND_H__
#ifndef GST_DISABLE_TYPEFIND
#include <gst/gstelement.h>
@ -70,5 +71,6 @@ GType gst_typefind_get_type (void);
}
#endif /* __cplusplus */
#endif // GST_DISABLE_TYPEFIND
#endif /* __GST_TYPEFIND_H__ */

7
gst/meta/.gitignore vendored
View file

@ -1,7 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs

View file

@ -1,3 +0,0 @@
metaincludedir = $(includedir)/gst/meta
metainclude_HEADERS = \
spectrum.h

View file

@ -1,38 +0,0 @@
/* Gnome-Streamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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/gstmeta.h>
typedef struct _MetaAudioSpectrum MetaAudioSpectrum;
struct _MetaAudioSpectrum {
GstMeta meta;
/* data representation */
gint16 bands; /* how many bands are represented */
gint8 channels; /* how many audio channels are there? */
gboolean interleaved; /* are the channels interleaved? */
/* spectrum details */
gint16 lowfreq;
gint16 highfreq;
gint16 steps;
};