1 /* GStreamer 2 * Copyright (C) <2016> Carlos Rafael Giani <dv at pseudoterminal dot org> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GST_RAW_VIDEO_PARSE_H__ 21 #define __GST_RAW_VIDEO_PARSE_H__ 22 23 #include <gst/gst.h> 24 #include <gst/video/video.h> 25 #include "gstrawbaseparse.h" 26 27 G_BEGIN_DECLS 28 29 #define GST_TYPE_RAW_VIDEO_PARSE (gst_raw_video_parse_get_type()) 30 #define GST_RAW_VIDEO_PARSE_CAST(obj) ((GstRawVideoParse *)(obj)) 31 G_DECLARE_FINAL_TYPE (GstRawVideoParse, gst_raw_video_parse, 32 GST, RAW_VIDEO_PARSE, GstRawBaseParse) 33 34 typedef struct _GstRawVideoParseConfig GstRawVideoParseConfig; 35 36 /* Contains information about the video frame format. */ 37 struct _GstRawVideoParseConfig 38 { 39 /* If TRUE, then this configuration is ready to use */ 40 gboolean ready; 41 42 /* FIXME: These values should not be necessary, since there's 43 * GstVideoInfo. However, setting these values in the video 44 * info independently is currently difficult. For example, 45 * setting the video format requires the gst_video_info_set_format() 46 * function, but this function also overwrites plane strides 47 * and offsets. */ 48 gint width, height; 49 GstVideoFormat format; 50 gint pixel_aspect_ratio_n, pixel_aspect_ratio_d; 51 gint framerate_n, framerate_d; 52 gboolean interlaced; 53 gsize plane_offsets[GST_VIDEO_MAX_PLANES]; 54 gint plane_strides[GST_VIDEO_MAX_PLANES]; 55 GstVideoColorimetry colorimetry; 56 57 /* If TRUE, then TFF flags are added to outgoing buffers and 58 * their video metadata */ 59 gboolean top_field_first; 60 61 /* Distance between the start of each frame, in bytes. If this value 62 * is larger than the actual size of a frame, then the extra bytes 63 * are skipped. For example, with frames that have 115200 bytes, a 64 * frame_size value of 120000 means that 4800 trailing bytes are 65 * skipped after the 115200 frame bytes. This is useful to skip 66 * metadata in between frames. */ 67 guint frame_size; 68 69 GstVideoInfo info; 70 71 gboolean custom_plane_strides; 72 }; 73 74 struct _GstRawVideoParse 75 { 76 GstRawBaseParse parent; 77 78 /*< private > */ 79 80 /* Configuration controlled by the object properties. Its ready value 81 * is set to TRUE from the start, so it can be used right away. 82 */ 83 GstRawVideoParseConfig properties_config; 84 /* Configuration controlled by the sink caps. Its ready value is 85 * initially set to FALSE until valid sink caps come in. It is set to 86 * FALSE again when the stream-start event is observed. 87 */ 88 GstRawVideoParseConfig sink_caps_config; 89 /* Currently active configuration. Points either to properties_config 90 * or to sink_caps_config. This is never NULL. */ 91 GstRawVideoParseConfig *current_config; 92 }; 93 94 G_END_DECLS 95 96 #endif 97