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 \ 30 (gst_raw_video_parse_get_type()) 31 #define GST_RAW_VIDEO_PARSE(obj) \ 32 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_RAW_VIDEO_PARSE, GstRawVideoParse)) 33 #define GST_RAW_VIDEO_PARSE_CAST(obj) \ 34 ((GstRawVideoParse *)(obj)) 35 #define GST_RAW_VIDEO_PARSE_CLASS(klass) \ 36 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_RAW_VIDEO_PARSE, GstRawVideoParseClass)) 37 #define GST_IS_RAW_VIDEO_PARSE(obj) \ 38 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_RAW_VIDEO_PARSE)) 39 #define GST_IS_RAW_VIDEO_PARSE_CLASS(klass) \ 40 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_RAW_VIDEO_PARSE)) 41 42 typedef struct _GstRawVideoParseConfig GstRawVideoParseConfig; 43 typedef struct _GstRawVideoParse GstRawVideoParse; 44 typedef struct _GstRawVideoParseClass GstRawVideoParseClass; 45 46 /* Contains information about the video frame format. */ 47 struct _GstRawVideoParseConfig 48 { 49 /* If TRUE, then this configuration is ready to use */ 50 gboolean ready; 51 52 /* FIXME: These values should not be necessary, since there's 53 * GstVideoInfo. However, setting these values in the video 54 * info independently is currently difficult. For example, 55 * setting the video format requires the gst_video_info_set_format() 56 * function, but this function also overwrites plane strides 57 * and offsets. */ 58 gint width, height; 59 GstVideoFormat format; 60 gint pixel_aspect_ratio_n, pixel_aspect_ratio_d; 61 gint framerate_n, framerate_d; 62 gboolean interlaced; 63 gsize plane_offsets[GST_VIDEO_MAX_PLANES]; 64 gint plane_strides[GST_VIDEO_MAX_PLANES]; 65 66 /* If TRUE, then TFF flags are added to outgoing buffers and 67 * their video metadata */ 68 gboolean top_field_first; 69 70 /* Distance between the start of each frame, in bytes. If this value 71 * is larger than the actual size of a frame, then the extra bytes 72 * are skipped. For example, with frames that have 115200 bytes, a 73 * frame_size value of 120000 means that 4800 trailing bytes are 74 * skipped after the 115200 frame bytes. This is useful to skip 75 * metadata in between frames. */ 76 guint frame_size; 77 78 GstVideoInfo info; 79 80 gboolean custom_plane_strides; 81 }; 82 83 struct _GstRawVideoParse 84 { 85 GstRawBaseParse parent; 86 87 /*< private > */ 88 89 /* Configuration controlled by the object properties. Its ready value 90 * is set to TRUE from the start, so it can be used right away. 91 */ 92 GstRawVideoParseConfig properties_config; 93 /* Configuration controlled by the sink caps. Its ready value is 94 * initially set to FALSE until valid sink caps come in. It is set to 95 * FALSE again when the stream-start event is observed. 96 */ 97 GstRawVideoParseConfig sink_caps_config; 98 /* Currently active configuration. Points either to properties_config 99 * or to sink_caps_config. This is never NULL. */ 100 GstRawVideoParseConfig *current_config; 101 }; 102 103 struct _GstRawVideoParseClass 104 { 105 GstRawBaseParseClass parent_class; 106 }; 107 108 GType gst_raw_video_parse_get_type (void); 109 110 G_END_DECLS 111 112 #endif 113