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;
54 gboolean parse_compressed_headers;
57 GstVp9DecoderPrivate *priv;
58 gpointer padding[GST_PADDING_LARGE];
64 struct _GstVp9DecoderClass
66 GstVideoDecoderClass parent_class;
69 * GstVp9DecoderClass::new_sequence:
71 * Notifies subclass of video sequence update such as resolution, bitdepth,
76 GstFlowReturn (*new_sequence) (GstVp9Decoder * decoder,
77 const GstVp9FrameHeader *frame_hdr);
80 * GstVp9DecoderClass::new_picture:
81 * @decoder: a #GstVp9Decoder
82 * @frame: (transfer none): a #GstVideoCodecFrame
83 * @picture: (transfer none): a #GstVp9Picture
85 * Optional. Called whenever new #GstVp9Picture is created.
86 * Subclass can set implementation specific user data on the #GstVp9Picture
87 * via gst_vp9_picture_set_user_data()
91 GstFlowReturn (*new_picture) (GstVp9Decoder * decoder,
92 GstVideoCodecFrame * frame,
93 GstVp9Picture * picture);
96 * GstVp9DecoderClass::duplicate_picture:
97 * @decoder: a #GstVp9Decoder
98 * @frame: (transfer none): a #GstVideoCodecFrame
99 * @picture: (transfer none): a #GstVp9Picture to be duplicated
101 * Optional. Called to duplicate @picture when show_existing_frame flag is set
102 * in the parsed vp9 frame header. Returned #GstVp9Picture from this method
103 * should hold already decoded picture data corresponding to the @picture,
104 * since the returned #GstVp9Picture from this method will be passed to
105 * the output_picture method immediately without additional decoding process.
107 * If this method is not implemented by subclass, baseclass will drop
108 * current #GstVideoCodecFrame without additional processing for the current
111 * Returns: (transfer full): a #GstVp9Picture or %NULL if failed to duplicate
116 GstVp9Picture * (*duplicate_picture) (GstVp9Decoder * decoder,
117 GstVideoCodecFrame * frame,
118 GstVp9Picture * picture);
121 * GstVp9DecoderClass::start_picture:
122 * @decoder: a #GstVp9Decoder
123 * @picture: (transfer none): a #GstVp9Picture
125 * Optional. Called to notify subclass to prepare decoding process for
130 GstFlowReturn (*start_picture) (GstVp9Decoder * decoder,
131 GstVp9Picture * picture);
134 * GstVp9DecoderClass::decode_picture:
135 * @decoder: a #GstVp9Decoder
136 * @picture: (transfer none): a #GstVp9Picture to decoder
137 * @dpb: (transfer none): a #GstVp9Dpb
139 * Called to notify decoding for subclass to decoder given @picture with
144 GstFlowReturn (*decode_picture) (GstVp9Decoder * decoder,
145 GstVp9Picture * picture,
149 * GstVp9DecoderClass::end_picture:
150 * @decoder: a #GstVp9Decoder
151 * @picture: (transfer none): a #GstVp9Picture
153 * Optional. Called per one #GstVp9Picture to notify subclass to finish
154 * decoding process for the #GstVp9Picture
158 GstFlowReturn (*end_picture) (GstVp9Decoder * decoder,
159 GstVp9Picture * picture);
162 * GstVp9DecoderClass::output_picture:
163 * @decoder: a #GstVp9Decoder
164 * @frame: (transfer full): a #GstVideoCodecFrame
165 * @picture: (transfer full): a #GstVp9Picture
167 * Called to notify @picture is ready to be outputted.
171 GstFlowReturn (*output_picture) (GstVp9Decoder * decoder,
172 GstVideoCodecFrame * frame,
173 GstVp9Picture * picture);
176 * GstVp9DecoderClass::get_preferred_output_delay:
177 * @decoder: a #GstVp9Decoder
178 * @is_live: whether upstream is live or not
180 * Optional. Retrieve the preferred output delay from child classes.
181 * controls how many frames to delay when calling
182 * GstVp9DecoderClass::output_picture
184 * Returns: the number of perferred delayed output frame
188 guint (*get_preferred_output_delay) (GstVp9Decoder * decoder,
192 gpointer padding[GST_PADDING_LARGE];
195 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVp9Decoder, gst_object_unref)
198 GType gst_vp9_decoder_get_type (void);
201 void gst_vp9_decoder_set_non_keyframe_format_change_support (GstVp9Decoder * decoder,
206 #endif /* __GST_VP9_DECODER_H__ */