element: Enforce that elements created by gst_element_factory_create/make() are floating
[platform/upstream/gstreamer.git] / gst / gststreamcollection.h
1 /* GStreamer
2  * Copyright (C) 2015 Centricular Ltd
3  *  @author: Edward Hervey <edward@centricular.com>
4  *  @author: Jan Schmidt <jan@centricular.com>
5  *
6  * gststreams.h : Header for GstStreamCollection subsystem
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23
24
25 #ifndef __GST_STREAM_COLLECTION_H__
26 #define __GST_STREAM_COLLECTION_H__
27
28 #include <gst/gstobject.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_STREAM_COLLECTION             (gst_stream_collection_get_type ())
33 #define GST_IS_STREAM_COLLECTION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_COLLECTION))
34 #define GST_IS_STREAM_COLLECTION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_STREAM_COLLECTION))
35 #define GST_STREAM_COLLECTION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_STREAM_COLLECTION, GstStreamCollectionClass))
36 #define GST_STREAM_COLLECTION(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_COLLECTION, GstStreamCollection))
37 #define GST_STREAM_COLLECTION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_STREAM_COLLECTION, GstStreamCollectionClass))
38 #define GST_STREAM_COLLECTION_CAST(obj)        ((GstStreamCollection*)(obj))
39
40 typedef struct _GstStreamCollection GstStreamCollection;
41 typedef struct _GstStreamCollectionClass GstStreamCollectionClass;
42 typedef struct _GstStreamCollectionPrivate GstStreamCollectionPrivate;
43
44 #include <gst/gststreamcollection.h>
45 #include <gst/gststreams.h>
46
47 /**
48  * GstStreamCollection:
49  *
50  * A collection of #GstStream that are available.
51  *
52  * A #GstStreamCollection will be provided by elements that can make those
53  * streams available. Applications can use the collection to show the user
54  * what streams are available by using %gst_stream_collection_get_stream()
55  *
56  * Once posted, a #GstStreamCollection is immutable. Updates are made by sending
57  * a new #GstStreamCollection message, which may or may not share some of
58  * the #GstStream objects from the collection it replaces. The receiver can check
59  * the sender of a stream collection message to know which collection is
60  * obsoleted.
61  *
62  * Several elements in a pipeline can provide #GstStreamCollection.
63  *
64  * Applications can activate streams from a collection by using the
65  * #GST_EVENT_SELECT_STREAMS event on a pipeline, bin or element.
66  *
67  * Since: 1.10
68  */
69 struct _GstStreamCollection {
70   /*< private >*/
71   GstObject object;
72
73   gchar *upstream_id;
74   GstStreamCollectionPrivate *priv;
75
76   gpointer _gst_reserved[GST_PADDING];
77 };
78
79 /**
80  * GstStreamCollectionClass:
81  * @parent_class: the parent class structure
82  * @stream_notify: default signal handler for the stream-notify signal
83  *
84  * GstStreamCollection class structure
85  */
86 struct _GstStreamCollectionClass {
87   GstObjectClass parent_class;
88
89   /* signals */
90   void  (*stream_notify)      (GstStreamCollection *collection, GstStream *stream, GParamSpec * pspec);
91
92   /*< private >*/
93   gpointer _gst_reserved[GST_PADDING];
94 };
95
96 GST_API
97 GType gst_stream_collection_get_type (void);
98
99 GST_API
100 GstStreamCollection *gst_stream_collection_new (const gchar *upstream_id);
101
102 GST_API
103 const gchar *gst_stream_collection_get_upstream_id (GstStreamCollection *collection);
104
105 GST_API
106 guint gst_stream_collection_get_size (GstStreamCollection *collection);
107
108 GST_API
109 GstStream *gst_stream_collection_get_stream (GstStreamCollection *collection, guint index);
110
111 GST_API
112 gboolean gst_stream_collection_add_stream (GstStreamCollection *collection,
113                                            GstStream *stream);
114
115 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
116 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstStreamCollection, gst_object_unref)
117 #endif
118
119 G_END_DECLS
120
121 #endif /* __GST_STREAM_COLLECTION_H__ */