Debian Codegraph @

gst-libs/gst/codecs/gstav1picture.h

raw symbols SCIP
1 /* GStreamer
2 * Copyright (C) 2020 He Junyan <[email protected]>
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_PICTURE_H__
21 #define __GST_AV1_PICTURE_H__
22
23 #include <gst/codecs/codecs-prelude.h>
24 #include <gst/codecs/gstcodecpicture.h>
25 #include <gst/codecparsers/gstav1parser.h>
26 #include <gst/video/video.h>
27
28 G_BEGIN_DECLS
29
30 /**
31 * GST_TYPE_AV1_PICTURE:
32 *
33 * Since: 1.20
34 */
35 #define GST_TYPE_AV1_PICTURE (gst_av1_picture_get_type())
36 /**
37 * GST_IS_AV1_PICTURE:
38 *
39 * Since: 1.20
40 */
41 #define GST_IS_AV1_PICTURE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_AV1_PICTURE))
42 /**
43 * GST_AV1_PICTURE:
44 *
45 * Since: 1.20
46 */
47 #define GST_AV1_PICTURE(obj) ((GstAV1Picture *)obj)
48
49 typedef struct _GstAV1Picture GstAV1Picture;
50 typedef struct _GstAV1Tile GstAV1Tile;
51
52 /**
53 * GstAV1Tile:
54 *
55 * Since: 1.20
56 */
57 struct _GstAV1Tile
58 {
59 GstAV1TileGroupOBU tile_group;
60 /* raw data and size of tile group (does not have ownership) */
61 GstAV1OBU obu;
62 };
63
64 /**
65 * GstAV1Picture:
66 *
67 * Since: 1.20
68 */
69 struct _GstAV1Picture
70 {
71 /*< private >*/
72 GstCodecPicture parent;
73
74 GstAV1FrameHeaderOBU frame_hdr;
75
76 /* from OBU header */
77 guint8 temporal_id;
78 guint8 spatial_id;
79
80 /* copied from parser */
81 guint32 display_frame_id;
82 gboolean show_frame;
83 gboolean showable_frame;
84 gboolean apply_grain;
85 };
86
87 GST_CODECS_API
88 GType gst_av1_picture_get_type (void);
89
90 GST_CODECS_API
91 GstAV1Picture * gst_av1_picture_new (void) G_GNUC_WARN_UNUSED_RESULT;
92
93 static inline GstAV1Picture *
94 gst_av1_picture_ref (GstAV1Picture * picture)
95 {
96 return (GstAV1Picture *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (picture));
97 }
98
99 static inline void
100 gst_av1_picture_unref (GstAV1Picture * picture)
101 {
102 gst_mini_object_unref (GST_MINI_OBJECT_CAST (picture));
103 }
104
105 static inline gboolean
106 gst_av1_picture_replace (GstAV1Picture ** old_picture,
107 GstAV1Picture * new_picture)
108 {
109 return gst_mini_object_replace ((GstMiniObject **) old_picture,
110 (GstMiniObject *) new_picture);
111 }
112
113 static inline void
114 gst_clear_av1_picture (GstAV1Picture ** picture)
115 {
116 if (picture && *picture) {
117 gst_av1_picture_unref (*picture);
118 *picture = NULL;
119 }
120 }
121
122 static inline void
123 gst_av1_picture_set_user_data (GstAV1Picture * picture, gpointer user_data,
124 GDestroyNotify notify)
125 {
126 gst_codec_picture_set_user_data (GST_CODEC_PICTURE (picture),
127 user_data, notify);
128 }
129
130 static inline gpointer
131 gst_av1_picture_get_user_data (GstAV1Picture * picture)
132 {
133 return gst_codec_picture_get_user_data (GST_CODEC_PICTURE (picture));
134 }
135
136 static inline void
137 gst_av1_picture_set_discont_state (GstAV1Picture * picture,
138 GstVideoCodecState * discont_state)
139 {
140 gst_codec_picture_set_discont_state (GST_CODEC_PICTURE (picture),
141 discont_state);
142 }
143
144 /*******************
145 * GstAV1Dpb *
146 *******************/
147 typedef struct _GstAV1Dpb GstAV1Dpb;
148
149 /**
150 * GstAV1Dpb:
151 *
152 * Since: 1.20
153 */
154 struct _GstAV1Dpb
155 {
156 GstAV1Picture *pic_list[GST_AV1_NUM_REF_FRAMES];
157 };
158
159 GST_CODECS_API
160 GstAV1Dpb * gst_av1_dpb_new (void);
161
162 GST_CODECS_API
163 void gst_av1_dpb_free (GstAV1Dpb * dpb);
164
165 GST_CODECS_API
166 void gst_av1_dpb_clear (GstAV1Dpb * dpb);
167
168 GST_CODECS_API
169 void gst_av1_dpb_add (GstAV1Dpb * dpb,
170 GstAV1Picture * picture);
171
172 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAV1Picture, gst_av1_picture_unref)
173
174 G_END_DECLS
175
176 #endif /* __GST_AV1_PICTURE_H__ */