1 /* GStreamer
2  * Copyright (C) <2007> Jan Schmidt <thaytan@mad.scientist.com>
3  * Copyright (C) <2011> Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
4  * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
5  * Copyright (C) <2011> Collabora ltd
6  * Copyright (C) <2011> Nokia Corporation
7  * Copyright (C) <2011> Intel Corporation
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 #ifndef __GST_MPEGVIDEO_PARSE_H__
26 #define __GST_MPEGVIDEO_PARSE_H__
27 
28 #include <gst/gst.h>
29 #include <gst/base/gstbaseparse.h>
30 
31 #include <gst/codecparsers/gstmpegvideoparser.h>
32 
33 G_BEGIN_DECLS
34 
35 #define GST_TYPE_MPEGVIDEO_PARSE            (gst_mpegv_parse_get_type())
36 #define GST_MPEGVIDEO_PARSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),\
37                                 GST_TYPE_MPEGVIDEO_PARSE, GstMpegvParse))
38 #define GST_MPEGVIDEO_PARSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),\
39                                 GST_TYPE_MPEGVIDEO_PARSE, GstMpegvParseClass))
40 #define GST_MPEGVIDEO_PARSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),\
41                                 GST_TYPE_MPEGVIDEO_PARSE, GstMpegvParseClass))
42 #define GST_IS_MPEGVIDEO_PARSE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
43                                 GST_TYPE_MPEGVIDEO_PARSE))
44 #define GST_IS_MPEGVIDEO_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
45                                 GST_TYPE_MPEGVIDEO_PARSE))
46 
47 typedef struct _GstMpegvParse GstMpegvParse;
48 typedef struct _GstMpegvParseClass GstMpegvParseClass;
49 
50 /* Config/sequence flags. Reset each time config is re-parsed */
51 enum {
52   FLAG_NONE = 0,
53   FLAG_MPEG2 = 1,
54   FLAG_SEQUENCE_EXT = 2,
55   FLAG_SEQUENCE_DISPLAY_EXT = 4
56 };
57 
58 struct _GstMpegvParse {
59   GstBaseParse element;
60 
61   /* parse state */
62   gint ext_offsets[10];
63   gint ext_count;
64   gint last_sc;
65   gint seq_offset;
66   gint seq_size;
67   gint pic_offset;
68   guint slice_count;
69   guint slice_offset;
70   gboolean update_caps;
71   gboolean send_codec_tag;
72   gboolean send_mpeg_meta;
73 
74   GstBuffer *config;
75   guint8 profile;
76   guint config_flags;
77   GstMpegVideoSequenceHdr sequencehdr;
78   GstMpegVideoSequenceExt sequenceext;
79   GstMpegVideoSequenceDisplayExt sequencedispext;
80   GstMpegVideoPictureHdr pichdr;
81   GstMpegVideoPictureExt picext;
82   GstMpegVideoQuantMatrixExt quantmatrext;
83 
84   gboolean seqhdr_updated;
85   gboolean seqext_updated;
86   gboolean seqdispext_updated;
87   gboolean picext_updated;
88   gboolean quantmatrext_updated;
89 
90   /* pending closed captions */
91   guint8 closedcaptions[96];
92   guint closedcaptions_size;
93   GstVideoCaptionType closedcaptions_type;
94 
95   /* properties */
96   gboolean drop;
97   gboolean gop_split;
98 
99   int fps_num;
100   int fps_den;
101   int frame_repeat_count;
102 };
103 
104 struct _GstMpegvParseClass {
105   GstBaseParseClass parent_class;
106 };
107 
108 GType gst_mpegv_parse_get_type (void);
109 
110 G_END_DECLS
111 
112 #endif /* __GST_MPEGVIDEO_PARSE_H__ */
113