• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2020 He Junyan <junyan.he@intel.com>
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_AV1_DECODER_H__
21 #define __GST_AV1_DECODER_H__
22 
23 #include <gst/codecs/codecs-prelude.h>
24 
25 #include <gst/video/video.h>
26 #include <gst/codecparsers/gstav1parser.h>
27 #include <gst/codecs/gstav1picture.h>
28 
29 G_BEGIN_DECLS
30 
31 #define GST_TYPE_AV1_DECODER            (gst_av1_decoder_get_type())
32 #define GST_AV1_DECODER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AV1_DECODER,GstAV1Decoder))
33 #define GST_AV1_DECODER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AV1_DECODER,GstAV1DecoderClass))
34 #define GST_AV1_DECODER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AV1_DECODER,GstAV1DecoderClass))
35 #define GST_IS_AV1_DECODER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AV1_DECODER))
36 #define GST_IS_AV1_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AV1_DECODER))
37 
38 typedef struct _GstAV1Decoder GstAV1Decoder;
39 typedef struct _GstAV1DecoderClass GstAV1DecoderClass;
40 typedef struct _GstAV1DecoderPrivate GstAV1DecoderPrivate;
41 
42 /**
43  * GstAV1Decoder:
44  *
45  * The opaque #GstAV1Decoder data structure.
46  *
47  * Since: 1.20
48  */
49 struct _GstAV1Decoder
50 {
51   /*< private >*/
52   GstVideoDecoder parent;
53 
54   /*< protected >*/
55   GstVideoCodecState * input_state;
56 
57   /*< private >*/
58   GstAV1DecoderPrivate *priv;
59   gpointer padding[GST_PADDING_LARGE];
60 };
61 
62 /**
63  * GstAV1DecoderClass:
64  */
65 struct _GstAV1DecoderClass
66 {
67   GstVideoDecoderClass parent_class;
68 
69   /**
70    * GstAV1DecoderClass::new_sequence:
71    * @decoder: a #GstAV1Decoder
72    * @seq_hdr: a #GstAV1SequenceHeaderOBU
73    *
74    * Notifies subclass of SPS update
75    *
76    * Since: 1.20
77    */
78   GstFlowReturn   (*new_sequence)      (GstAV1Decoder * decoder,
79                                         const GstAV1SequenceHeaderOBU * seq_hdr);
80   /**
81    * GstAV1DecoderClass::new_picture:
82    * @decoder: a #GstAV1Decoder
83    * @frame: (transfer none): a #GstVideoCodecFrame
84    * @picture: (transfer none): a #GstAV1Picture
85    *
86    * Optional. Called whenever new #GstAV1Picture is created.
87    * Subclass can set implementation specific user data
88    * on the #GstAV1Picture via gst_av1_picture_set_user_data()
89    *
90    * Since: 1.20
91    */
92   GstFlowReturn   (*new_picture)       (GstAV1Decoder * decoder,
93                                         GstVideoCodecFrame * frame,
94                                         GstAV1Picture * picture);
95   /**
96    * GstAV1DecoderClass::duplicate_picture:
97    * @decoder: a #GstAV1Decoder
98    * @picture: (transfer none): a #GstAV1Picture
99    *
100    * Optional. Called when need to duplicate an existing
101    * #GstAV1Picture.
102    *
103    * Since: 1.20
104    */
105   GstAV1Picture * (*duplicate_picture) (GstAV1Decoder * decoder,
106                                         GstAV1Picture * picture);
107   /**
108    * GstAV1DecoderClass::start_picture:
109    * @decoder: a #GstAV1Decoder
110    * @picture: (transfer none): a #GstAV1Picture
111    * @dpb: (transfer none): a #GstAV1Dpb
112    *
113    * Optional. Called per one #GstAV1Picture to notify subclass to prepare
114    * decoding process for the #GstAV1Picture
115    *
116    * Since: 1.20
117    */
118   GstFlowReturn   (*start_picture)     (GstAV1Decoder * decoder,
119                                         GstAV1Picture * picture,
120                                         GstAV1Dpb * dpb);
121   /**
122    * GstAV1DecoderClass::decode_tile:
123    * @decoder: a #GstAV1Decoder
124    * @picture: (transfer none): a #GstAV1Picture
125    * @tile: (transfer none): a #GstAV1Tile
126    *
127    * Provides the tile data with tile group header and required raw
128    * bitstream for subclass to decode it.
129    *
130    * Since: 1.20
131    */
132   GstFlowReturn   (*decode_tile)       (GstAV1Decoder * decoder,
133                                         GstAV1Picture * picture,
134                                         GstAV1Tile * tile);
135   /**
136    * GstAV1DecoderClass::end_picture:
137    * @decoder: a #GstAV1Decoder
138    * @picture: (transfer none): a #GstAV1Picture
139    *
140    * Optional. Called per one #GstAV1Picture to notify subclass to finish
141    * decoding process for the #GstAV1Picture
142    *
143    * Since: 1.20
144    */
145   GstFlowReturn   (*end_picture)       (GstAV1Decoder * decoder,
146                                         GstAV1Picture * picture);
147   /**
148    * GstAV1DecoderClass::output_picture:
149    * @decoder: a #GstAV1Decoder
150    * @frame: (transfer full): a #GstVideoCodecFrame
151    * @picture: (transfer full): a #GstAV1Picture
152    *
153    * Called with a #GstAV1Picture which is required to be outputted.
154    * The #GstVideoCodecFrame must be consumed by subclass.
155    *
156    * Since: 1.20
157    */
158   GstFlowReturn   (*output_picture)    (GstAV1Decoder * decoder,
159                                         GstVideoCodecFrame * frame,
160                                         GstAV1Picture * picture);
161 
162   /*< private >*/
163   gpointer padding[GST_PADDING_LARGE];
164 };
165 
166 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAV1Decoder, gst_object_unref)
167 
168 GST_CODECS_API
169 GType gst_av1_decoder_get_type (void);
170 
171 G_END_DECLS
172 
173 #endif /* __GST_AV1_DECODER_H__ */
174