Move files from gst-plugins-ugly into the "subprojects/gst-plugins-ugly/" subdir
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-ugly / ext / mpeg2dec / gstmpeg2dec.h
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
21 #ifndef __GST_MPEG2DEC_H__
22 #define __GST_MPEG2DEC_H__
23
24
25 #include <gst/gst.h>
26 #include <gst/video/video.h>
27 #include <gst/video/gstvideodecoder.h>
28 #include <mpeg2.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_MPEG2DEC \
33   (gst_mpeg2dec_get_type())
34 #define GST_MPEG2DEC(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MPEG2DEC,GstMpeg2dec))
36 #define GST_MPEG2DEC_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MPEG2DEC,GstMpeg2decClass))
38 #define GST_IS_MPEG2DEC(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPEG2DEC))
40 #define GST_IS_MPEG2DEC_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEG2DEC))
42
43 #define MPEG_TIME_TO_GST_TIME(time) ((time) == -1 ? -1 : ((time) * (GST_MSECOND/10)) / G_GINT64_CONSTANT(9))
44 #define GST_TIME_TO_MPEG_TIME(time) ((time) == -1 ? -1 : ((time) * G_GINT64_CONSTANT(9)) / (GST_MSECOND/10))
45
46 typedef struct _GstMpeg2dec GstMpeg2dec;
47 typedef struct _GstMpeg2decClass GstMpeg2decClass;
48
49 typedef enum
50 {
51   MPEG2DEC_DISC_NONE            = 0,
52   MPEG2DEC_DISC_NEW_PICTURE,
53   MPEG2DEC_DISC_NEW_KEYFRAME
54 } DiscontState;
55
56 struct _GstMpeg2dec {
57   GstVideoDecoder element;
58
59   mpeg2dec_t    *decoder;
60   const mpeg2_info_t *info;
61
62   /* Buffer lifetime management */
63   GList         *buffers;
64
65   /* FIXME This should not be necessary. It is used to prevent image
66    * corruption when the parser does not behave the way it should.
67    * See https://bugzilla.gnome.org/show_bug.cgi?id=674238
68    */
69   DiscontState   discont_state;
70
71   /* video state */
72   GstVideoCodecState *input_state;
73   GstVideoInfo        decoded_info;
74   GstVideoAlignment   valign;
75   GstBufferPool *     downstream_pool;
76   gboolean            need_alignment;
77
78   guint8        *dummybuf[4];
79 };
80
81 struct _GstMpeg2decClass {
82   GstVideoDecoderClass parent_class;
83 };
84
85 GType gst_mpeg2dec_get_type(void);
86 GST_ELEMENT_REGISTER_DECLARE (mpeg2dec);
87
88 G_END_DECLS
89
90 #endif /* __GST_MPEG2DEC_H__ */