1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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_VIDEO_RATE_H__
21 #define __GST_VIDEO_RATE_H__
22 
23 #include <gst/gst.h>
24 #include <gst/base/gstbasetransform.h>
25 
26 G_BEGIN_DECLS
27 #define GST_TYPE_VIDEO_RATE \
28   (gst_video_rate_get_type())
29 #define GST_VIDEO_RATE(obj) \
30   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_RATE,GstVideoRate))
31 #define GST_VIDEO_RATE_CLASS(klass) \
32   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_RATE,GstVideoRateClass))
33 #define GST_IS_VIDEO_RATE(obj) \
34   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_RATE))
35 #define GST_IS_VIDEO_RATE_CLASS(klass) \
36   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_RATE))
37 typedef struct _GstVideoRate GstVideoRate;
38 typedef struct _GstVideoRateClass GstVideoRateClass;
39 
40 /**
41  * GstVideoRate:
42  *
43  * Opaque data structure.
44  */
45 struct _GstVideoRate
46 {
47   GstBaseTransform parent;
48 
49   /* video state */
50   gint from_rate_numerator, from_rate_denominator;
51   gint to_rate_numerator, to_rate_denominator;
52   guint64 next_ts;              /* Timestamp of next buffer to output */
53   GstBuffer *prevbuf;
54   guint64 prev_ts;              /* Previous buffer timestamp */
55   guint64 out_frame_count;      /* number of frames output since the beginning
56                                  * of the segment or the last frame rate caps
57                                  * change, whichever was later */
58   guint64 base_ts;              /* used in next_ts calculation after a
59                                  * frame rate caps change */
60   gboolean discont;
61   guint64 last_ts;              /* Timestamp of last input buffer */
62 
63   guint64 average_period;
64   GstClockTimeDiff wanted_diff; /* target average diff */
65   GstClockTimeDiff average;     /* moving average period */
66   gboolean force_variable_rate;
67   gboolean updating_caps;
68   guint64 max_duplication_time;
69 
70   /* segment handling */
71   GstSegment segment;
72 
73   /* properties */
74   guint64 in, out, dup, drop;
75   gboolean silent;
76   gdouble new_pref;
77   gboolean skip_to_first;
78   gboolean drop_only;
79   guint64 average_period_set;
80 
81   volatile int max_rate;
82   gdouble rate;
83 };
84 
85 struct _GstVideoRateClass
86 {
87   GstBaseTransformClass parent_class;
88 };
89 
90 GType gst_video_rate_get_type (void);
91 
92 G_END_DECLS
93 #endif /* __GST_VIDEO_RATE_H__ */
94