va: Move back parent_object to each element.
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / va / gstvabasedec.h
1
2 /* GStreamer
3  * Copyright (C) 2020 Igalia, S.L.
4  *     Author: Víctor Jáquez <vjaquez@igalia.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the0
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #pragma once
23
24 #include <gst/codecs/gsth264decoder.h>
25 #include <gst/codecs/gsth265decoder.h>
26 #include <gst/codecs/gstmpeg2decoder.h>
27 #include <gst/codecs/gstvp8decoder.h>
28 #include <gst/codecs/gstvp9decoder.h>
29 #include <gst/codecs/gstav1decoder.h>
30
31 #include "gstvadevice.h"
32 #include "gstvadecoder.h"
33 #include "gstvaprofile.h"
34
35 G_BEGIN_DECLS
36
37 #define GST_VA_BASE_DEC(obj) ((GstVaBaseDec *)(obj))
38 #define GST_VA_BASE_DEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_FROM_INSTANCE (obj), GstVaBaseDecClass))
39 #define GST_VA_BASE_DEC_CLASS(klass) ((GstVaBaseDecClass *)(klass))
40
41 typedef struct _GstVaBaseDec GstVaBaseDec;
42 typedef struct _GstVaBaseDecClass GstVaBaseDecClass;
43
44 struct _GstVaBaseDec
45 {
46   /* <private> */
47   union
48   {
49     GstH264Decoder h264;
50     GstH265Decoder h265;
51     GstMpeg2Decoder mpeg2;
52     GstVp8Decoder vp8;
53     GstVp9Decoder vp9;
54     GstAV1Decoder av1;
55   } parent;
56
57   GstDebugCategory *debug_category;
58
59   GstVaDisplay *display;
60   GstVaDecoder *decoder;
61
62   VAProfile profile;
63   guint rt_format;
64   gint width;
65   gint height;
66
67   guint min_buffers;
68
69   GstVideoCodecState *output_state;
70   GstBufferPool *other_pool;
71
72   gboolean need_valign;
73   GstVideoAlignment valign;
74
75   gboolean copy_frames;
76
77   gboolean apply_video_crop;
78   GstVideoConverter *convert;
79 };
80
81 struct _GstVaBaseDecClass
82 {
83   /* <private> */
84   union
85   {
86     GstH264DecoderClass h264;
87     GstH265DecoderClass h265;
88     GstMpeg2DecoderClass mpeg2;
89     GstVp8DecoderClass vp8;
90     GstVp9DecoderClass vp9;
91     GstAV1DecoderClass av1;
92   } parent_class;
93
94   GstVaCodecs codec;
95   gchar *render_device_path;
96   /* The parent class in GType hierarchy */
97   GstObjectClass *parent_decoder_class;
98 };
99
100 struct CData
101 {
102   gchar *render_device_path;
103   gchar *description;
104   GstCaps *sink_caps;
105   GstCaps *src_caps;
106 };
107
108 void                  gst_va_base_dec_init                (GstVaBaseDec * base,
109                                                            GstDebugCategory * cat);
110 void                  gst_va_base_dec_class_init          (GstVaBaseDecClass * klass,
111                                                            GstVaCodecs codec,
112                                                            const gchar * render_device_path,
113                                                            GstCaps * sink_caps,
114                                                            GstCaps * src_caps,
115                                                            GstCaps * doc_src_caps,
116                                                            GstCaps * doc_sink_caps);
117
118 gboolean              gst_va_base_dec_close               (GstVideoDecoder * decoder);
119 void                  gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
120                                                            GstVideoFormat * format,
121                                                            GstCapsFeatures ** capsfeatures);
122 gboolean              gst_va_base_dec_copy_output_buffer  (GstVaBaseDec * base,
123                                                            GstVideoCodecFrame * codec_frame);
124
125 G_END_DECLS