docs: Misc addition/fixes
[platform/upstream/gstreamer.git] / gst / gststreams.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 GstStream 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_STREAMS_H__
26 #define __GST_STREAMS_H__
27
28 #include <gst/gstobject.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_STREAM             (gst_stream_get_type ())
33 #define GST_IS_STREAM(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM))
34 #define GST_IS_STREAM_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_STREAM))
35 #define GST_STREAM_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_STREAM, GstStreamClass))
36 #define GST_STREAM(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM, GstStream))
37 #define GST_STREAM_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_STREAM, GstStreamClass))
38 #define GST_STREAM_CAST(obj)        ((GstStream*)(obj))
39
40 /**
41  * GstStreamType:
42  * @GST_STREAM_TYPE_UNKNOWN: The stream is of unknown (unclassified) type.
43  * @GST_STREAM_TYPE_AUDIO: The stream is of audio data
44  * @GST_STREAM_TYPE_VIDEO: The stream carries video data
45  * @GST_STREAM_TYPE_CONTAINER: The stream is a muxed container type
46  * @GST_STREAM_TYPE_TEXT: The stream contains subtitle / subpicture data.
47  *
48  * #GstStreamType describes a high level classification set for
49  * flows of data in #GstStream objects.
50  *
51  * Note that this is a flag, and therefore users should not assume it
52  * will be a single value. Do not use the equality operator for checking
53  * whether a stream is of a certain type.
54  */
55 typedef enum {
56   GST_STREAM_TYPE_UNKNOWN   = 1 << 0,
57   GST_STREAM_TYPE_AUDIO     = 1 << 1,
58   GST_STREAM_TYPE_VIDEO     = 1 << 2,
59   GST_STREAM_TYPE_CONTAINER = 1 << 3,
60   GST_STREAM_TYPE_TEXT      = 1 << 4
61 } GstStreamType;
62
63
64 typedef struct _GstStream GstStream;
65 typedef struct _GstStreamClass GstStreamClass;
66 typedef struct _GstStreamPrivate GstStreamPrivate;
67
68 /**
69  * GstStream:
70  * @stream_id: The Stream Identifier for this #GstStream
71  *
72  * A high-level object representing a single stream. It might be backed, or
73  * not, by an actual flow of data in a pipeline (#GstPad).
74  *
75  * A #GstStream does not care about data changes (such as decoding, encoding,
76  * parsing,...) as long as the underlying data flow corresponds to the same
77  * high-level flow (ex: a certain audio track).
78  *
79  * A #GstStream contains all the information pertinent to a stream, such as
80  * stream-id, tags, caps, type, ...
81  *
82  * Elements can subclass a #GstStream for internal usage (to contain information
83  * pertinent to streams of data).
84  */
85 struct _GstStream {
86   /*< private >*/
87   GstObject object;
88
89   /*< public >*/
90   const gchar *stream_id;
91
92   /*< private >*/
93   GstStreamPrivate *priv;
94
95   gpointer _gst_reserved[GST_PADDING];
96 };
97
98 /**
99  * GstStreamClass:
100  * @parent_class: the parent class structure
101  *
102  * GstStream class structure
103  */
104 struct _GstStreamClass {
105   GstObjectClass parent_class;
106
107   /*< private >*/
108   gpointer _gst_reserved[GST_PADDING];
109 };
110
111 GST_EXPORT
112 GType     gst_stream_get_type (void);
113
114 #include <gst/gstevent.h>
115
116 GST_EXPORT
117 GstStream *gst_stream_new            (const gchar *stream_id,
118                                       GstCaps *caps,
119                                       GstStreamType type,
120                                       GstStreamFlags flags);
121 GST_EXPORT
122 const gchar *  gst_stream_get_stream_id (GstStream *stream);
123
124 GST_EXPORT
125 void           gst_stream_set_stream_flags (GstStream *stream, GstStreamFlags flags);
126
127 GST_EXPORT
128 GstStreamFlags gst_stream_get_stream_flags (GstStream *stream);
129
130 GST_EXPORT
131 void           gst_stream_set_stream_type (GstStream *stream, GstStreamType stream_type);
132
133 GST_EXPORT
134 GstStreamType  gst_stream_get_stream_type (GstStream *stream);
135
136 GST_EXPORT
137 void           gst_stream_set_tags (GstStream *stream, GstTagList *tags);
138
139 GST_EXPORT
140 GstTagList *   gst_stream_get_tags (GstStream *stream);
141
142 GST_EXPORT
143 void           gst_stream_set_caps (GstStream *stream, GstCaps *caps);
144
145 GST_EXPORT
146 GstCaps *      gst_stream_get_caps (GstStream *stream);
147
148 GST_EXPORT
149 const gchar *  gst_stream_type_get_name (GstStreamType stype);
150
151 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
152 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstStream, gst_object_unref)
153 #endif
154
155 G_END_DECLS
156
157 #endif /* __GST_STREAMS_H__ */