1 /* GStreamer
2 * Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
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_VP8_PICTURE_H__
21 #define __GST_VP8_PICTURE_H__
22
23 #include <gst/codecs/codecs-prelude.h>
24 #include <gst/codecparsers/gstvp8parser.h>
25
26 G_BEGIN_DECLS
27
28 #define GST_TYPE_VP8_PICTURE (gst_vp8_picture_get_type())
29 #define GST_IS_VP8_PICTURE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_VP8_PICTURE))
30 #define GST_VP8_PICTURE(obj) ((GstVp8Picture *)obj)
31 #define GST_VP8_PICTURE_CAST(obj) (GST_VP8_PICTURE(obj))
32
33 typedef struct _GstVp8Picture GstVp8Picture;
34
35 struct _GstVp8Picture
36 {
37 GstMiniObject parent;
38
39 GstClockTime pts;
40 /* From GstVideoCodecFrame */
41 guint32 system_frame_number;
42
43 GstVp8FrameHdr frame_hdr;
44
45 /* raw data and size (does not have ownership) */
46 const guint8 * data;
47 gsize size;
48
49 gpointer user_data;
50 GDestroyNotify notify;
51 };
52
53 GST_CODECS_API
54 GType gst_vp8_picture_get_type (void);
55
56 GST_CODECS_API
57 GstVp8Picture * gst_vp8_picture_new (void);
58
59 static inline GstVp8Picture *
gst_vp8_picture_ref(GstVp8Picture * picture)60 gst_vp8_picture_ref (GstVp8Picture * picture)
61 {
62 return (GstVp8Picture *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (picture));
63 }
64
65 static inline void
gst_vp8_picture_unref(GstVp8Picture * picture)66 gst_vp8_picture_unref (GstVp8Picture * picture)
67 {
68 gst_mini_object_unref (GST_MINI_OBJECT_CAST (picture));
69 }
70
71 static inline gboolean
gst_vp8_picture_replace(GstVp8Picture ** old_picture,GstVp8Picture * new_picture)72 gst_vp8_picture_replace (GstVp8Picture ** old_picture,
73 GstVp8Picture * new_picture)
74 {
75 return gst_mini_object_replace ((GstMiniObject **) old_picture,
76 (GstMiniObject *) new_picture);
77 }
78
79 static inline void
gst_vp8_picture_clear(GstVp8Picture ** picture)80 gst_vp8_picture_clear (GstVp8Picture ** picture)
81 {
82 if (picture && *picture) {
83 gst_vp8_picture_unref (*picture);
84 *picture = NULL;
85 }
86 }
87
88 GST_CODECS_API
89 void gst_vp8_picture_set_user_data (GstVp8Picture * picture,
90 gpointer user_data,
91 GDestroyNotify notify);
92
93 GST_CODECS_API
94 gpointer gst_vp8_picture_get_user_data (GstVp8Picture * picture);
95
96 G_END_DECLS
97
98 #endif /* __GST_VP8_PICTURE_H__ */
99