1 /* GStreamer 2 * 3 * Copyright (C) 2011 David Schleef <ds@schleef.org> 4 * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com> 5 * Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.com> 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public 18 * License along with this library; if not, write to the 19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #ifndef __GST_DECKLINK_VIDEO_SRC_H__ 24 #define __GST_DECKLINK_VIDEO_SRC_H__ 25 26 #include <gst/gst.h> 27 #include <gst/base/base.h> 28 #include <gst/video/video.h> 29 #include "gstdecklink.h" 30 31 G_BEGIN_DECLS 32 33 #define GST_TYPE_DECKLINK_VIDEO_SRC \ 34 (gst_decklink_video_src_get_type()) 35 #define GST_DECKLINK_VIDEO_SRC(obj) \ 36 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DECKLINK_VIDEO_SRC, GstDecklinkVideoSrc)) 37 #define GST_DECKLINK_VIDEO_SRC_CAST(obj) \ 38 ((GstDecklinkVideoSrc*)obj) 39 #define GST_DECKLINK_VIDEO_SRC_CLASS(klass) \ 40 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DECKLINK_VIDEO_SRC, GstDecklinkVideoSrcClass)) 41 #define GST_IS_DECKLINK_VIDEO_SRC(obj) \ 42 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DECKLINK_VIDEO_SRC)) 43 #define GST_IS_DECKLINK_VIDEO_SRC_CLASS(klass) \ 44 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DECKLINK_VIDEO_SRC)) 45 46 typedef struct _GstDecklinkVideoSrc GstDecklinkVideoSrc; 47 typedef struct _GstDecklinkVideoSrcClass GstDecklinkVideoSrcClass; 48 49 typedef enum { 50 SIGNAL_STATE_UNKNOWN, 51 SIGNAL_STATE_LOST, 52 SIGNAL_STATE_AVAILABLE, 53 } GstDecklinkSignalState; 54 55 struct _GstDecklinkVideoSrc 56 { 57 GstPushSrc parent; 58 59 GstDecklinkModeEnum mode; 60 GstDecklinkModeEnum caps_mode; 61 gint aspect_ratio_flag; /* -1 when unknown, 0 not set, 1 set */ 62 BMDPixelFormat caps_format; 63 GstDecklinkConnectionEnum connection; 64 gint device_number; 65 gboolean output_stream_time; 66 GstClockTime skip_first_time; 67 gboolean drop_no_signal_frames; 68 GstClockTime expected_stream_time; 69 guint64 processed; 70 guint64 dropped; 71 guint64 first_stream_time; 72 73 GstVideoInfo info; 74 GstDecklinkVideoFormat video_format; 75 GstDecklinkProfileId profile_id; 76 BMDTimecodeFormat timecode_format; 77 78 GstDecklinkInput *input; 79 80 GCond cond; 81 GMutex lock; 82 gboolean flushing; 83 GstQueueArray *current_frames; 84 GstDecklinkSignalState signal_state; 85 86 guint buffer_size; 87 88 /* Protected by lock */ 89 GstClockTime first_time; 90 91 GstClockTime *times; 92 GstClockTime *times_temp; 93 guint window_size, window_fill; 94 gboolean window_filled; 95 guint window_skip, window_skip_count; 96 struct { 97 GstClockTime xbase, b; 98 GstClockTime num, den; 99 } current_time_mapping; 100 struct { 101 GstClockTime xbase, b; 102 GstClockTime num, den; 103 } next_time_mapping; 104 gboolean next_time_mapping_pending; 105 106 GstVideoVBIParser *vbiparser; 107 GstVideoFormat anc_vformat; 108 gint anc_width; 109 gboolean output_cc; 110 gint last_cc_vbi_line; 111 gint last_cc_vbi_line_field2; 112 gboolean output_afd_bar; 113 gint last_afd_bar_vbi_line; 114 gint last_afd_bar_vbi_line_field2; 115 116 guint skipped_last; 117 GstClockTime skip_from_timestamp; 118 GstClockTime skip_to_timestamp; 119 }; 120 121 struct _GstDecklinkVideoSrcClass 122 { 123 GstPushSrcClass parent_class; 124 }; 125 126 GType gst_decklink_video_src_get_type (void); 127 128 GST_ELEMENT_REGISTER_DECLARE (decklinkvideosrc); 129 130 G_END_DECLS 131 132 #endif /* __GST_DECKLINK_VIDEO_SRC_H__ */ 133