context: clean-ups. Strip down APIs.
[platform/upstream/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapicontext.h
1 /*
2  *  gstvaapicontext.h - VA context abstraction (private)
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6  *  Copyright (C) 2011-2014 Intel Corporation
7  *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public License
11  *  as published by the Free Software Foundation; either version 2.1
12  *  of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free
21  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  *  Boston, MA 02110-1301 USA
23  */
24
25 #ifndef GST_VAAPI_CONTEXT_H
26 #define GST_VAAPI_CONTEXT_H
27
28 #include <gst/video/video-overlay-composition.h>
29 #include "gstvaapiobject.h"
30 #include "gstvaapiobject_priv.h"
31 #include "gstvaapiprofile.h"
32 #include "gstvaapidisplay.h"
33 #include "gstvaapisurface.h"
34 #include "gstvaapivideopool.h"
35
36 G_BEGIN_DECLS
37
38 #define GST_VAAPI_CONTEXT(obj) \
39   ((GstVaapiContext *) (obj))
40
41 typedef struct _GstVaapiContextInfo GstVaapiContextInfo;
42 typedef struct _GstVaapiContext GstVaapiContext;
43 typedef struct _GstVaapiContextClass GstVaapiContextClass;
44
45 /**
46  * GstVaapiContextInfo:
47  *
48  * Structure holding VA context info like encoded size, decoder
49  * profile and entry-point to use, and maximum number of reference
50  * frames reported by the bitstream.
51  *
52  * Note: @rc_mode is only valid for VA context used for encoding,
53  * i.e. if @entrypoint is set to @GST_VAAPI_ENTRYPOINT_SLICE_ENCODE.
54  */
55 struct _GstVaapiContextInfo
56 {
57   GstVaapiProfile profile;
58   GstVaapiEntrypoint entrypoint;
59   GstVaapiRateControl rc_mode;
60   guint width;
61   guint height;
62   guint ref_frames;
63 };
64
65 /**
66  * GstVaapiContext:
67  *
68  * A VA context wrapper.
69  */
70 struct _GstVaapiContext
71 {
72   /*< private >*/
73   GstVaapiObject parent_instance;
74
75   GstVaapiContextInfo info;
76   VAProfile va_profile;
77   VAEntrypoint va_entrypoint;
78   VAConfigID va_config;
79   GPtrArray *surfaces;
80   GstVaapiVideoPool *surfaces_pool;
81   GPtrArray *overlays[2];
82   guint overlay_id;
83 };
84
85 /**
86  * GstVaapiContextClass:
87  *
88  * A VA context wrapper class.
89  */
90 struct _GstVaapiContextClass
91 {
92   /*< private >*/
93   GstVaapiObjectClass parent_class;
94 };
95
96 G_GNUC_INTERNAL
97 GstVaapiContext *
98 gst_vaapi_context_new (GstVaapiDisplay * display,
99     const GstVaapiContextInfo * cip);
100
101 G_GNUC_INTERNAL
102 gboolean
103 gst_vaapi_context_reset (GstVaapiContext * context,
104     const GstVaapiContextInfo * new_cip);
105
106 G_GNUC_INTERNAL
107 GstVaapiID
108 gst_vaapi_context_get_id (GstVaapiContext * context);
109
110 G_GNUC_INTERNAL
111 GstVaapiSurfaceProxy *
112 gst_vaapi_context_get_surface_proxy (GstVaapiContext * context);
113
114 G_GNUC_INTERNAL
115 guint
116 gst_vaapi_context_get_surface_count (GstVaapiContext * context);
117
118 G_GNUC_INTERNAL
119 gboolean
120 gst_vaapi_context_apply_composition (GstVaapiContext * context,
121     GstVideoOverlayComposition * composition);
122
123 G_GNUC_INTERNAL
124 gboolean
125 gst_vaapi_context_get_attribute (GstVaapiContext * context,
126     VAConfigAttribType type, guint * out_value_ptr);
127
128 G_END_DECLS
129
130 #endif /* GST_VAAPI_CONTEXT_H */