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__
|
|
|
|
|
2000-12-19 13:41:55 +00:00
|
|
|
#include <gst/gstcaps.h>
|
2001-08-21 20:16:48 +00:00
|
|
|
#include <gst/gstpluginfeature.h>
|
2003-10-01 13:11:45 +00:00
|
|
|
#include <gst/gstbytestream.h>
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-07-08 19:07:30 +00:00
|
|
|
G_BEGIN_DECLS
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* type of function used to check a stream for equality with type */
|
2003-10-01 13:11:45 +00:00
|
|
|
typedef GstCaps* (*GstTypeFindFunc) (GstByteStream *bs, 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 */
|
2003-10-07 21:58:42 +00:00
|
|
|
|
|
|
|
GST_STRUCT_PADDING
|
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-12-19 21:31:03 +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_IS_TYPE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TYPE_FACTORY))
|
|
|
|
#define GST_TYPE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TYPE_FACTORY, GstTypeFactoryClass))
|
|
|
|
#define GST_IS_TYPE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FACTORY))
|
|
|
|
#define GST_TYPE_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FACTORY, GstTypeFactoryClass))
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
struct _GstTypeFactory {
|
2002-12-19 21:31:03 +00:00
|
|
|
GstPluginFeature feature;
|
2001-08-21 20:16:48 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
gchar *mime;
|
|
|
|
gchar *exts;
|
|
|
|
GstTypeFindFunc typefindfunc;
|
|
|
|
|
2003-10-07 21:58:42 +00:00
|
|
|
GST_OBJECT_PADDING
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2001-08-21 20:16:48 +00:00
|
|
|
struct _GstTypeFactoryClass {
|
|
|
|
GstPluginFeatureClass parent;
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2003-10-07 21:58:42 +00:00
|
|
|
GST_CLASS_PADDING
|
2001-08-21 20:16:48 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2003-10-01 13:11:45 +00:00
|
|
|
/* dummy typefind function */
|
|
|
|
GstCaps* gst_type_type_find_dummy (GstByteStream *bs, gpointer priv);
|
|
|
|
|
2002-07-08 19:07:30 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
#endif /* __GST_TYPE_H__ */
|