1 /*****************************************************************************
2 * va.h: Video Acceleration API for avcodec
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
7 * Authors: Laurent Aimar <fenrir_AT_ videolan _DOT_ org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program 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
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include "avcommon_compat.h"
26 #ifndef VLC_AVCODEC_VA_H
27 #define VLC_AVCODEC_VA_H 1
29 typedef struct vlc_va_t vlc_va_t
;
30 typedef struct vlc_va_sys_t vlc_va_sys_t
;
33 struct vlc_common_members obj
;
37 const char *description
;
39 int (*get
)(vlc_va_t
*, picture_t
*pic
, uint8_t **data
);
43 * Determines the VLC video chroma value for a pair of hardware acceleration
44 * PixelFormat and software PixelFormat.
45 * @param hwfmt the hardware acceleration pixel format
46 * @param swfmt the software pixel format
47 * @return a VLC chroma value, or 0 on error.
49 vlc_fourcc_t
vlc_va_GetChroma(enum PixelFormat hwfmt
, enum PixelFormat swfmt
);
52 * Creates an accelerated video decoding back-end for libavcodec.
53 * @param obj parent VLC object
54 * @param fmt VLC format of the content to decode
55 * @return a new VLC object on success, NULL on error.
57 vlc_va_t
*vlc_va_New(vlc_object_t
*obj
, AVCodecContext
*,
58 enum PixelFormat
, const es_format_t
*fmt
,
62 * Allocates a hardware video surface for a libavcodec frame.
63 * The surface will be used as output for the hardware decoder, and possibly
64 * also as a reference frame to decode other surfaces.
66 * @param pic pointer to VLC picture being allocated [IN/OUT]
67 * @param data pointer to the AVFrame data[0] and data[3] pointers [OUT]
69 * @note This function needs not be reentrant.
71 * @return VLC_SUCCESS on success, otherwise an error code.
73 static inline int vlc_va_Get(vlc_va_t
*va
, picture_t
*pic
, uint8_t **data
)
75 return va
->get(va
, pic
, data
);
79 * Destroys a libavcodec hardware acceleration back-end.
80 * All allocated surfaces shall have been released beforehand.
82 void vlc_va_Delete(vlc_va_t
*, void **);