2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gstpipeline.c: Overall pipeline management element
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #include "gst_private.h"
25 #include "gstpipeline.h"
26 #include "gstscheduler.h"
28 GstElementDetails gst_pipeline_details = {
31 "Complete pipeline object",
33 "Erik Walthinsen <omega@cse.ogi.edu>",
37 /* Pipeline signals and args */
49 static void gst_pipeline_class_init (GstPipelineClass *klass);
50 static void gst_pipeline_init (GstPipeline *pipeline);
52 static void gst_pipeline_dispose (GObject *object);
54 static GstElementStateReturn gst_pipeline_change_state (GstElement *element);
56 static GstBinClass *parent_class = NULL;
57 /* static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 }; */
60 gst_pipeline_get_type (void) {
61 static GType pipeline_type = 0;
64 static const GTypeInfo pipeline_info = {
65 sizeof(GstPipelineClass),
68 (GClassInitFunc)gst_pipeline_class_init,
73 (GInstanceInitFunc)gst_pipeline_init,
76 pipeline_type = g_type_register_static (GST_TYPE_BIN, "GstPipeline", &pipeline_info, 0);
82 gst_pipeline_class_init (GstPipelineClass *klass)
84 GObjectClass *gobject_class;
85 GstElementClass *gstelement_class;
87 gobject_class = (GObjectClass *)klass;
88 gstelement_class = (GstElementClass*)klass;
90 parent_class = g_type_class_ref (gst_bin_get_type ());
92 gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_pipeline_dispose);
94 gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_pipeline_change_state);
98 gst_pipeline_init (GstPipeline *pipeline)
100 /* we're a manager by default */
101 GST_FLAG_SET (pipeline, GST_BIN_FLAG_MANAGER);
103 GST_ELEMENT_SCHED (pipeline) = gst_schedulerfactory_make ("basic", GST_ELEMENT (pipeline));
105 gst_object_ref (GST_OBJECT (GST_ELEMENT_SCHED (pipeline)));
106 gst_object_sink (GST_OBJECT (GST_ELEMENT_SCHED (pipeline)));
108 GST_DEBUG (GST_CAT_PIPELINE, "pipeline's scheduler is %p\n", GST_ELEMENT_SCHED (pipeline));
112 gst_pipeline_dispose (GObject *object)
114 GstPipeline *pipeline = GST_PIPELINE (object);
116 G_OBJECT_CLASS (parent_class)->dispose (object);
118 gst_object_unref (GST_OBJECT (GST_ELEMENT_SCHED (pipeline)));
123 * @name: name of new pipeline
125 * Create a new pipeline with the given name.
127 * Returns: newly created GstPipeline
130 gst_pipeline_new (const gchar *name)
132 return gst_elementfactory_make ("pipeline", name);
135 static GstElementStateReturn
136 gst_pipeline_change_state (GstElement *element)
138 if (GST_ELEMENT_CLASS (parent_class)->change_state)
139 return GST_ELEMENT_CLASS (parent_class)->change_state (element);
141 return GST_STATE_SUCCESS;