• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 struct _GstDecklinkVideoSrc
50 {
51   GstPushSrc parent;
52 
53   GstDecklinkModeEnum mode;
54   GstDecklinkModeEnum caps_mode;
55   BMDPixelFormat caps_format;
56   GstDecklinkConnectionEnum connection;
57   gint device_number;
58   gboolean output_stream_time;
59   GstClockTime skip_first_time;
60   gboolean drop_no_signal_frames;
61   GstClockTime expected_stream_time;
62   guint64 processed;
63   guint64 dropped;
64   guint64 first_stream_time;
65 
66   GstVideoInfo info;
67   GstDecklinkVideoFormat video_format;
68   BMDDuplexMode duplex_mode;
69   BMDTimecodeFormat timecode_format;
70 
71   GstDecklinkInput *input;
72 
73   GCond cond;
74   GMutex lock;
75   gboolean flushing;
76   GstQueueArray *current_frames;
77   gboolean no_signal;
78 
79   guint buffer_size;
80 
81   /* Protected by lock */
82   GstClockTime first_time;
83 
84   GstClockTime *times;
85   GstClockTime *times_temp;
86   guint window_size, window_fill;
87   gboolean window_filled;
88   guint window_skip, window_skip_count;
89   struct {
90     GstClockTime xbase, b;
91     GstClockTime num, den;
92   } current_time_mapping;
93   struct {
94     GstClockTime xbase, b;
95     GstClockTime num, den;
96   } next_time_mapping;
97   gboolean next_time_mapping_pending;
98 
99   GstVideoVBIParser *vbiparser;
100   GstVideoFormat anc_vformat;
101   gint anc_width;
102   gboolean output_cc;
103   guint last_cc_vbi_line;
104 };
105 
106 struct _GstDecklinkVideoSrcClass
107 {
108   GstPushSrcClass parent_class;
109 };
110 
111 GType gst_decklink_video_src_get_type (void);
112 
113 G_END_DECLS
114 
115 #endif /* __GST_DECKLINK_VIDEO_SRC_H__ */
116