[vlc-devel] [PATCH 1/3] Modifications to the VLC core to create a special VAAPI chroma
Etienne Membrives
etienne at membrives.fr
Wed Aug 5 13:17:05 CEST 2009
These three patches create a new picture type (fourcc 'VAAP'), a new video output and a chroma converter that use the Video Acceleration API (VAAPI) hardware acceleration to decode, display or help transcoding compressed videos. Due to the lack of implementation of subpicture blending in current VAAPI drivers, no OSD is available for the new video output.
---
configure.ac | 25 +++++++++++++++++++++++++
include/vlc_fourcc.h | 4 ++++
src/misc/es_format.c | 4 ++++
src/misc/fourcc.c | 5 +++++
src/video_output/vout_pictures.c | 10 ++++++++++
5 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index bc84d52..1037b4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3002,6 +3002,27 @@ then
])
fi
+AC_ARG_ENABLE(vaapi,
+[ --enable-vaapi vaapi enabled libavcodec (default disabled)])
+AS_IF([test "${enable_vaapi}" = "yes"], [
+ AS_IF([test "x${have_avcodec}" = "xyes"], [
+ PKG_CHECK_MODULES(VAAPI,[libva],
+ [
+ AC_CHECK_HEADERS(va/va.h X11/Xlib.h)
+ AC_DEFINE(HAVE_AVCODEC_VAAPI, 1, [Define if you have VAAPI])
+ VLC_ADD_LIBS([avcodec],[$VAAPI_LIBS -lva-x11])
+ VLC_ADD_LIBS([avcodec],[${X_LIBS} ${X_PRE_LIBS} -lX11])
+ VLC_ADD_PLUGIN([vaapi])
+ VLC_ADD_PLUGIN([vaapi_i420])
+ VLC_ADD_LIBS([vaapi],[$VAAPI_LIBS -lva-x11])
+ VLC_ADD_LIBS([vaapi],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext])
+ VLC_ADD_LIBS([vaapi_i420],[$VAAPI_LIBS -lva-x11])
+ ],[
+ AC_MSG_ERROR([Could not find libva. Use --disable-vaapi to ignore this error.])
+ ])
+ ])
+])
+
dnl
dnl stream_out switcher needs libavcodec
dnl
@@ -3999,6 +4020,7 @@ AS_IF([test "$enable_xinerama" != "no"], [
VLC_ADD_LIBS([x11],[-lXinerama_pic])
VLC_ADD_LIBS([glx],[-lXinerama_pic])
VLC_ADD_LIBS([xvmc],[-lXinerama_pic])
+ VLC_ADD_LIBS([vaapi],[-lXinerama_pic])
ac_cv_have_xinerama="yes"
],[
AC_CHECK_LIB(Xinerama, XineramaQueryExtension,[
@@ -4006,6 +4028,7 @@ AS_IF([test "$enable_xinerama" != "no"], [
VLC_ADD_LIBS([x11],[-lXinerama])
VLC_ADD_LIBS([glx],[-lXinerama])
VLC_ADD_LIBS([xvmc],[-lXinerama])
+ VLC_ADD_LIBS([vaapi],[-lXinerama])
ac_cv_have_xinerama="yes"
])
])
@@ -4024,6 +4047,7 @@ dnl
VLC_ADD_LIBS([x11],[-lXxf86vm_pic])
VLC_ADD_LIBS([glx],[-lXxf86vm_pic])
VLC_ADD_LIBS([xvmc],[-lXxf86vm_pic])
+ VLC_ADD_LIBS([vaapi],[-lXxf86vm_pic])
ac_cv_have_xf86vidmode="yes"
],[
AC_CHECK_LIB(Xxf86vm, XF86VidModeGetViewPort,[
@@ -4031,6 +4055,7 @@ dnl
VLC_ADD_LIBS([x11],[-lXxf86vm])
VLC_ADD_LIBS([glx],[-lXxf86vm])
VLC_ADD_LIBS([xvmc],[-lXxf86vm])
+ VLC_ADD_LIBS([vaapi],[-lXxf86vm])
ac_cv_have_xf86vidmode="yes"
])
])
diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index 8c5a12b..609ecc8 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -170,6 +170,10 @@
/* 10-bit 4:2:2 Component YCbCr */
#define VLC_CODEC_V210 VLC_FOURCC('v','2','1','0')
+/** Video acceleration **/;
+/* VAAPI */;
+#define VLC_CODEC_VAAPI VLC_FOURCC('V','A','A','P')
+
/* Image codec (video) */
#define VLC_CODEC_PNG VLC_FOURCC('p','n','g',' ')
#define VLC_CODEC_PPM VLC_FOURCC('p','p','m',' ')
diff --git a/src/misc/es_format.c b/src/misc/es_format.c
index 5f502a3..3e8f223 100644
--- a/src/misc/es_format.c
+++ b/src/misc/es_format.c
@@ -197,6 +197,10 @@ void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma, int i_wid
p_fmt->i_bits_per_pixel = 8;
break;
+ case VLC_CODEC_VAAPI:
+ p_fmt->i_bits_per_pixel = 16;
+ break;
+
default:
p_fmt->i_bits_per_pixel = 0;
break;
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
index 566de2d..28e168e 100644
--- a/src/misc/fourcc.c
+++ b/src/misc/fourcc.c
@@ -767,6 +767,11 @@ static const entry_t p_list_video[] = {
B(VLC_CODEC_PCX, "Personal Computer Exchange Image"),
A("pcx "),
+ /* Hardware acceleration codecs */
+ B(VLC_CODEC_VAAPI, "Intel VAAPI acceleration"),
+ A("vaap"),
+ A("VAAP"),
+
B(0, "")
};
static const entry_t p_list_audio[] = {
diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index e639353..1c0904a 100644
--- a/src/video_output/vout_pictures.c
+++ b/src/video_output/vout_pictures.c
@@ -905,6 +905,16 @@ int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma, int i_width, int
p_picture->i_planes = 1;
break;
+ /* Hardware acceleration */
+ case VLC_CODEC_VAAPI:
+ p_picture->p->i_lines = i_height_aligned;
+ p_picture->p->i_visible_lines = i_height;
+ p_picture->p->i_pitch = i_width_aligned;
+ p_picture->p->i_visible_pitch = i_width;
+ p_picture->p->i_pixel_pitch = 1;
+ p_picture->i_planes = 1;
+ break;
+
default:
p_picture->i_planes = 0;
return VLC_EGENERIC;
--
1.6.3.3
More information about the vlc-devel
mailing list