- some fixes to int2float making automake 1.5 happy (gst now requires automake1.5...
[platform/upstream/gstreamer.git] / gst / gstpipeline.c
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *
5  * gstpipeline.c: Overall pipeline management element
6  *
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.
11  *
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.
16  *
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.
21  */
22
23 //#define GST_DEBUG_ENABLED
24 #include "gst_private.h"
25
26 #include "gstpipeline.h"
27 #include "gstthread.h"
28 #include "gstutils.h"
29 #include "gsttype.h"
30 #include "gstautoplug.h"
31 #include "gstscheduler.h"
32
33
34 GstElementDetails gst_pipeline_details = {
35   "Pipeline object",
36   "Bin",
37   "Complete pipeline object",
38   VERSION,
39   "Erik Walthinsen <omega@cse.ogi.edu>",
40   "(C) 1999",
41 };
42
43 /* Pipeline signals and args */
44 enum {
45   /* FILL ME */
46   LAST_SIGNAL
47 };
48
49 enum {
50   ARG_0,
51   /* FILL ME */
52 };
53
54
55 static void                     gst_pipeline_class_init         (GstPipelineClass *klass);
56 static void                     gst_pipeline_init               (GstPipeline *pipeline);
57
58 static GstElementStateReturn    gst_pipeline_change_state       (GstElement *element);
59
60 static GstBinClass *parent_class = NULL;
61 //static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 };
62
63 GType
64 gst_pipeline_get_type (void) {
65   static GType pipeline_type = 0;
66
67   if (!pipeline_type) {
68     static const GTypeInfo pipeline_info = {
69       sizeof(GstPipelineClass),
70       NULL,
71       NULL,
72       (GClassInitFunc)gst_pipeline_class_init,
73       NULL,
74       NULL,
75       sizeof(GstPipeline),
76       0,
77       (GInstanceInitFunc)gst_pipeline_init,
78       NULL
79     };
80     pipeline_type = g_type_register_static (GST_TYPE_BIN, "GstPipeline", &pipeline_info, 0);
81   }
82   return pipeline_type;
83 }
84
85 static void
86 gst_pipeline_class_init (GstPipelineClass *klass)
87 {
88   GstElementClass *gstelement_class;
89
90   gstelement_class = (GstElementClass*)klass;
91
92   parent_class = g_type_class_ref (gst_bin_get_type ());
93
94   gstelement_class->change_state = gst_pipeline_change_state;
95 }
96
97 static void
98 gst_pipeline_init (GstPipeline *pipeline)
99 {
100   // we're a manager by default
101   GST_FLAG_SET (pipeline, GST_BIN_FLAG_MANAGER);
102
103   GST_ELEMENT_SCHED (pipeline) = gst_schedulerfactory_make ("basic", GST_ELEMENT (pipeline));
104   GST_DEBUG (GST_CAT_PIPELINE, "pipeline's scheduler is %p\n", GST_ELEMENT_SCHED (pipeline));
105 }
106
107
108 /**
109  * gst_pipeline_new:
110  * @name: name of new pipeline
111  *
112  * Create a new pipeline with the given name.
113  *
114  * Returns: newly created GstPipeline
115  */
116 GstElement*
117 gst_pipeline_new (const gchar *name) 
118 {
119   return gst_elementfactory_make ("pipeline", name);
120 }
121
122 static GstElementStateReturn
123 gst_pipeline_change_state (GstElement *element)
124 {
125   if (GST_ELEMENT_CLASS (parent_class)->change_state)
126     return GST_ELEMENT_CLASS (parent_class)->change_state (element);
127
128   return GST_STATE_SUCCESS;
129 }
130