2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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.
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.
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.
21 #ifndef __GST_MPEG2DEC_H__
22 #define __GST_MPEG2DEC_H__
26 #include <gst/video/video.h>
27 #include <gst/video/gstvideodecoder.h>
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))
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))
46 typedef struct _GstMpeg2dec GstMpeg2dec;
47 typedef struct _GstMpeg2decClass GstMpeg2decClass;
51 MPEG2DEC_DISC_NONE = 0,
52 MPEG2DEC_DISC_NEW_PICTURE,
53 MPEG2DEC_DISC_NEW_KEYFRAME
57 GstVideoDecoder element;
60 const mpeg2_info_t *info;
62 /* Buffer lifetime management */
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
69 DiscontState discont_state;
72 GstVideoCodecState *input_state;
73 GstVideoInfo decoded_info;
74 GstVideoAlignment valign;
75 GstBufferPool * downstream_pool;
76 gboolean need_alignment;
81 struct _GstMpeg2decClass {
82 GstVideoDecoderClass parent_class;
85 GType gst_mpeg2dec_get_type(void);
86 GST_ELEMENT_REGISTER_DECLARE (mpeg2dec);
90 #endif /* __GST_MPEG2DEC_H__ */