2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gsttype.h: Header for type management
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* 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_TYPE_H__
|
|
|
|
#define __GST_TYPE_H__
|
|
|
|
|
|
|
|
#include <gst/gstbuffer.h>
|
2000-12-19 13:41:55 +00:00
|
|
|
#include <gst/gstcaps.h>
|
2001-08-21 20:16:48 +00:00
|
|
|
#include <gst/gstpluginfeature.h>
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* type of function used to check a stream for equality with type */
|
2001-08-21 20:16:48 +00:00
|
|
|
typedef GstCaps *(*GstTypeFindFunc) (GstBuffer *buf, gpointer priv);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
typedef struct _GstType GstType;
|
2001-08-21 20:16:48 +00:00
|
|
|
typedef struct _GstTypeDefinition GstTypeDefinition;
|
2000-01-30 09:03:00 +00:00
|
|
|
typedef struct _GstTypeFactory GstTypeFactory;
|
2001-08-21 20:16:48 +00:00
|
|
|
typedef struct _GstTypeFactoryClass GstTypeFactoryClass;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
struct _GstType {
|
|
|
|
guint16 id; /* type id (assigned) */
|
|
|
|
|
|
|
|
gchar *mime; /* MIME type */
|
|
|
|
gchar *exts; /* space-delimited list of extensions */
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
GSList *factories; /* factories providing this type */
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
struct _GstTypeDefinition {
|
|
|
|
gchar *name;
|
|
|
|
gchar *mime;
|
|
|
|
gchar *exts;
|
|
|
|
GstTypeFindFunc typefindfunc;
|
|
|
|
};
|
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
#define GST_TYPE_TYPE_FACTORY \
|
|
|
|
(gst_type_factory_get_type())
|
|
|
|
#define GST_TYPE_FACTORY(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TYPE_FACTORY,GstTypeFactory))
|
|
|
|
#define GST_TYPE_FACTORY_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TYPE_FACTORY,GstTypeFactoryClass))
|
|
|
|
#define GST_IS_TYPE_FACTORY(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TYPE_FACTORY))
|
|
|
|
#define GST_IS_TYPE_FACTORY_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TYPE_FACTORY))
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
struct _GstTypeFactory {
|
2001-08-21 20:16:48 +00:00
|
|
|
GstPluginFeature feature;
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
gchar *mime;
|
|
|
|
gchar *exts;
|
|
|
|
GstTypeFindFunc typefindfunc;
|
|
|
|
};
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
struct _GstTypeFactoryClass {
|
|
|
|
GstPluginFeatureClass parent;
|
|
|
|
};
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
GType gst_type_factory_get_type (void);
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
GstTypeFactory* gst_type_factory_new (GstTypeDefinition *definition);
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2002-04-11 20:35:18 +00:00
|
|
|
GstTypeFactory* gst_type_factory_find (const gchar *name);
|
2001-10-24 21:35:47 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* create a new type, or find/merge an existing one */
|
2001-08-21 20:16:48 +00:00
|
|
|
guint16 gst_type_register (GstTypeFactory *factory);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* look up a type by mime or extension */
|
2001-08-21 20:16:48 +00:00
|
|
|
guint16 gst_type_find_by_mime (const gchar *mime);
|
|
|
|
guint16 gst_type_find_by_ext (const gchar *ext);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* get GstType by id */
|
2001-08-21 20:16:48 +00:00
|
|
|
GstType* gst_type_find_by_id (guint16 id);
|
2000-08-21 21:20:38 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/* get the list of registered types (returns list of GstType!) */
|
2002-04-19 19:49:41 +00:00
|
|
|
const GList* gst_type_get_list (void);
|
2000-08-28 20:20:55 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
#endif /* __GST_TYPE_H__ */
|