Merging gst-plugins-bad
[platform/upstream/gstreamer.git] / sys / va / gstvadecoder.h
1 /* GStreamer
2  * Copyright (C) 2020 Igalia, S.L.
3  *     Author: Víctor Jáquez <vjaquez@igalia.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #pragma once
22
23 #include <gst/va/gstvadisplay.h>
24 #include <va/va.h>
25
26 G_BEGIN_DECLS
27
28 typedef struct _GstVaDecodePicture GstVaDecodePicture;
29 struct _GstVaDecodePicture
30 {
31   GstVaDisplay *display;
32   GArray *buffers;
33   GArray *slices;
34   GstBuffer *gstbuffer;
35 };
36
37 #define GST_TYPE_VA_DECODER (gst_va_decoder_get_type())
38 G_DECLARE_FINAL_TYPE (GstVaDecoder, gst_va_decoder, GST, VA_DECODER, GstObject)
39
40 GstVaDecoder *        gst_va_decoder_new                  (GstVaDisplay * display,
41                                                            guint32 codec);
42 gboolean              gst_va_decoder_open                 (GstVaDecoder * self,
43                                                            VAProfile profile,
44                                                            guint rt_format);
45 gboolean              gst_va_decoder_close                (GstVaDecoder * self);
46 gboolean              gst_va_decoder_is_open              (GstVaDecoder * self);
47 gboolean              gst_va_decoder_set_frame_size_with_surfaces
48                                                           (GstVaDecoder * self,
49                                                            gint coded_width,
50                                                            gint coded_height,
51                                                            GArray * surfaces);
52 gboolean              gst_va_decoder_set_frame_size       (GstVaDecoder * self,
53                                                            gint coded_width,
54                                                            gint coded_height);
55 gboolean              gst_va_decoder_update_frame_size    (GstVaDecoder * self,
56                                                            gint coded_width,
57                                                            gint coded_height);
58 GstCaps *             gst_va_decoder_get_srcpad_caps      (GstVaDecoder * self);
59 GstCaps *             gst_va_decoder_get_sinkpad_caps     (GstVaDecoder * self);
60 gboolean              gst_va_decoder_has_profile          (GstVaDecoder * self,
61                                                            VAProfile profile);
62 gint                  gst_va_decoder_get_mem_types        (GstVaDecoder * self);
63 GArray *              gst_va_decoder_get_surface_formats  (GstVaDecoder * self);
64
65 gboolean              gst_va_decoder_add_param_buffer     (GstVaDecoder * self,
66                                                            GstVaDecodePicture * pic,
67                                                            gint type,
68                                                            gpointer data,
69                                                            gsize size);
70 gboolean              gst_va_decoder_add_slice_buffer     (GstVaDecoder * self,
71                                                            GstVaDecodePicture * pic,
72                                                            gpointer params_data,
73                                                            gsize params_size,
74                                                            gpointer slice_data,
75                                                            gsize slice_size);
76 gboolean              gst_va_decoder_add_slice_buffer_with_n_params
77                                                           (GstVaDecoder * self,
78                                                            GstVaDecodePicture * pic,
79                                                            gpointer params_data,
80                                                            gsize params_size,
81                                                            guint params_num,
82                                                            gpointer slice_data,
83                                                            gsize slice_size);
84 gboolean              gst_va_decoder_decode               (GstVaDecoder * self,
85                                                            GstVaDecodePicture * pic);
86 gboolean              gst_va_decoder_decode_with_aux_surface (GstVaDecoder * self,
87                                                               GstVaDecodePicture * pic,
88                                                               gboolean use_aux);
89 gboolean              gst_va_decoder_config_is_equal      (GstVaDecoder * decoder,
90                                                            VAProfile new_profile,
91                                                            guint new_rtformat,
92                                                            gint new_width,
93                                                            gint new_height);
94 gboolean              gst_va_decoder_get_config           (GstVaDecoder * decoder,
95                                                            VAProfile * profile,
96                                                            guint * rt_format,
97                                                            gint * width,
98                                                            gint * height);
99
100 GstVaDecodePicture *  gst_va_decode_picture_new           (GstVaDecoder * self,
101                                                            GstBuffer * buffer);
102 VASurfaceID           gst_va_decode_picture_get_surface   (GstVaDecodePicture * pic);
103 VASurfaceID           gst_va_decode_picture_get_aux_surface (GstVaDecodePicture * pic);
104 void                  gst_va_decode_picture_free          (GstVaDecodePicture * pic);
105 GstVaDecodePicture *  gst_va_decode_picture_dup           (GstVaDecodePicture * pic);
106
107 G_END_DECLS