• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   gboolean need_negotiation;
81 };
82 
83 struct _GstVaBaseDecClass
84 {
85   /* <private> */
86   union
87   {
88     GstH264DecoderClass h264;
89     GstH265DecoderClass h265;
90     GstMpeg2DecoderClass mpeg2;
91     GstVp8DecoderClass vp8;
92     GstVp9DecoderClass vp9;
93     GstAV1DecoderClass av1;
94   } parent_class;
95 
96   GstVaCodecs codec;
97   gchar *render_device_path;
98   /* The parent class in GType hierarchy */
99   GstObjectClass *parent_decoder_class;
100 };
101 
102 struct CData
103 {
104   gchar *render_device_path;
105   gchar *description;
106   GstCaps *sink_caps;
107   GstCaps *src_caps;
108 };
109 
110 void                  gst_va_base_dec_init                (GstVaBaseDec * base,
111                                                            GstDebugCategory * cat);
112 void                  gst_va_base_dec_class_init          (GstVaBaseDecClass * klass,
113                                                            GstVaCodecs codec,
114                                                            const gchar * render_device_path,
115                                                            GstCaps * sink_caps,
116                                                            GstCaps * src_caps,
117                                                            GstCaps * doc_src_caps,
118                                                            GstCaps * doc_sink_caps);
119 
120 gboolean              gst_va_base_dec_close               (GstVideoDecoder * decoder);
121 void                  gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
122                                                            GstVideoFormat * format,
123                                                            GstCapsFeatures ** capsfeatures);
124 gboolean              gst_va_base_dec_copy_output_buffer  (GstVaBaseDec * base,
125                                                            GstVideoCodecFrame * codec_frame);
126 
127 G_END_DECLS
128