gstelements.c 5.04 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 "gstaggregator.h"
31 32 33 34
#include "gstfakesink.h"
#include "gstfakesrc.h"
#include "gstfdsink.h"
#include "gstfdsrc.h"
35 36 37 38
#include "gstfilesink.h"
#include "gstfilesrc.h"
#include "gstidentity.h"
#include "gstmd5sink.h"
39
#include "gstmultidisksrc.h"
40
#include "gstpipefilter.h"
41
#include "gstshaper.h"
David I. Lehn's avatar
David I. Lehn committed
42
#include "gststatistics.h"
43 44
#include "gsttee.h"
#include "gsttypefindelement.h"
Erik Walthinsen's avatar
Erik Walthinsen committed
45 46 47 48


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

54

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

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

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

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

85
  GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator",	0,	"aggregator element");
86
  GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug,	"fakesink",	0,	"fakesink element");
87 88 89 90
  GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug,	"fakesrc",	0,	"fakesrc element");
  GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug,	"fdsink",	0,	"fdsink element");
  GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug,	"fdsrc",	0,	"fdsrc element");
  GST_DEBUG_CATEGORY_INIT (gst_filesink_debug,	"filesink",	0,	"filesink element");
91 92
  GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug,	"filesrc",	0,	"filesrc element");
  GST_DEBUG_CATEGORY_INIT (gst_identity_debug,	"identity",	0,	"identity element");
93
  GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug,	"md5sink",	0,	"md5sink element");
94 95 96 97
  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_shaper_debug,	"shaper",	0,	"shaper element");
  GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics",	0,	"statistics element");
98 99
  GST_DEBUG_CATEGORY_INIT (gst_tee_debug,	"tee",		0,	"tee element");
  GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug,	"typefind", GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "typefind element");
100 101

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

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

    gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
    if (_elements[i].factoryinit) {
      _elements[i].factoryinit (factory);
Erik Walthinsen's avatar
Erik Walthinsen committed
116
    }
117
/*      g_print("added factory '%s'\n",_elements[i].name); */
Erik Walthinsen's avatar
Erik Walthinsen committed
118 119 120
    i++;
  }

121
/*  INFO (GST_INFO_PLUGIN_LOAD,"gstelements: loaded %d standard elements", i);*/
122
  return TRUE;
Erik Walthinsen's avatar
Erik Walthinsen committed
123
}
124 125 126 127 128 129 130

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