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_H265_PICTURE_H__
21 #define __GST_H265_PICTURE_H__
23 #ifndef GST_USE_UNSTABLE_API
24 #warning "The CODECs library is unstable API and may change in future."
25 #warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
29 #include <gst/codecs/codecs-prelude.h>
31 #include <gst/codecparsers/gsth265parser.h>
35 #define GST_TYPE_H265_PICTURE (gst_h265_picture_get_type())
36 #define GST_IS_H265_PICTURE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_H265_PICTURE))
37 #define GST_H265_PICTURE(obj) ((GstH265Picture *)obj)
38 #define GST_H265_PICTURE_CAST(obj) (GST_H265_PICTURE(obj))
40 typedef struct _GstH265Slice GstH265Slice;
41 typedef struct _GstH265Picture GstH265Picture;
43 #define GST_H265_DPB_MAX_SIZE 16
47 GstH265SliceHdr header;
49 /* parsed nal unit (doesn't take ownership of raw data) */
55 GST_H265_PICTURE_FIELD_FRAME,
56 GST_H265_PICTURE_FILED_TOP_FIELD,
57 GST_H265_PICTURE_FIELD_BOTTOM_FIELD,
58 } GstH265PictureField;
60 struct _GstH265Picture
64 GstH265SliceType type;
69 gint pic_order_cnt_msb;
70 gint pic_order_cnt_lsb;
72 guint32 pic_latency_cnt; /* PicLatencyCount */
75 gboolean NoRaslOutputFlag;
76 gboolean NoOutputOfPriorPicsFlag;
77 gboolean RapPicFlag; /* nalu type between 16 and 21 */
78 gboolean IntraPicFlag; /* Intra pic (only Intra slices) */
84 GstH265PictureField field;
87 GDestroyNotify notify;
91 GType gst_h265_picture_get_type (void);
94 GstH265Picture * gst_h265_picture_new (void);
96 static inline GstH265Picture *
97 gst_h265_picture_ref (GstH265Picture * picture)
99 return (GstH265Picture *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (picture));
103 gst_h265_picture_unref (GstH265Picture * picture)
105 gst_mini_object_unref (GST_MINI_OBJECT_CAST (picture));
108 static inline gboolean
109 gst_h265_picture_replace (GstH265Picture ** old_picture,
110 GstH265Picture * new_picture)
112 return gst_mini_object_replace ((GstMiniObject **) old_picture,
113 (GstMiniObject *) new_picture);
117 gst_h265_picture_clear (GstH265Picture ** picture)
119 if (picture && *picture) {
120 gst_h265_picture_unref (*picture);
126 void gst_h265_picture_set_user_data (GstH265Picture * picture,
128 GDestroyNotify notify);
131 gpointer gst_h265_picture_get_user_data (GstH265Picture * picture);
136 typedef struct _GstH265Dpb GstH265Dpb;
139 GstH265Dpb * gst_h265_dpb_new (void);
142 void gst_h265_dpb_set_max_num_pics (GstH265Dpb * dpb,
146 gint gst_h265_dpb_get_max_num_pics (GstH265Dpb * dpb);
149 void gst_h265_dpb_free (GstH265Dpb * dpb);
152 void gst_h265_dpb_clear (GstH265Dpb * dpb);
155 void gst_h265_dpb_add (GstH265Dpb * dpb,
156 GstH265Picture * picture);
159 void gst_h265_dpb_delete_unused (GstH265Dpb * dpb);
162 void gst_h265_dpb_delete_by_poc (GstH265Dpb * dpb,
166 gint gst_h265_dpb_num_ref_pictures (GstH265Dpb * dpb);
169 void gst_h265_dpb_mark_all_non_ref (GstH265Dpb * dpb);
172 GstH265Picture * gst_h265_dpb_get_ref_by_poc (GstH265Dpb * dpb,
176 GstH265Picture * gst_h265_dpb_get_ref_by_poc_lsb (GstH265Dpb * dpb,
180 GstH265Picture * gst_h265_dpb_get_short_ref_by_poc (GstH265Dpb * dpb,
184 GstH265Picture * gst_h265_dpb_get_long_ref_by_poc (GstH265Dpb * dpb,
188 void gst_h265_dpb_get_pictures_not_outputted (GstH265Dpb * dpb,
192 GArray * gst_h265_dpb_get_pictures_all (GstH265Dpb * dpb);
195 gint gst_h265_dpb_get_size (GstH265Dpb * dpb);
198 gboolean gst_h265_dpb_is_full (GstH265Dpb * dpb);
202 #endif /* __GST_H265_PICTURE_H__ */