gstelements.c 3.35 KB
Newer Older
Erik Walthinsen's avatar
Erik Walthinsen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
/* 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/gst.h>

#include <gstasyncdisksrc.h>
#include <gstaudiosink.h>
#include <gstaudiosrc.h>
#include <gstdisksrc.h>
#include <gstidentity.h>
#include <gstfakesink.h>
#include <gstfakesrc.h>
#include <gstfdsink.h>
#include <gstfdsrc.h>
32
#include <gstpipefilter.h>
Erik Walthinsen's avatar
Erik Walthinsen committed
33 34
#include <gstqueue.h>
#include <gstsinesrc.h>
35
#include <gsttypefind.h>
Erik Walthinsen's avatar
Erik Walthinsen committed
36

37 38 39 40
#if HAVE_LIBGHTTP
#include <gsthttpsrc.h>
#endif /* HAVE_LIBGHTTP */

Erik Walthinsen's avatar
Erik Walthinsen committed
41 42 43 44 45

struct _elements_entry {
  gchar *name;
  GtkType (*type) (void);
  GstElementDetails *details;
46
  gboolean (*factoryinit) (GstElementFactory *factory);
Erik Walthinsen's avatar
Erik Walthinsen committed
47 48
};

Wim Taymans's avatar
Wim Taymans committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62
static struct _elements_entry _elements[] = {
  { "fakesrc", 	    gst_fakesrc_get_type, 	&gst_fakesrc_details,      NULL },
  { "fakesink",     gst_fakesink_get_type, 	&gst_fakesink_details,     NULL },
  { "asyncdisksrc", gst_asyncdisksrc_get_type, 	&gst_asyncdisksrc_details, NULL },
  { "audiosink",    gst_audiosink_get_type, 	&gst_audiosink_details,    gst_audiosink_factory_init },
  { "audiosrc",     gst_audiosrc_get_type, 	&gst_audiosrc_details, 	   NULL },
  { "disksrc", 	    gst_disksrc_get_type, 	&gst_disksrc_details,      NULL },
  { "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 },
  { "pipefilter",   gst_pipefilter_get_type, 	&gst_pipefilter_details,   NULL },
  { "queue", 	    gst_queue_get_type, 	&gst_queue_details,        NULL },
  { "sinesrc", 	    gst_sinesrc_get_type, 	&gst_sinesrc_details,      NULL },
  { "typefind",     gst_typefind_get_type, 	&gst_typefind_details,     NULL },
63 64 65 66

#if HAVE_LIBGHTTP
  { "httpsrc", 	    gst_httpsrc_get_type, 	&gst_httpsrc_details,      NULL },
#endif /* HAVE_LIBGHTTP */
Wim Taymans's avatar
Wim Taymans committed
67
  
Erik Walthinsen's avatar
Erik Walthinsen committed
68 69 70
  { NULL, 0 },
};

Wim Taymans's avatar
Wim Taymans committed
71 72
GstPlugin *plugin_init (GModule *module) 
{
Erik Walthinsen's avatar
Erik Walthinsen committed
73 74
  GstPlugin *plugin;
  GstElementFactory *factory;
Wim Taymans's avatar
Wim Taymans committed
75
  gint i = 0;
Erik Walthinsen's avatar
Erik Walthinsen committed
76 77 78 79

  plugin = gst_plugin_new("gstelements");
  g_return_val_if_fail(plugin != NULL,NULL);

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

  while (_elements[i].name) {
Wim Taymans's avatar
Wim Taymans committed
83 84 85
    factory = gst_elementfactory_new (_elements[i].name,
                                      (_elements[i].type) (),
                                      _elements[i].details);
Erik Walthinsen's avatar
Erik Walthinsen committed
86
    if (factory != NULL) {
Wim Taymans's avatar
Wim Taymans committed
87
      gst_plugin_add_factory (plugin, factory);
88
      if (_elements[i].factoryinit) {
Wim Taymans's avatar
Wim Taymans committed
89
        _elements[i].factoryinit (factory);
90 91
      }
//      g_print("added factory '%s'\n",_elements[i].name);
Erik Walthinsen's avatar
Erik Walthinsen committed
92 93 94 95
    }
    i++;
  }

Wim Taymans's avatar
Wim Taymans committed
96
  gst_info ("gstelements: loaded %d standard elements\n", i);
Erik Walthinsen's avatar
Erik Walthinsen committed
97 98 99

  return plugin;
}