summaryrefslogtreecommitdiff
path: root/gst-libs/gst/codecs/gstav1picture.h
blob: 916f97fdb9e1b6caa3921d38b7fca8d2eaeb89f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* GStreamer
 * Copyright (C) 2020 He Junyan <junyan.he@intel.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GST_AV1_PICTURE_H__
#define __GST_AV1_PICTURE_H__

#include <gst/codecs/codecs-prelude.h>
#include <gst/codecparsers/gstav1parser.h>

G_BEGIN_DECLS

/**
 * GST_TYPE_AV1_PICTURE:
 *
 * Since: 1.20
 */
#define GST_TYPE_AV1_PICTURE     (gst_av1_picture_get_type())
/**
 * GST_IS_AV1_PICTURE:
 *
 * Since: 1.20
 */
#define GST_IS_AV1_PICTURE(obj)  (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_AV1_PICTURE))
/**
 * GST_AV1_PICTURE:
 *
 * Since: 1.20
 */
#define GST_AV1_PICTURE(obj)     ((GstAV1Picture *)obj)

typedef struct _GstAV1Picture GstAV1Picture;
typedef struct _GstAV1Tile GstAV1Tile;

/**
 * GstAV1Tile:
 *
 * Since: 1.20
 */
struct _GstAV1Tile
{
  GstAV1TileGroupOBU tile_group;
  /* raw data and size of tile group (does not have ownership) */
  GstAV1OBU obu;
};

/**
 * GstAV1Picture:
 *
 * Since: 1.20
 */
struct _GstAV1Picture
{
  GstMiniObject parent;

  /* From GstVideoCodecFrame */
  guint32 system_frame_number;

  GstAV1FrameHeaderOBU frame_hdr;

  /* copied from parser */
  guint32 display_frame_id;
  gboolean show_frame;
  gboolean showable_frame;
  gboolean apply_grain;

  gpointer user_data;
  GDestroyNotify notify;
};

GST_CODECS_API
GType gst_av1_picture_get_type (void);

GST_CODECS_API
GstAV1Picture * gst_av1_picture_new (void);

static inline GstAV1Picture *
gst_av1_picture_ref (GstAV1Picture * picture)
{
  return (GstAV1Picture *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (picture));
}

static inline void
gst_av1_picture_unref (GstAV1Picture * picture)
{
  gst_mini_object_unref (GST_MINI_OBJECT_CAST (picture));
}

static inline gboolean
gst_av1_picture_replace (GstAV1Picture ** old_picture,
    GstAV1Picture * new_picture)
{
  return gst_mini_object_replace ((GstMiniObject **) old_picture,
      (GstMiniObject *) new_picture);
}

static inline void
gst_av1_picture_clear (GstAV1Picture ** picture)
{
  if (picture && *picture) {
    gst_av1_picture_unref (*picture);
    *picture = NULL;
  }
}

GST_CODECS_API
void gst_av1_picture_set_user_data (GstAV1Picture * picture,
                                    gpointer user_data,
                                    GDestroyNotify notify);

GST_CODECS_API
gpointer gst_av1_picture_get_user_data (GstAV1Picture * picture);

/*******************
 * GstAV1Dpb *
 *******************/
typedef struct _GstAV1Dpb GstAV1Dpb;

/**
 * GstAV1Dpb:
 *
 * Since: 1.20
 */
struct _GstAV1Dpb
{
  GstAV1Picture *pic_list[GST_AV1_NUM_REF_FRAMES];
};

GST_CODECS_API
GstAV1Dpb * gst_av1_dpb_new (void);

GST_CODECS_API
void  gst_av1_dpb_free             (GstAV1Dpb * dpb);

GST_CODECS_API
void  gst_av1_dpb_clear            (GstAV1Dpb * dpb);

GST_CODECS_API
void  gst_av1_dpb_add              (GstAV1Dpb * dpb,
                                    GstAV1Picture * picture);

G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAV1Picture, gst_av1_picture_unref)

G_END_DECLS

#endif /* __GST_AV1_PICTURE_H__ */