va: VA-API H.264 decoder and infrastructure
[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 "gstvadisplay.h"
24
25 G_BEGIN_DECLS
26
27 typedef struct _GstVaDecodePicture GstVaDecodePicture;
28 struct _GstVaDecodePicture
29 {
30   GArray *buffers;
31   GArray *slices;
32   VASurfaceID surface;
33 };
34
35 #define GST_TYPE_VA_DECODER (gst_va_decoder_get_type())
36 G_DECLARE_FINAL_TYPE (GstVaDecoder, gst_va_decoder, GST, VA_DECODER, GstObject)
37
38 GstVaDecoder *        gst_va_decoder_new                  (GstVaDisplay * display,
39                                                            guint32 codec);
40 gboolean              gst_va_decoder_open                 (GstVaDecoder * self,
41                                                            VAProfile profile,
42                                                            guint rt_format);
43 gboolean              gst_va_decoder_close                (GstVaDecoder * self);
44 gboolean              gst_va_decoder_is_open              (GstVaDecoder * self);
45 gboolean              gst_va_decoder_set_format           (GstVaDecoder * self,
46                                                            gint coded_width,
47                                                            gint coded_height,
48                                                            GArray * surfaces);
49 GstCaps *             gst_va_decoder_get_srcpad_caps      (GstVaDecoder * self);
50 GstCaps *             gst_va_decoder_get_sinkpad_caps     (GstVaDecoder * self);
51 gboolean              gst_va_decoder_has_profile          (GstVaDecoder * self,
52                                                            VAProfile profile);
53 gint                  gst_va_decoder_get_mem_types        (GstVaDecoder * self);
54
55 gboolean              gst_va_decoder_add_param_buffer     (GstVaDecoder * self,
56                                                            GstVaDecodePicture * pic,
57                                                            gint type,
58                                                            gpointer data,
59                                                            gsize size);
60 gboolean              gst_va_decoder_add_slice_buffer     (GstVaDecoder * self,
61                                                            GstVaDecodePicture * pic,
62                                                            gpointer params_data,
63                                                            gsize params_size,
64                                                            gpointer slice_data,
65                                                            gsize slice_size);
66 gboolean              gst_va_decoder_decode               (GstVaDecoder * self,
67                                                            GstVaDecodePicture * pic);
68 gboolean              gst_va_decoder_destroy_buffers      (GstVaDecoder * self,
69                                                            GstVaDecodePicture * pic);
70
71 GstVaDecodePicture *  gst_va_decoder_new_decode_picture   (GstVaDecoder * self,
72                                                            VASurfaceID surface);
73 void                  gst_va_decode_picture_free          (GstVaDecodePicture * pic);
74
75 G_END_DECLS