2 * Copyright (C) 2019 Seungha Yang <seungha.yang@navercorp.com>
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.
20 #ifndef __GST_VP9_DECODER_H__
21 #define __GST_VP9_DECODER_H__
23 #include <gst/codecs/codecs-prelude.h>
25 #include <gst/video/video.h>
26 #include <gst/codecs/gstvp9picture.h>
30 #define GST_TYPE_VP9_DECODER (gst_vp9_decoder_get_type())
31 #define GST_VP9_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VP9_DECODER,GstVp9Decoder))
32 #define GST_VP9_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VP9_DECODER,GstVp9DecoderClass))
33 #define GST_VP9_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VP9_DECODER,GstVp9DecoderClass))
34 #define GST_IS_VP9_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VP9_DECODER))
35 #define GST_IS_VP9_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VP9_DECODER))
36 #define GST_VP9_DECODER_CAST(obj) ((GstVP9Decoder*)obj)
38 typedef struct _GstVp9Decoder GstVp9Decoder;
39 typedef struct _GstVp9DecoderClass GstVp9DecoderClass;
40 typedef struct _GstVp9DecoderPrivate GstVp9DecoderPrivate;
45 * The opaque #GstVp9Decoder data structure.
50 GstVideoDecoder parent;
53 GstVideoCodecState * input_state;
56 GstVp9DecoderPrivate *priv;
57 gpointer padding[GST_PADDING_LARGE];
63 struct _GstVp9DecoderClass
65 GstVideoDecoderClass parent_class;
68 * GstVp9DecoderClass::new_sequence:
70 * Notifies subclass of video sequence update such as resolution, bitdepth,
75 GstFlowReturn (*new_sequence) (GstVp9Decoder * decoder,
76 const GstVp9FrameHeader *frame_hdr);
79 * GstVp9DecoderClass::new_picture:
80 * @decoder: a #GstVp9Decoder
81 * @frame: (transfer none): a #GstVideoCodecFrame
82 * @picture: (transfer none): a #GstVp9Picture
84 * Optional. Called whenever new #GstVp9Picture is created.
85 * Subclass can set implementation specific user data on the #GstVp9Picture
86 * via gst_vp9_picture_set_user_data()
90 GstFlowReturn (*new_picture) (GstVp9Decoder * decoder,
91 GstVideoCodecFrame * frame,
92 GstVp9Picture * picture);
95 * GstVp9DecoderClass::duplicate_picture:
96 * @decoder: a #GstVp9Decoder
97 * @frame: (transfer none): a #GstVideoCodecFrame
98 * @picture: (transfer none): a #GstVp9Picture to be duplicated
100 * Optional. Called to duplicate @picture when show_existing_frame flag is set
101 * in the parsed vp9 frame header. Returned #GstVp9Picture from this method
102 * should hold already decoded picture data corresponding to the @picture,
103 * since the returned #GstVp9Picture from this method will be passed to
104 * the output_picture method immediately without additional decoding process.
106 * If this method is not implemented by subclass, baseclass will drop
107 * current #GstVideoCodecFrame without additional processing for the current
110 * Returns: (transfer full): a #GstVp9Picture or %NULL if failed to duplicate
115 GstVp9Picture * (*duplicate_picture) (GstVp9Decoder * decoder,
116 GstVideoCodecFrame * frame,
117 GstVp9Picture * picture);
120 * GstVp9DecoderClass::start_picture:
121 * @decoder: a #GstVp9Decoder
122 * @picture: (transfer none): a #GstVp9Picture
124 * Optional. Called to notify subclass to prepare decoding process for
129 GstFlowReturn (*start_picture) (GstVp9Decoder * decoder,
130 GstVp9Picture * picture);
133 * GstVp9DecoderClass::decode_picture:
134 * @decoder: a #GstVp9Decoder
135 * @picture: (transfer none): a #GstVp9Picture to decoder
136 * @dpb: (transfer none): a #GstVp9Dpb
138 * Called to notify decoding for subclass to decoder given @picture with
143 GstFlowReturn (*decode_picture) (GstVp9Decoder * decoder,
144 GstVp9Picture * picture,
148 * GstVp9DecoderClass::end_picture:
149 * @decoder: a #GstVp9Decoder
150 * @picture: (transfer none): a #GstVp9Picture
152 * Optional. Called per one #GstVp9Picture to notify subclass to finish
153 * decoding process for the #GstVp9Picture
157 GstFlowReturn (*end_picture) (GstVp9Decoder * decoder,
158 GstVp9Picture * picture);
161 * GstVp9DecoderClass::output_picture:
162 * @decoder: a #GstVp9Decoder
163 * @frame: (transfer full): a #GstVideoCodecFrame
164 * @picture: (transfer full): a #GstVp9Picture
166 * Called to notify @picture is ready to be outputted.
170 GstFlowReturn (*output_picture) (GstVp9Decoder * decoder,
171 GstVideoCodecFrame * frame,
172 GstVp9Picture * picture);
175 * GstVp9DecoderClass::get_preferred_output_delay:
176 * @decoder: a #GstVp9Decoder
177 * @is_live: whether upstream is live or not
179 * Optional. Retrieve the preferred output delay from child classes.
180 * controls how many frames to delay when calling
181 * GstVp9DecoderClass::output_picture
183 * Returns: the number of perferred delayed output frame
187 guint (*get_preferred_output_delay) (GstVp9Decoder * decoder,
191 gpointer padding[GST_PADDING_LARGE];
194 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVp9Decoder, gst_object_unref)
197 GType gst_vp9_decoder_get_type (void);
201 #endif /* __GST_VP9_DECODER_H__ */