• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011, Hewlett-Packard Development Company, L.P.
3  *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation
8  * version 2.1 of the License.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
18  *
19  */
20 
21 #ifndef __GST_VC1_PARSE_H__
22 #define __GST_VC1_PARSE_H__
23 
24 #include <gst/gst.h>
25 #include <gst/base/gstbaseparse.h>
26 #include <gst/codecparsers/gstvc1parser.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GST_TYPE_VC1_PARSE \
31   (gst_vc1_parse_get_type())
32 #define GST_VC1_PARSE(obj) \
33   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VC1_PARSE,GstVC1Parse))
34 #define GST_VC1_PARSE_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VC1_PARSE,GstVC1ParseClass))
36 #define GST_IS_VC1_PARSE(obj) \
37   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VC1_PARSE))
38 #define GST_IS_VC1_PARSE_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VC1_PARSE))
40 
41 typedef enum {
42   VC1_HEADER_FORMAT_NONE = 0,
43   VC1_HEADER_FORMAT_ASF,
44   VC1_HEADER_FORMAT_SEQUENCE_LAYER
45 } VC1HeaderFormat;
46 
47 typedef enum {
48   VC1_STREAM_FORMAT_BDU = 0,
49   VC1_STREAM_FORMAT_BDU_FRAME,
50   VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU,
51   VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME,
52   VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME,
53   VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER,
54   VC1_STREAM_FORMAT_ASF,
55   VC1_STREAM_FORMAT_FRAME_LAYER
56 } VC1StreamFormat;
57 
58 typedef enum {
59   GST_VC1_PARSE_FORMAT_WMV3 = 0,
60   GST_VC1_PARSE_FORMAT_WVC1
61 } GstVC1ParseFormat;
62 
63 /* FIXME move into baseparse, or anything equivalent;
64  * see https://bugzilla.gnome.org/show_bug.cgi?id=650093
65  * #define GST_BASE_PARSE_FRAME_FLAG_PARSING   0x100000 */
66 
67 typedef struct _GstVC1Parse GstVC1Parse;
68 typedef struct _GstVC1ParseClass GstVC1ParseClass;
69 
70 struct _GstVC1Parse
71 {
72   GstBaseParse baseparse;
73 
74   /* Caps */
75   GstVC1Profile profile;
76   GstVC1Level level;
77   GstVC1ParseFormat format;
78   gint width, height;
79 
80   gint fps_n, fps_d;
81   gboolean fps_from_caps;
82   GstClockTime frame_duration;
83   gint par_n, par_d;
84   gboolean par_from_caps;
85 
86   /* TRUE if we should negotiate with downstream */
87   gboolean renegotiate;
88   /* TRUE if the srcpads should be updated */
89   gboolean update_caps;
90 
91   gboolean sent_codec_tag;
92 
93   VC1HeaderFormat input_header_format;
94   VC1HeaderFormat output_header_format;
95   VC1StreamFormat input_stream_format;
96   VC1StreamFormat output_stream_format;
97   gboolean detecting_stream_format;
98 
99   GstVC1SeqHdr seq_hdr;
100   GstBuffer *seq_hdr_buffer;
101   GstBuffer *entrypoint_buffer;
102 
103   GstVC1SeqLayer seq_layer;
104   GstBuffer *seq_layer_buffer;
105 
106   /* Metadata about the currently parsed frame, only
107    * valid if the GstBaseParseFrame has the
108    * GST_BASE_PARSE_FRAME_FLAG_PARSING flag */
109   GstVC1StartCode startcode;
110 
111   /* TRUE if we have already sent the sequence-layer,
112    * use for stream-format conversion */
113   gboolean seq_layer_sent;
114 
115   /* TRUE if we have already sent the frame-layer first frame,
116    * use for stream-format conversion */
117   gboolean frame_layer_first_frame_sent;
118 };
119 
120 struct _GstVC1ParseClass
121 {
122   GstBaseParseClass parent_class;
123 };
124 
125 G_END_DECLS
126 
127 GType gst_vc1_parse_get_type (void);
128 
129 #endif /* __GST_VC1_PARSE_H__ */
130