3 * Copyright (C) 2005 Martin Eikermann <meiker@upb.de>
4 * Copyright (C) 2008-2010 Sebastian Dröge <slomo@collabora.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef __GST_DEINTERLACE_H__
23 #define __GST_DEINTERLACE_H__
26 #include <gst/video/video.h>
27 #include <gst/video/gstvideopool.h>
28 #include <gst/video/gstvideometa.h>
30 #include "gstdeinterlacemethod.h"
34 #define GST_TYPE_DEINTERLACE \
35 (gst_deinterlace_get_type())
36 #define GST_DEINTERLACE(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEINTERLACE,GstDeinterlace))
38 #define GST_DEINTERLACE_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEINTERLACE,GstDeinterlace))
40 #define GST_IS_DEINTERLACE(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEINTERLACE))
42 #define GST_IS_DEINTERLACE_CLASS(obj) \
43 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEINTERLACE))
45 typedef struct _GstDeinterlace GstDeinterlace;
46 typedef struct _GstDeinterlaceClass GstDeinterlaceClass;
50 GST_DEINTERLACE_TOMSMOCOMP,
51 GST_DEINTERLACE_GREEDY_H,
52 GST_DEINTERLACE_GREEDY_L,
54 GST_DEINTERLACE_LINEAR,
55 GST_DEINTERLACE_LINEAR_BLEND,
56 GST_DEINTERLACE_SCALER_BOB,
57 GST_DEINTERLACE_WEAVE,
58 GST_DEINTERLACE_WEAVE_TFF,
59 GST_DEINTERLACE_WEAVE_BFF
60 } GstDeinterlaceMethods;
64 GST_DEINTERLACE_ALL, /* All (missing data is interp.) */
65 GST_DEINTERLACE_TF, /* Top Fields Only */
66 GST_DEINTERLACE_BF /* Bottom Fields Only */
67 } GstDeinterlaceFields;
71 GST_DEINTERLACE_LAYOUT_AUTO,
72 GST_DEINTERLACE_LAYOUT_TFF,
73 GST_DEINTERLACE_LAYOUT_BFF
74 } GstDeinterlaceFieldLayout;
77 GST_DEINTERLACE_MODE_AUTO,
78 GST_DEINTERLACE_MODE_INTERLACED,
79 GST_DEINTERLACE_MODE_DISABLED
84 GST_DEINTERLACE_LOCKING_NONE,
85 GST_DEINTERLACE_LOCKING_AUTO,
86 GST_DEINTERLACE_LOCKING_ACTIVE,
87 GST_DEINTERLACE_LOCKING_PASSIVE,
88 } GstDeinterlaceLocking;
90 #define GST_DEINTERLACE_MAX_FIELD_HISTORY 10
91 #define GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY 50
92 /* check max field history is large enough */
93 #if GST_DEINTERLACE_MAX_FIELD_HISTORY < GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY * 3
94 #undef GST_DEINTERLACE_MAX_FIELD_HISTORY
95 #define GST_DEINTERLACE_MAX_FIELD_HISTORY (GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY * 3)
98 typedef struct _TelecinePattern TelecinePattern;
99 struct _TelecinePattern
103 guint8 ratio_n, ratio_d;
104 guint8 states[GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY];
107 typedef struct _GstDeinterlaceBufferState GstDeinterlaceBufferState;
108 struct _GstDeinterlaceBufferState
110 GstClockTime timestamp;
111 GstClockTime duration;
115 struct _GstDeinterlace
119 GstPad *srcpad, *sinkpad;
122 GstDeinterlaceMode mode;
124 GstDeinterlaceFieldLayout field_layout;
126 GstDeinterlaceFields fields;
128 /* current state (differs when flushing/inverse telecine using weave) */
129 GstDeinterlaceMethods method_id;
131 GstDeinterlaceMethods user_set_method_id;
132 GstDeinterlaceMethod *method;
136 GstAllocator *allocator;
137 GstAllocationParams params;
139 gboolean passthrough;
141 GstClockTime field_duration; /* Duration of one field */
143 /* The most recent pictures
144 PictureHistory[0] is always the most recent.
145 Pointers are NULL if the picture in question isn't valid, e.g. because
146 the program just started or a picture was skipped.
148 GstDeinterlaceField field_history[GST_DEINTERLACE_MAX_FIELD_HISTORY];
152 /* Set to TRUE if we're in still frame mode,
153 i.e. just forward all buffers
155 gboolean still_frame_mode;
157 /* Last buffer that was pushed in */
158 GstBuffer *last_buffer;
160 /* Current segment */
165 GstClockTime earliest_time;
169 GstCaps *request_caps;
171 gboolean reconfigure;
172 GstDeinterlaceMode new_mode;
173 GstDeinterlaceFields new_fields;
175 GstDeinterlaceLocking locking;
177 gboolean drop_orphans;
178 gboolean ignore_obscure;
179 gboolean pattern_lock;
180 gboolean pattern_refresh;
181 GstDeinterlaceBufferState buf_states[GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY];
184 guint8 pattern_phase;
185 guint8 pattern_count;
187 GstClockTime pattern_base_ts;
188 GstClockTime pattern_buf_dur;
194 struct _GstDeinterlaceClass
196 GstElementClass parent_class;
199 GType gst_deinterlace_get_type (void);
203 #endif /* __GST_DEINTERLACE_H__ */