Debian Codegraph @

gstreamer/gstreamermm/videoframe.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_VIDEOFRAME_H
3 #define _GSTREAMERMM_VIDEOFRAME_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* gstreamermm - a C++ wrapper for gstreamer
10 *
11 * Copyright 2008-2015 The gstreamermm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28
29 #include <gst/video/video-frame.h>
30 #include <gstreamermm/videoinfo.h>
31 #include <gstreamermm/buffer.h>
32
33 namespace Gst
34 {
35
36 /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */
37
38 /**
39 * @var VideoFrameFlags VIDEO_FRAME_FLAG_NONE
40 * No flags.
41 *
42 * @var VideoFrameFlags VIDEO_FRAME_FLAG_INTERLACED
43 * The video frame is interlaced. In mixed
44 * interlace-mode, this flag specifies if the frame is interlaced or
45 * progressive.
46 *
47 * @var VideoFrameFlags VIDEO_FRAME_FLAG_TFF
48 * The video frame has the top field first.
49 *
50 * @var VideoFrameFlags VIDEO_FRAME_FLAG_RFF
51 * The video frame has the repeat flag.
52 *
53 * @var VideoFrameFlags VIDEO_FRAME_FLAG_ONEFIELD
54 * The video frame has one field.
55 *
56 * @var VideoFrameFlags VIDEO_FRAME_FLAG_MULTIPLE_VIEW
57 * The video contains one or
58 * more non-mono views.
59 *
60 * @var VideoFrameFlags VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE
61 * The video frame is the first
62 * in a set of corresponding views provided as sequential frames.
63 *
64 * @enum VideoFrameFlags
65 *
66 * Extra video frame flags
67 *
68 * @ingroup gstreamermmEnums
69 * @par Bitwise operators:
70 * <tt>%VideoFrameFlags operator|(VideoFrameFlags, VideoFrameFlags)</tt><br>
71 * <tt>%VideoFrameFlags operator&(VideoFrameFlags, VideoFrameFlags)</tt><br>
72 * <tt>%VideoFrameFlags operator^(VideoFrameFlags, VideoFrameFlags)</tt><br>
73 * <tt>%VideoFrameFlags operator~(VideoFrameFlags)</tt><br>
74 * <tt>%VideoFrameFlags& operator|=(VideoFrameFlags&, VideoFrameFlags)</tt><br>
75 * <tt>%VideoFrameFlags& operator&=(VideoFrameFlags&, VideoFrameFlags)</tt><br>
76 * <tt>%VideoFrameFlags& operator^=(VideoFrameFlags&, VideoFrameFlags)</tt><br>
77 */
78 enum VideoFrameFlags
79 {
80 VIDEO_FRAME_FLAG_NONE = 0x0,
81 VIDEO_FRAME_FLAG_INTERLACED = (1 << 0),
82 VIDEO_FRAME_FLAG_TFF = (1 << 1),
83 VIDEO_FRAME_FLAG_RFF = (1 << 2),
84 VIDEO_FRAME_FLAG_ONEFIELD = (1 << 3),
85 VIDEO_FRAME_FLAG_MULTIPLE_VIEW = (1 << 4),
86 VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE = (1 << 5)
87 };
88
89 /** @ingroup gstreamermmEnums */
90 inline VideoFrameFlags operator|(VideoFrameFlags lhs, VideoFrameFlags rhs)
91 { return static_cast<VideoFrameFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
92
93 /** @ingroup gstreamermmEnums */
94 inline VideoFrameFlags operator&(VideoFrameFlags lhs, VideoFrameFlags rhs)
95 { return static_cast<VideoFrameFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
96
97 /** @ingroup gstreamermmEnums */
98 inline VideoFrameFlags operator^(VideoFrameFlags lhs, VideoFrameFlags rhs)
99 { return static_cast<VideoFrameFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
100
101 /** @ingroup gstreamermmEnums */
102 inline VideoFrameFlags operator~(VideoFrameFlags flags)
103 { return static_cast<VideoFrameFlags>(~static_cast<unsigned>(flags)); }
104
105 /** @ingroup gstreamermmEnums */
106 inline VideoFrameFlags& operator|=(VideoFrameFlags& lhs, VideoFrameFlags rhs)
107 { return (lhs = static_cast<VideoFrameFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
108
109 /** @ingroup gstreamermmEnums */
110 inline VideoFrameFlags& operator&=(VideoFrameFlags& lhs, VideoFrameFlags rhs)
111 { return (lhs = static_cast<VideoFrameFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
112
113 /** @ingroup gstreamermmEnums */
114 inline VideoFrameFlags& operator^=(VideoFrameFlags& lhs, VideoFrameFlags rhs)
115 { return (lhs = static_cast<VideoFrameFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
116
117 } // namespace Gst
118
119 #ifndef DOXYGEN_SHOULD_SKIP_THIS
120 namespace Glib
121 {
122
123 template <>
124 class Value<Gst::VideoFrameFlags> : public Glib::Value_Flags<Gst::VideoFrameFlags>
125 {
126 public:
127 static GType value_type() G_GNUC_CONST;
128 };
129
130 } // namespace Glib
131 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
132
133 namespace Gst
134 {
135
136 /**
137 * @var VideoBufferFlags VIDEO_BUFFER_FLAG_INTERLACED
138 * If the Gst::Buffer is interlaced. In mixed
139 * interlace-mode, this flags specifies if the frame is
140 * interlaced or progressive.
141 *
142 * @var VideoBufferFlags VIDEO_BUFFER_FLAG_TFF
143 * If the Gst::Buffer is interlaced, then the first field
144 * in the video frame is the top field. If unset, the
145 * bottom field is first.
146 *
147 * @var VideoBufferFlags VIDEO_BUFFER_FLAG_RFF
148 * If the Gst::Buffer is interlaced, then the first field
149 * (as defined by the Gst::VIDEO_BUFFER_TFF flag setting)
150 * is repeated.
151 *
152 * @var VideoBufferFlags VIDEO_BUFFER_FLAG_ONEFIELD
153 * If the Gst::Buffer is interlaced, then only the
154 * first field (as defined by the Gst::VIDEO_BUFFER_TFF
155 * flag setting) is to be displayed.
156 *
157 * @var VideoBufferFlags VIDEO_BUFFER_FLAG_MULTIPLE_VIEW
158 * The Gst::Buffer contains one or more specific views,
159 * such as left or right eye view. This flags is set on
160 * any buffer that contains non-mono content - even for
161 * streams that contain only a single viewpoint. In mixed
162 * mono / non-mono streams, the absense of the flag marks
163 * mono buffers.
164 *
165 * @var VideoBufferFlags VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE
166 * When conveying stereo/multiview content with
167 * frame-by-frame methods, this flag marks the first buffer
168 * in a bundle of frames that belong together.
169 *
170 * @var VideoBufferFlags VIDEO_BUFFER_FLAG_LAST
171 * Offset to define more flags.
172 *
173 * @enum VideoBufferFlags
174 *
175 * Additional video buffer flags. These flags can potentially be used on any
176 * buffers carrying video data - even encoded data.
177 *
178 * @ingroup gstreamermmEnums
179 * @par Bitwise operators:
180 * <tt>%VideoBufferFlags operator|(VideoBufferFlags, VideoBufferFlags)</tt><br>
181 * <tt>%VideoBufferFlags operator&(VideoBufferFlags, VideoBufferFlags)</tt><br>
182 * <tt>%VideoBufferFlags operator^(VideoBufferFlags, VideoBufferFlags)</tt><br>
183 * <tt>%VideoBufferFlags operator~(VideoBufferFlags)</tt><br>
184 * <tt>%VideoBufferFlags& operator|=(VideoBufferFlags&, VideoBufferFlags)</tt><br>
185 * <tt>%VideoBufferFlags& operator&=(VideoBufferFlags&, VideoBufferFlags)</tt><br>
186 * <tt>%VideoBufferFlags& operator^=(VideoBufferFlags&, VideoBufferFlags)</tt><br>
187 */
188 enum VideoBufferFlags
189 {
190 VIDEO_BUFFER_FLAG_INTERLACED = (GST_BUFFER_FLAG_LAST << 0),
191 VIDEO_BUFFER_FLAG_TFF = (GST_BUFFER_FLAG_LAST << 1),
192 VIDEO_BUFFER_FLAG_RFF = (GST_BUFFER_FLAG_LAST << 2),
193 VIDEO_BUFFER_FLAG_ONEFIELD = (GST_BUFFER_FLAG_LAST << 3),
194 VIDEO_BUFFER_FLAG_MULTIPLE_VIEW = (GST_BUFFER_FLAG_LAST << 4),
195 VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE = (GST_BUFFER_FLAG_LAST << 5),
196 VIDEO_BUFFER_FLAG_LAST = (GST_BUFFER_FLAG_LAST << 8)
197 };
198
199 /** @ingroup gstreamermmEnums */
200 inline VideoBufferFlags operator|(VideoBufferFlags lhs, VideoBufferFlags rhs)
201 { return static_cast<VideoBufferFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
202
203 /** @ingroup gstreamermmEnums */
204 inline VideoBufferFlags operator&(VideoBufferFlags lhs, VideoBufferFlags rhs)
205 { return static_cast<VideoBufferFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
206
207 /** @ingroup gstreamermmEnums */
208 inline VideoBufferFlags operator^(VideoBufferFlags lhs, VideoBufferFlags rhs)
209 { return static_cast<VideoBufferFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
210
211 /** @ingroup gstreamermmEnums */
212 inline VideoBufferFlags operator~(VideoBufferFlags flags)
213 { return static_cast<VideoBufferFlags>(~static_cast<unsigned>(flags)); }
214
215 /** @ingroup gstreamermmEnums */
216 inline VideoBufferFlags& operator|=(VideoBufferFlags& lhs, VideoBufferFlags rhs)
217 { return (lhs = static_cast<VideoBufferFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
218
219 /** @ingroup gstreamermmEnums */
220 inline VideoBufferFlags& operator&=(VideoBufferFlags& lhs, VideoBufferFlags rhs)
221 { return (lhs = static_cast<VideoBufferFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
222
223 /** @ingroup gstreamermmEnums */
224 inline VideoBufferFlags& operator^=(VideoBufferFlags& lhs, VideoBufferFlags rhs)
225 { return (lhs = static_cast<VideoBufferFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
226
227 } // namespace Gst
228
229 #ifndef DOXYGEN_SHOULD_SKIP_THIS
230 namespace Glib
231 {
232
233 template <>
234 class Value<Gst::VideoBufferFlags> : public Glib::Value_Flags<Gst::VideoBufferFlags>
235 {
236 public:
237 static GType value_type() G_GNUC_CONST;
238 };
239
240 } // namespace Glib
241 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
242
243 namespace Gst
244 {
245
246 /**
247 * @var VideoFrameMapFlags VIDEO_FRAME_MAP_FLAG_NO_REF
248 * Don't take another reference of the buffer and store it in
249 * the GstVideoFrame. This makes sure that the buffer stays
250 * writable while the frame is mapped, but requires that the
251 * buffer reference stays valid until the frame is unmapped again.
252 *
253 * @var VideoFrameMapFlags VIDEO_FRAME_MAP_FLAG_LAST
254 * Offset to define more flags.
255 *
256 * @enum VideoFrameMapFlags
257 *
258 * Additional mapping flags for Gst::VideoFrame::map().
259 *
260 * @ingroup gstreamermmEnums
261 * @par Bitwise operators:
262 * <tt>%VideoFrameMapFlags operator|(VideoFrameMapFlags, VideoFrameMapFlags)</tt><br>
263 * <tt>%VideoFrameMapFlags operator&(VideoFrameMapFlags, VideoFrameMapFlags)</tt><br>
264 * <tt>%VideoFrameMapFlags operator^(VideoFrameMapFlags, VideoFrameMapFlags)</tt><br>
265 * <tt>%VideoFrameMapFlags operator~(VideoFrameMapFlags)</tt><br>
266 * <tt>%VideoFrameMapFlags& operator|=(VideoFrameMapFlags&, VideoFrameMapFlags)</tt><br>
267 * <tt>%VideoFrameMapFlags& operator&=(VideoFrameMapFlags&, VideoFrameMapFlags)</tt><br>
268 * <tt>%VideoFrameMapFlags& operator^=(VideoFrameMapFlags&, VideoFrameMapFlags)</tt><br>
269 */
270 enum VideoFrameMapFlags
271 {
272 VIDEO_FRAME_MAP_FLAG_NO_REF = (GST_MAP_FLAG_LAST << 0),
273 VIDEO_FRAME_MAP_FLAG_LAST = (GST_MAP_FLAG_LAST << 8)
274 };
275
276 /** @ingroup gstreamermmEnums */
277 inline VideoFrameMapFlags operator|(VideoFrameMapFlags lhs, VideoFrameMapFlags rhs)
278 { return static_cast<VideoFrameMapFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
279
280 /** @ingroup gstreamermmEnums */
281 inline VideoFrameMapFlags operator&(VideoFrameMapFlags lhs, VideoFrameMapFlags rhs)
282 { return static_cast<VideoFrameMapFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
283
284 /** @ingroup gstreamermmEnums */
285 inline VideoFrameMapFlags operator^(VideoFrameMapFlags lhs, VideoFrameMapFlags rhs)
286 { return static_cast<VideoFrameMapFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
287
288 /** @ingroup gstreamermmEnums */
289 inline VideoFrameMapFlags operator~(VideoFrameMapFlags flags)
290 { return static_cast<VideoFrameMapFlags>(~static_cast<unsigned>(flags)); }
291
292 /** @ingroup gstreamermmEnums */
293 inline VideoFrameMapFlags& operator|=(VideoFrameMapFlags& lhs, VideoFrameMapFlags rhs)
294 { return (lhs = static_cast<VideoFrameMapFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
295
296 /** @ingroup gstreamermmEnums */
297 inline VideoFrameMapFlags& operator&=(VideoFrameMapFlags& lhs, VideoFrameMapFlags rhs)
298 { return (lhs = static_cast<VideoFrameMapFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
299
300 /** @ingroup gstreamermmEnums */
301 inline VideoFrameMapFlags& operator^=(VideoFrameMapFlags& lhs, VideoFrameMapFlags rhs)
302 { return (lhs = static_cast<VideoFrameMapFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
303
304 } // namespace Gst
305
306 #ifndef DOXYGEN_SHOULD_SKIP_THIS
307 namespace Glib
308 {
309
310 template <>
311 class Value<Gst::VideoFrameMapFlags> : public Glib::Value_Flags<Gst::VideoFrameMapFlags>
312 {
313 public:
314 static GType value_type() G_GNUC_CONST;
315 };
316
317 } // namespace Glib
318 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
319
320 namespace Gst
321 {
322
323
324 class VideoFrame
325 {
326 public:
327 #ifndef DOXYGEN_SHOULD_SKIP_THIS
328 using CppObjectType = VideoFrame;
329 using BaseObjectType = GstVideoFrame;
330 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
331
332 private:
333
334 public:
335 VideoFrame();
336 explicit VideoFrame(const GstVideoFrame* gobject); // always takes a copy
337 ///Provides access to the underlying C instance.
338 GstVideoFrame* gobj() { return &gobject_; }
339 ///Provides access to the underlying C instance.
340 const GstVideoFrame* gobj() const { return &gobject_; }
341
342 protected:
343 GstVideoFrame gobject_;
344
345 public:
346
347 /** Use @a info and @a buffer to fill in the values of @a frame. @a frame is usually
348 * allocated on the stack, and you will pass the address to the Gst::VideoFrame
349 * structure allocated on the stack; map() will then fill in
350 * the structures with the various video-specific information you need to access
351 * the pixels of the video buffer. You can then use accessor macros such as
352 * GST_VIDEO_FRAME_COMP_DATA(), GST_VIDEO_FRAME_PLANE_DATA(),
353 * GST_VIDEO_FRAME_COMP_STRIDE(), GST_VIDEO_FRAME_PLANE_STRIDE() etc.
354 * to get to the pixels.
355 *
356 *
357 * [C example ellipted]
358 *
359 * All video planes of @a buffer will be mapped and the pointers will be set in
360 * @a frame->data.
361 *
362 * The purpose of this function is to make it easy for you to get to the video
363 * pixels in a generic way, without you having to worry too much about details
364 * such as whether the video data is allocated in one contiguous memory chunk
365 * or multiple memory chunks (e.g. one for each plane); or if custom strides
366 * and custom plane offsets are used or not (as signalled by GstVideoMeta on
367 * each buffer). This function will just fill the Gst::VideoFrame structure
368 * with the right values and if you use the accessor macros everything will
369 * just work and you can access the data easily. It also maps the underlying
370 * memory chunks for you.
371 *
372 * @param info A Gst::VideoInfo.
373 * @param buffer The buffer to map.
374 * @param flags Gst::MapFlags.
375 * @return <tt>true</tt> on success.
376 */
377 bool map(const Gst::VideoInfo& info, const Glib::RefPtr<Gst::Buffer>& buffer, Gst::MapFlags flags);
378
379 /** Use @a info and @a buffer to fill in the values of @a frame with the video frame
380 * information of frame @a id.
381 *
382 * When @a id is -1, the default frame is mapped. When @a id != -1, this function
383 * will return <tt>false</tt> when there is no GstVideoMeta with that id.
384 *
385 * All video planes of @a buffer will be mapped and the pointers will be set in
386 * @a frame->data.
387 *
388 * @param info A Gst::VideoInfo.
389 * @param buffer The buffer to map.
390 * @param id The frame id to map.
391 * @param flags Gst::MapFlags.
392 * @return <tt>true</tt> on success.
393 */
394 bool map_id(const Gst::VideoInfo& info, const Glib::RefPtr<Gst::Buffer>& buffer, gint id, Gst::MapFlags flags);
395
396 /** Unmap the memory previously mapped with gst_video_frame_map.
397 */
398 void unmap();
399
400 /** Copy the contents from @a src to @a dest.
401 *
402 * @param dest A Gst::VideoFrame.
403 * @param src A Gst::VideoFrame.
404 * @return <tt>true</tt> if the contents could be copied.
405 */
406 static bool copy(const Gst::VideoFrame& dest, const Gst::VideoFrame& src);
407
408 /** Copy the plane with index @a plane from @a src to @a dest.
409 *
410 * @param dest A Gst::VideoFrame.
411 * @param src A Gst::VideoFrame.
412 * @param plane A plane.
413 * @return <tt>true</tt> if the contents could be copied.
414 */
415 static bool copy_plane(const Gst::VideoFrame& dest, const Gst::VideoFrame& src, guint plane);
416
417 void set_info(const Gst::VideoInfo& value);
418 Gst::VideoInfo get_info() const;
419
420
421 void set_flags(const Gst::VideoFrameFlags& value);
422 Gst::VideoFrameFlags get_flags() const;
423
424 void set_buffer(const Glib::RefPtr<Gst::Buffer>& value);
425 Glib::RefPtr<Gst::Buffer> get_buffer() const;
426
427 void set_meta(const gpointer& value);
428 gpointer get_meta() const;
429
430 void set_id(const gint& value);
431 gint get_id() const;
432
433
434 };
435
436 }
437
438
439 #endif /* _GSTREAMERMM_VIDEOFRAME_H */
440