gstelements.c 4.79 KB
Newer Older
Erik Walthinsen's avatar
Erik Walthinsen committed
1 2 3 4
/* GStreamer
 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
 *                    2000 Wim Taymans <wtay@chello.be>
 *
Wim Taymans's avatar
Wim Taymans committed
5
 * gstelements.c:
Erik Walthinsen's avatar
Erik Walthinsen committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * 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.
 */


24 25 26 27
#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

Erik Walthinsen's avatar
Erik Walthinsen committed
28 29
#include <gst/gst.h>

30
#include "gstfilesrc.h"
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
31
#include "gstfilesink.h"
32 33 34 35 36
#include "gstidentity.h"
#include "gstfakesink.h"
#include "gstfakesrc.h"
#include "gstfdsink.h"
#include "gstfdsrc.h"
37
#include "gstmultidisksrc.h"
38 39
#include "gstpipefilter.h"
#include "gsttee.h"
Wim Taymans's avatar
Wim Taymans committed
40
#include "gstaggregator.h"
41
#include "gstshaper.h"
David I. Lehn's avatar
David I. Lehn committed
42
#include "gststatistics.h"
Benjamin Otte's avatar
Benjamin Otte committed
43
#include "gstmd5sink.h"
Erik Walthinsen's avatar
Erik Walthinsen committed
44 45 46 47


struct _elements_entry {
  gchar *name;
48
  GType (*type) (void);
Erik Walthinsen's avatar
Erik Walthinsen committed
49
  GstElementDetails *details;
50
  gboolean (*factoryinit) (GstElementFactory *factory);
Erik Walthinsen's avatar
Erik Walthinsen committed
51 52
};

53

54
extern GType gst_filesrc_get_type(void);
Wim Taymans's avatar
Wim Taymans committed
55
extern GstElementDetails gst_filesrc_details;
56

Wim Taymans's avatar
Wim Taymans committed
57
static struct _elements_entry _elements[] = {
58
  { "fakesrc", 	    gst_fakesrc_get_type, 	&gst_fakesrc_details,		gst_fakesrc_factory_init },
Wim Taymans's avatar
Wim Taymans committed
59
  { "fakesink",     gst_fakesink_get_type, 	&gst_fakesink_details,		gst_fakesink_factory_init },
60
  { "filesrc", 	    gst_filesrc_get_type, 	&gst_filesrc_details,		NULL },
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
61
  { "filesink",	    gst_filesink_get_type,      &gst_filesink_details, 		NULL },
62 63 64
  { "identity",     gst_identity_get_type,  	&gst_identity_details,		NULL },
  { "fdsink",       gst_fdsink_get_type, 	&gst_fdsink_details,		NULL },
  { "fdsrc", 	    gst_fdsrc_get_type, 	&gst_fdsrc_details,		NULL },
65
  { "multidisksrc", gst_multidisksrc_get_type,	&gst_multidisksrc_details,	NULL },
66 67
  { "pipefilter",   gst_pipefilter_get_type, 	&gst_pipefilter_details,	NULL },
  { "tee",     	    gst_tee_get_type, 		&gst_tee_details,		gst_tee_factory_init },
Wim Taymans's avatar
Wim Taymans committed
68
  { "aggregator",   gst_aggregator_get_type, 	&gst_aggregator_details,	gst_aggregator_factory_init },
69
  { "shaper",       gst_shaper_get_type, 	&gst_shaper_details,		gst_shaper_factory_init },
David I. Lehn's avatar
David I. Lehn committed
70
  { "statistics",   gst_statistics_get_type, 	&gst_statistics_details,	NULL },
Benjamin Otte's avatar
Benjamin Otte committed
71
  { "md5sink",      gst_md5sink_get_type, 	&gst_md5sink_details,		gst_md5sink_factory_init },
Erik Walthinsen's avatar
Erik Walthinsen committed
72 73 74
  { NULL, 0 },
};

75 76
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
Wim Taymans's avatar
Wim Taymans committed
77
{
Erik Walthinsen's avatar
Erik Walthinsen committed
78
  GstElementFactory *factory;
Wim Taymans's avatar
Wim Taymans committed
79
  gint i = 0;
Erik Walthinsen's avatar
Erik Walthinsen committed
80

Wim Taymans's avatar
Wim Taymans committed
81
  gst_plugin_set_longname (plugin, "Standard GST Elements");
Erik Walthinsen's avatar
Erik Walthinsen committed
82

83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
  GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug,	"fakesrc",	0,	"fakesrc element");
  GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug,	"fakesink",	0,	"fakesink element");
  GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug,	"filesrc",	0,	"filesrc element");
  GST_DEBUG_CATEGORY_INIT (gst_filesink_debug,	"fakesink",	0,	"filesink element");
  GST_DEBUG_CATEGORY_INIT (gst_identity_debug,	"identity",	0,	"identity element");
  GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug,	"fdsrc",	0,	"fdsrc element");
  GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug,	"fdsink",	0,	"fdsink element");
  GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0,	"multidisksrc element");
  GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter",	0,	"pipefilter element");
  GST_DEBUG_CATEGORY_INIT (gst_tee_debug,	"tee",		0,	"tee element");
  GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator",	0,	"aggregator element");
  GST_DEBUG_CATEGORY_INIT (gst_shaper_debug,	"shaper",	0,	"shaper element");
  GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics",	0,	"statistics element");
  GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug,	"md5sink",	0,	"md5sink element");

  while (_elements[i].name) {  
99
    factory = gst_element_factory_new (_elements[i].name,
Wim Taymans's avatar
Wim Taymans committed
100 101
                                      (_elements[i].type) (),
                                      _elements[i].details);
Joshua N. Pritikin's avatar
Joshua N. Pritikin committed
102 103 104

    if (!factory)
      {
105
	g_warning ("gst_element_factory_new failed for `%s'",
Joshua N. Pritikin's avatar
Joshua N. Pritikin committed
106 107
		   _elements[i].name);
	continue;
108
      }
Joshua N. Pritikin's avatar
Joshua N. Pritikin committed
109 110 111 112

    gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
    if (_elements[i].factoryinit) {
      _elements[i].factoryinit (factory);
Erik Walthinsen's avatar
Erik Walthinsen committed
113
    }
114
/*      g_print("added factory '%s'\n",_elements[i].name); */
Joshua N. Pritikin's avatar
Joshua N. Pritikin committed
115

Erik Walthinsen's avatar
Erik Walthinsen committed
116 117 118
    i++;
  }

119
/*  INFO (GST_INFO_PLUGIN_LOAD,"gstelements: loaded %d standard elements", i);*/
Erik Walthinsen's avatar
Erik Walthinsen committed
120

121
  return TRUE;
Erik Walthinsen's avatar
Erik Walthinsen committed
122
}
123 124 125 126 127 128 129

GstPluginDesc plugin_desc = {
  GST_VERSION_MAJOR,
  GST_VERSION_MINOR,
  "gstelements",
  plugin_init
};