xine-lib 1.2.13-20230125hg15249
vaapi_frame.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Edgar Hucek <gimli|@dark-green.com>
3 * Copyright (C) 2012-2022 xine developers
4 *
5 * This file is part of xine, a free video player.
6 *
7 * xine is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * xine is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20 *
21 * vaapi_frame.c, VAAPI video extension interface for xine
22 *
23 */
24
25#ifndef XINE_VAAPI_FRAME_H
26#define XINE_VAAPI_FRAME_H
27
28#include <xine/video_out.h>
29#include "accel_vaapi.h"
30
31#include "vaapi_util.h"
32#include "../mem_frame.h"
33
39
40
42 int guarded_render);
44 vo_frame_t *frame_gen,
45 uint32_t width, uint32_t height,
46 double ratio, int format, int flags);
47
50
51/*
52 *
53 */
54
55static inline
57{
58 vaapi_frame_t *frame = xine_container_of(vo_frame, vaapi_frame_t, mem_frame.vo_frame);
59 return frame->ctx_impl;
60}
61
62/*
63 * accel
64 */
65
66static inline
67int _x_va_accel_profile_from_imgfmt(vo_frame_t *vo_frame, unsigned format)
68{
70 return _x_va_profile_from_imgfmt(va, format);
71}
72
73static inline
75{
77 return &va->c;
78}
79
80static inline
81int _x_va_accel_vaapi_init(vo_frame_t *vo_frame, int va_profile, int width, int height)
82{
84 return _x_va_init(va, va_profile, width, height);
85}
86
87static inline
89{
90 vaapi_accel_t *accel = vo_frame->accel_data;
91 return accel->f->render_vaapi_surface != NULL;
92}
93
94/*
95 * non-guarded mode
96 */
97
98static inline
100{
101 (void)vo_frame;
102 return 0;
103}
104
105static inline
107{
109 vaapi_accel_t *accel = vo_frame->accel_data;
110 _x_assert(accel->index < RENDER_SURFACES); /* index is constant in this mode */
111 return &va->c.va_render_surfaces[accel->index];
112}
113
114/*
115 * guarded mode
116 */
117
118static inline
124
125static inline
127{
129 vaapi_accel_t *accel = vo_frame->accel_data;
130
131 accel->index = va_surface->index;
132 _x_va_render_surface(va, va_surface);
133}
134
135static inline
137{
138 /* surface was not binded to this vo_frame */
140 _x_va_release_surface(va, va_surface);
141}
142
143/*
144 * video out
145 */
146
147static inline
149{
150 vaapi_context_impl_t *va_context = _ctx_from_frame(vo_frame);
151 vaapi_accel_t *accel = vo_frame->accel_data;
152
153 if (accel->index < RENDER_SURFACES) {
154 ff_vaapi_surface_t *va_surface = &va_context->c.va_render_surfaces[accel->index];
155 _x_va_surface_displayed(va_context, va_surface);
156 accel->index = RENDER_SURFACES; /* invalid */
157 }
158}
159
160#endif /* XINE_VAAPI_UTIL_H */
unsigned int height
Definition gfontrle.c:5
unsigned int width
Definition gfontrle.c:4
Definition accel_vaapi.h:52
ff_vaapi_surface_t * va_render_surfaces
Definition accel_vaapi.h:62
Definition accel_vaapi.h:72
unsigned int index
Definition accel_vaapi.h:73
Definition mem_frame.h:32
void(* render_vaapi_surface)(vo_frame_t *frame_gen, ff_vaapi_surface_t *va_surface)
Definition accel_vaapi.h:111
Definition accel_vaapi.h:115
const struct vaapi_accel_funcs_s * f
Definition accel_vaapi.h:118
unsigned int index
Definition accel_vaapi.h:116
Definition vaapi_util.h:54
ff_vaapi_context_t c
Definition vaapi_util.h:55
Definition vaapi_frame.h:34
vaapi_context_impl_t * ctx_impl
Definition vaapi_frame.h:37
vaapi_accel_t vaapi_accel_data
Definition vaapi_frame.h:36
mem_frame_t mem_frame
Definition vaapi_frame.h:35
Definition video_out.h:50
Definition video_out.h:70
void * accel_data
Definition video_out.h:158
Definition xine.h:477
static int _x_va_accel_profile_from_imgfmt(vo_frame_t *vo_frame, unsigned format)
Definition vaapi_frame.h:67
static ff_vaapi_context_t * _x_va_accel_get_context(vo_frame_t *vo_frame)
Definition vaapi_frame.h:74
static vaapi_context_impl_t * _ctx_from_frame(vo_frame_t *vo_frame)
Definition vaapi_frame.h:56
static void _x_va_accel_render_vaapi_surface(vo_frame_t *vo_frame, ff_vaapi_surface_t *va_surface)
Definition vaapi_frame.h:126
void _x_va_frame_provide_standard_frame_data(vo_frame_t *vo_frame, xine_current_frame_data_t *data)
Definition vaapi_frame.c:51
static ff_vaapi_surface_t * _x_va_accel_alloc_vaapi_surface(vo_frame_t *vo_frame)
Definition vaapi_frame.h:119
static int _x_va_accel_guarded_render(vo_frame_t *vo_frame)
Definition vaapi_frame.h:88
static void _x_va_accel_release_vaapi_surface(vo_frame_t *vo_frame, ff_vaapi_surface_t *va_surface)
Definition vaapi_frame.h:136
void _x_va_frame_duplicate_frame_data(vo_frame_t *this_gen, vo_frame_t *original)
Definition vaapi_frame.c:191
static int _x_va_accel_vaapi_init(vo_frame_t *vo_frame, int va_profile, int width, int height)
Definition vaapi_frame.h:81
void _x_va_frame_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags)
Definition vaapi_frame.c:333
vaapi_frame_t * _x_va_frame_alloc_frame(vaapi_context_impl_t *va, vo_driver_t *driver, int guarded_render)
Definition vaapi_frame.c:374
static int _x_va_accel_lock_decode_dummy(vo_frame_t *vo_frame)
Definition vaapi_frame.h:99
static ff_vaapi_surface_t * _x_va_accel_get_vaapi_surface(vo_frame_t *vo_frame)
Definition vaapi_frame.h:106
static void _x_va_frame_displayed(vo_frame_t *vo_frame)
Definition vaapi_frame.h:148
VAStatus _x_va_init(vaapi_context_impl_t *va_context, int va_profile, int width, int height)
Definition vaapi_util.c:338
ff_vaapi_surface_t * _x_va_alloc_surface(vaapi_context_impl_t *va_context)
Definition vaapi_util.c:543
int _x_va_profile_from_imgfmt(vaapi_context_impl_t *va_context, unsigned format)
Definition vaapi_util.c:444
void _x_va_release_surface(vaapi_context_impl_t *va_context, ff_vaapi_surface_t *va_surface)
Definition vaapi_util.c:593
void _x_va_surface_displayed(vaapi_context_impl_t *va_context, ff_vaapi_surface_t *va_surface)
Definition vaapi_util.c:612
void _x_va_render_surface(vaapi_context_impl_t *va_context, ff_vaapi_surface_t *va_surface)
Definition vaapi_util.c:583
#define RENDER_SURFACES
Definition vaapi_util.h:52
NULL
Definition xine_plugin.c:78
#define xine_container_of(ptr, type, member)
Definition xineutils.h:257
#define _x_assert(exp)
Definition xineutils.h:571