Commit a94a5098 authored by Jean-Paul Saman's avatar Jean-Paul Saman

avcodec: move hardware decoding into dedicated plugins (fixes #7220)

(cherry picked from commit e7eb250a251766658a3ac5d8d8e7da9a3d792b4f)

Conflicts:
	modules/codec/Modules.am
	modules/codec/avcodec/avcodec.c
	modules/codec/avcodec/dxva2.c
	modules/codec/avcodec/va.h
	modules/codec/avcodec/vaapi.c
	modules/codec/avcodec/vda.c
	modules/codec/avcodec/video.c
parent 856803c7
......@@ -63,3 +63,4 @@ libvlc_LTLIBRARIES += \
libt140_plugin.la \
libstl_plugin.la \
$(NULL)
......@@ -8,8 +8,6 @@ libavcodec_plugin_la_SOURCES = \
fourcc.c \
chroma.h \
chroma.c \
copy.c \
copy.h \
va.h \
$(NULL)
......@@ -18,19 +16,44 @@ libavcodec_plugin_la_LIBADD = $(AM_LIBADD) $(LIBS_avcodec)
libavcodec_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_avcodec)
libavcodec_plugin_la_DEPENDENCIES =
if HAVE_AVCODEC_VAAPI
libavcodec_plugin_la_SOURCES += vaapi.c vaapi.c va.c
libavcodec_plugin_la_CFLAGS += $(LIBVA_CFLAGS) $(X_CFLAGS) -DHAVE_AVCODEC_VAAPI
libavcodec_plugin_la_LIBADD += $(LIBVA_LIBS) $(X_LIBS) $(X_PRE_LIBS) -lX11
if ENABLE_SOUT
libavcodec_plugin_la_SOURCES += \
encoder.c
endif
if HAVE_AVCODEC_DXVA2
libavcodec_plugin_la_SOURCES += dxva2.c
libavcodec_plugin_la_CFLAGS += -DHAVE_AVCODEC_DXVA2
libavcodec_plugin_la_LIBADD += -lole32 -lshlwapi -luuid
if MERGE_FFMPEG
libavcodec_plugin_la_SOURCES += \
../../demux/avformat/demux.c \
../../access/avio.c
if ENABLE_SOUT
libavcodec_plugin_la_SOURCES += \
../../demux/avformat/mux.c
endif
libavcodec_plugin_la_CFLAGS += -DMERGE_FFMPEG
endif
libvlc_LTLIBRARIES += \
$(LTLIBavcodec)
EXTRA_LTLIBRARIES += \
libavcodec_plugin.la
### avcodec hardaware accelleration ###
# VAAPI
libvaapi_plugin_la_SOURCES = \
copy.c copy.h \
vaapi.c vaapi.h va.c
libvaapi_plugin_la_CFLAGS = $(AM_CFLAGS) $(LIBVA_CFLAGS) $(X_CFLAGS) $(CFLAGS_avcodec) -DHAVE_AVCODEC_VAAPI
libvaapi_plugin_la_LIBADD = $(AM_LIBADD) $(LIBVA_LIBS) \
$(X_LIBS) $(X_PRE_LIBS) -lX11 $(LIBS_avcodec)
if HAVE_AVCODEC_VAAPI
libvlc_LTLIBRARIES += libvaapi_plugin.la
endif
if HAVE_VAAPI_XCB
libavcodec_plugin_la_SOURCES += \
libvaapi_plugin_la_SOURCES += \
../../video_output/vaapi/spu.h \
../../video_output/vaapi/spu.c \
../../video_output/vaapi/common.h \
......@@ -40,36 +63,25 @@ libavcodec_plugin_la_SOURCES += \
../../video_output/xcb/events.c \
../../video_output/xcb/xcb_events_vlc.h \
$(NULL)
libavcodec_plugin_la_CFLAGS += $(LIBVA_X11_CFLAGS) ${XLIB_XCB_CFLAGS} ${XCB_CFLAGS} -DHAVE_VAAPI_XCB
libavcodec_plugin_la_LIBADD += $(LIBVA_X11_LIBS) ${XLIB_XCB_LIBS} ${XCB_LIBS}
libvaapi_plugin_la_CFLAGS += $(LIBVA_X11_CFLAGS) ${XLIB_XCB_CFLAGS} ${XCB_CFLAGS} -DHAVE_VAAPI_XCB
libvaapi_plugin_la_LIBADD += $(LIBVA_X11_LIBS) ${XLIB_XCB_LIBS} ${XCB_LIBS}
endif
if HAVE_VAAPI_GLX
libavcodec_plugin_la_SOURCES += \
libvaapi_plugin_la_SOURCES += \
../../video_output/vaapi/glx.h \
../../video_output/vaapi/glx.c \
$(NULL)
libavcodec_plugin_la_CFLAGS += $(LIBVA_GLX_CFLAGS) ${GL_CFLAGS} -DHAVE_VAAPI_GLX
libavcodec_plugin_la_LIBADD += $(LIBVA_GLX_LIBS) ${GL_LIBS}
libvaapi_plugin_la_CFLAGS += $(LIBVA_GLX_CFLAGS) ${GL_CFLAGS} -DHAVE_VAAPI_GLX
libvaapi_plugin_la_LIBADD += $(LIBVA_GLX_LIBS) ${GL_LIBS}
endif
if ENABLE_SOUT
libavcodec_plugin_la_SOURCES += \
encoder.c
endif
# DXVA2
libdxva2_plugin_la_SOURCES = \
copy.c copy.h \
dxva2.c
libavcodec_plugin_la_CFLAGS += -DHAVE_AVCODEC_DXVA2
libdxva2_plugin_la_LIBADD = $(AM_LIBADD) -lole32 -lshlwapi -luuid
if MERGE_FFMPEG
libavcodec_plugin_la_SOURCES += \
../../demux/avformat/demux.c \
../../access/avio.c
if ENABLE_SOUT
libavcodec_plugin_la_SOURCES += \
../../demux/avformat/mux.c
endif
libavcodec_plugin_la_CFLAGS += -DMERGE_FFMPEG
if HAVE_AVCODEC_DXVA2
libvlc_LTLIBRARIES += libdxva2_plugin.la
endif
libvlc_LTLIBRARIES += \
$(LTLIBavcodec)
EXTRA_LTLIBRARIES += \
libavcodec_plugin.la
......@@ -38,6 +38,7 @@
/* ffmpeg header */
#define HAVE_MMX 1
#include <libavutil/mem.h>
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include <libavcodec/avcodec.h>
#else
......@@ -81,13 +82,6 @@ static const char *const enc_hq_list_text[] = {
# include "../../access/avio.h"
#endif
#if defined(HAVE_AVCODEC_VAAPI) && defined(HAVE_VAAPI_XCB)
# include "../../video_output/vaapi/xcb.h"
# ifdef HAVE_VAAPI_GLX
# include "../../video_output/vaapi/glx.h"
# endif
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -135,9 +129,8 @@ vlc_module_begin ()
add_integer( "ffmpeg-debug", 0, DEBUG_TEXT, DEBUG_LONGTEXT,
true )
add_string( "ffmpeg-codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true )
#if defined(HAVE_AVCODEC_VAAPI) || defined(HAVE_AVCODEC_DXVA2)
add_bool( "ffmpeg-hw", false, HW_TEXT, HW_LONGTEXT, false )
#endif
#if defined(FF_THREAD_FRAME)
add_integer( "ffmpeg-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true );
#endif
......@@ -222,33 +215,6 @@ vlc_module_begin ()
AVIO_MODULE
#endif
#if defined(HAVE_AVCODEC_VAAPI) && defined(HAVE_VAAPI_XCB)
/* vaapi_xcb submodule */
add_submodule()
set_description (N_("VAAPI X11 video output (XCB)"))
set_category (CAT_VIDEO)
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability ("vout display", 275)
set_callbacks (OpenVaapiXCB, CloseVaapiXCB)
add_shortcut ("vaapi-x11", "vaapi-xcb", "xid")
add_bool( VOUT_CFG_PREFIX "recycle", false,
VOUT_RECYCLE_TEXT, VOUT_RECYCLE_LONGTEXT, true )
/* vaapi_glx submodule */
# ifdef HAVE_VAAPI_GLX
add_submodule()
set_description (N_("VAAPI GLX video output (XCB)"))
set_category (CAT_VIDEO)
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability ("vout display", 250)
set_callbacks (OpenVaapiGLX, CloseVaapiGLX)
add_shortcut ("vaapi-glx", "xid")
add_bool( VOUT_CFG_PREFIX "recycle", false,
VOUT_RECYCLE_TEXT, VOUT_RECYCLE_LONGTEXT, true )
# endif
#endif
vlc_module_end ()
/*****************************************************************************
......
......@@ -268,16 +268,6 @@ int ffmpeg_OpenCodec( decoder_t *p_dec );
"for encoding the audio bitstream. It takes the following options: " \
"main, low, ssr (not supported) and ltp (default: main)" )
/*
* Video output options
*/
#define VOUT_CFG_PREFIX "vaapi-vout-"
#define VOUT_RECYCLE_TEXT N_( "Recycle the vout (default false)" )
#define VOUT_RECYCLE_LONGTEXT N_( "Enable the vout to be recycled by VLC core. " \
"By default VLC core recycles the video outputs if possible. If you have " \
"an AMD/ATI graphics card, then this setting should be false." )
#define AVCODEC_COMMON_MEMBERS \
int i_cat; \
int i_codec_id; \
......
......@@ -33,11 +33,13 @@
# define _WIN32_WINNT 0x600
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_picture.h>
#include <vlc_fourcc.h>
#include <vlc_cpu.h>
#include <assert.h>
#include <vlc_plugin.h>
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include <libavcodec/avcodec.h>
......@@ -52,6 +54,17 @@
#include "va.h"
#include "copy.h"
static int Open(vlc_va_t *, int, int, const es_format_t *);
static void Close(vlc_va_t *);
vlc_module_begin()
set_description(N_("DirectX Video Acceleration (DXVA) 2.0"))
set_capability("hw decoder", 50)
set_category(CAT_INPUT)
set_subcategory(SUBCAT_INPUT_VCODEC)
set_callbacks(Open, Close)
vlc_module_end()
#include <windows.h>
#include <windowsx.h>
#include <ole2.h>
......@@ -496,7 +509,7 @@ static void Close(vlc_va_t *external)
free(va);
}
int vlc_va_New(vlc_va_t *p_external, int pixfmt, int codec_id,
static int Open(vlc_va_t *p_external, int pixfmt, int codec_id,
const es_format_t *fmt)
{
/* Only one VLD supported */
......@@ -507,9 +520,10 @@ int vlc_va_New(vlc_va_t *p_external, int pixfmt, int codec_id,
if (!va)
return NULL;
external->sys = va;
p_external->sys = va;
/* */
va->log = VLC_OBJECT(external);
va->log = VLC_OBJECT(p_external);
va->codec_id = codec_id;
/* Load dll*/
......@@ -556,7 +570,6 @@ int vlc_va_New(vlc_va_t *p_external, int pixfmt, int codec_id,
external->extract = Extract;
external->display = NULL;
external->query = NULL;
external->close = Close;
return VLC_SUCCESS;
error:
......
......@@ -471,7 +471,7 @@ vlc_va_conn_t *vlc_va_Initialize( const char *display )
/* Create a VA display */
/* FIXME: allow for runtime choice of OpenGL or not */
#warning "fix the non-openGL case"
#if HAVE_GLX
#if HAVE_VAAPI_GLX
conn->p_display = vaGetDisplayGLX(conn->x11);
#else
conn->p_display = vaGetDisplay(conn->x11);
......
......@@ -31,6 +31,7 @@ struct vlc_va_t {
VLC_COMMON_MEMBERS
vlc_va_sys_t *sys;
module_t *module;
char *description;
bool direct_rendering;
......@@ -42,7 +43,6 @@ struct vlc_va_t {
void (*put)(vlc_va_t *, AVFrame *dst, picture_t *src);
int (*display)(vlc_va_t *, picture_t *dst);
bool (*query)(vlc_va_t *, picture_t *src);
void (*close)(vlc_va_t *);
};
static inline int vlc_va_Setup(vlc_va_t *va, void **hw, vlc_fourcc_t *output,
......@@ -74,12 +74,5 @@ static inline int vlc_va_Display(vlc_va_t *va, picture_t *dst)
{
return va->display(va, dst);
}
static inline void vlc_va_Delete(vlc_va_t *va)
{
va->close(va);
vlc_object_release(va);
}
int vlc_va_New(vlc_va_t *, int pix, int codec, const es_format_t *);
#endif
......@@ -25,14 +25,15 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_fourcc.h>
#include <vlc_picture.h>
#include <vlc_arrays.h>
#include <assert.h>
#include "avcodec.h"
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include <libavcodec/avcodec.h>
# include <libavcodec/vaapi.h>
......@@ -42,9 +43,71 @@
#endif
#include <vlc_xlib.h>
#include <X11/Xlib.h>
#include <va/va.h>
#include <va/va_x11.h>
#include "avcodec.h"
#include "va.h"
#include "copy.h"
#if defined(HAVE_VAAPI_XCB)
# include "../../video_output/vaapi/xcb.h"
# ifdef HAVE_VAAPI_GLX
# include "../../video_output/vaapi/glx.h"
# endif
#endif
/*
* Video output options
*/
#define VOUT_CFG_PREFIX "vaapi-vout-"
#define VOUT_RECYCLE_TEXT N_( "Recycle the vout (default false)" )
#define VOUT_RECYCLE_LONGTEXT N_( "Enable the vout to be recycled by VLC core. " \
"By default VLC core recycles the video outputs if possible. If you have " \
"an AMD/ATI graphics card, then this setting should be false." )
static int Create( vlc_va_t *, int, int, const es_format_t * );
static void Delete( vlc_va_t * );
vlc_module_begin ()
set_description( N_("Video Acceleration (VA) API") )
set_capability( "hw decoder", 50 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_VCODEC )
set_callbacks( Create, Delete )
#if defined(HAVE_VAAPI_XCB)
/* vaapi_xcb submodule */
add_submodule()
set_description (N_("VAAPI X11 video output (XCB)"))
set_category (CAT_VIDEO)
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability ("vout display", 275)
set_callbacks (OpenVaapiXCB, CloseVaapiXCB)
add_shortcut ("vaapi-x11", "vaapi-xcb", "xid")
add_bool( VOUT_CFG_PREFIX "recycle", false,
VOUT_RECYCLE_TEXT, VOUT_RECYCLE_LONGTEXT, true )
/* vaapi_glx submodule */
# ifdef HAVE_VAAPI_GLX
add_submodule()
set_description (N_("VAAPI GLX video output (XCB)"))
set_category (CAT_VIDEO)
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability ("vout display", 250)
set_callbacks (OpenVaapiGLX, CloseVaapiGLX)
add_shortcut ("vaapi-glx", "xid")
add_bool( VOUT_CFG_PREFIX "recycle", false,
VOUT_RECYCLE_TEXT, VOUT_RECYCLE_LONGTEXT, true )
# endif
#endif
vlc_module_end ()
#include "va.h"
#include "vaapi.h"
#include "copy.h"
......@@ -181,7 +244,7 @@ static int Open( vlc_va_t *p_external, int i_codec_id )
int i_profile;
vlc_va_sys_t *p_va = calloc(1, sizeof(*p_va));
if (unlikeyly(p_va == NULL))
if (unlikely(p_va == NULL))
return VLC_ENOMEM;
/* */
......@@ -223,9 +286,9 @@ static int Open( vlc_va_t *p_external, int i_codec_id )
goto unlock;
}
if( asprintf( &p_va->va.description, "VA API version %d.%d",
if( asprintf( &p_external->description, "VA API version %d.%d",
p_va->conn->i_version_major, p_va->conn->i_version_minor ) < 0 )
p_va->va.description = NULL;
p_external->description = NULL;
p_va->conn->unlock();
......@@ -580,8 +643,10 @@ static void Release( vlc_va_t *p_external, AVFrame *p_ff )
p_va->conn->unlock();
}
static void Close( vlc_va_sys_t *p_va )
static void Close( vlc_va_t *p_external )
{
vlc_va_sys_t *p_va = p_external->sys;
if( p_va->i_surface_width || p_va->i_surface_height )
DestroyDecodingContext( p_va );
......@@ -599,14 +664,15 @@ static void Close( vlc_va_sys_t *p_va )
static void Delete( vlc_va_t *p_external )
{
vlc_va_sys_t *p_va = p_external->sys;
Close( p_va );
Close( p_external );
free( p_external->description );
free( p_va );
}
static bool QuerySurfaceReady( vlc_va_t *p_external, picture_t *pic )
{
vlc_va_sys_t *p_va = p_external->p_sys;
vlc_va_sys_t *p_va = p_external->sys;
assert(pic);
assert(pic->p_sys);
......@@ -632,7 +698,7 @@ static bool QuerySurfaceReady( vlc_va_t *p_external, picture_t *pic )
}
/* */
int vlc_va_New( vlc_va_t *p_va, int pixfmt, int i_codec_id,
static int Create( vlc_va_t *p_va, int pixfmt, int i_codec_id,
const es_format_t *fmt )
{
/* Only VLD supported */
......@@ -652,7 +718,9 @@ int vlc_va_New( vlc_va_t *p_va, int pixfmt, int i_codec_id,
return err;
/* */
p_va->direct_rendering = p_va->conn->b_direct_rendering;
p_va->direct_rendering = p_va->sys->conn->b_direct_rendering;
/* Only VLD supported */
p_va->pix_fmt = PIX_FMT_VAAPI_VLD;
p_va->setup = Setup;
p_va->get = Get;
p_va->put = Put;
......@@ -660,7 +728,7 @@ int vlc_va_New( vlc_va_t *p_va, int pixfmt, int i_codec_id,
p_va->extract = Extract;
p_va->display = DisplayPicture;
p_va->query = QuerySurfaceReady;
p_va->close = Delete;
return VLC_SUCCESS;
}
......@@ -29,30 +29,19 @@
# include "config.h"
#endif
#if defined(HAVE_LIBAVCODEC_AVCODEC_H) && defined(HAVE_AVCODEC_DXVA2)
# if _WIN32_WINNT < 0x600
/* dxva2 needs Vista support */
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x600
# endif
#endif
#include <vlc_common.h>
#include <vlc_codec.h>
#include <vlc_avcodec.h>
#include <vlc_cpu.h>
#include <vlc_modules.h>
#include <assert.h>
/* ffmpeg header */
#include <libavutil/mem.h>
#include <libavutil/pixdesc.h>
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include <libavcodec/avcodec.h>
# ifdef HAVE_AVCODEC_VAAPI
# include <libavcodec/vaapi.h>
# endif
# ifdef HAVE_AVCODEC_DXVA2
# include <libavcodec/dxva2.h>
# endif
#elif defined(HAVE_FFMPEG_AVCODEC_H)
# include <ffmpeg/avcodec.h>
#else
......@@ -62,11 +51,12 @@
#include "avcodec.h"
#include "va.h"
typedef struct vlc_va_conn_t vlc_va_conn_t;
#if defined(HAVE_AVCODEC_VAAPI) || defined(HAVE_AVCODEC_DXVA2)
# define HAVE_AVCODEC_VA
# include <libavutil/pixdesc.h>
#endif
static vlc_va_t *vlc_va_New( vlc_object_t *parent, int codec_id,
const es_format_t *fmt );
static void vlc_va_Delete( vlc_va_t *va );
/*****************************************************************************
* decoder_sys_t : decoder descriptor
......@@ -127,11 +117,8 @@ static void ffmpeg_InitCodec ( decoder_t * );
static void ffmpeg_CopyPicture ( decoder_t *, picture_t *, AVFrame * );
static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame * );
static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
#ifdef HAVE_AVCODEC_VA
static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
const enum PixelFormat * );
#endif
static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
{
......@@ -371,7 +358,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->thread_count = i_thread_count;
#endif
#ifdef HAVE_AVCODEC_VA
const bool b_use_hw = var_CreateGetBool( p_dec, "ffmpeg-hw" );
if( b_use_hw &&
(i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO ||
......@@ -396,7 +382,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
#endif
p_sys->p_context->get_format = ffmpeg_GetFormat;
}
#endif
#ifdef HAVE_AVCODEC_MT
if( p_sys->p_context->thread_type & FF_THREAD_FRAME )
p_dec->i_extra_picture_buffers = 2 * p_sys->p_context->thread_count;
......@@ -981,8 +967,8 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
p_ff_pic->age = 256*256*256*64; // FIXME FIXME from ffmpeg
#endif
#ifdef HAVE_AVCODEC_VA
/* hwaccel_context is not present in old fffmpeg version */
#if 1 // LIBAVCODEC_VERSION_MAJOR >= ? FIXME
/* hwaccel_context is not present in old ffmpeg version */
if( vlc_va_Setup( p_sys->p_va,
&p_sys->p_context->hwaccel_context, &p_dec->fmt_out.video.i_chroma,
p_sys->p_context->width, p_sys->p_context->height ) )
......@@ -1148,7 +1134,49 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
p_ff_pic->data[i] = NULL;
}
#ifdef HAVE_AVCODEC_VA
static int ffmpeg_va_Start( void *func, va_list ap )
{
vlc_va_t *va = va_arg( ap, vlc_va_t * );
int pix = va_arg( ap, int );
int codec = va_arg( ap, int );
const es_format_t *fmt = va_arg( ap, const es_format_t * );
int (*open)( vlc_va_t *, int, int, const es_format_t * ) = func;
return open( va, pix, codec, fmt );
}
static vlc_va_t *vlc_va_New( vlc_object_t *parent, int pixfmt, int codec_id,
const es_format_t *fmt )
{
vlc_va_t *p_va = vlc_object_create( parent, sizeof( *p_va ) );
if( unlikely(p_va == NULL) )
return NULL;
p_va->module = vlc_module_load( p_va, "hw decoder", "$avcodec-hw",
true, ffmpeg_va_Start, p_va, pixfmt,
codec_id, fmt );
if( p_va->module == NULL )
{
vlc_object_release( p_va );
p_va = NULL;
}
return p_va;
}
static void ffmpeg_va_Stop( void *func, va_list ap )
{
vlc_va_t *va = va_arg( ap, vlc_va_t * );
void (*close)( vlc_va_t * ) = func;
close( va );
}
static void vlc_va_Delete( vlc_va_t *va )
{
vlc_module_unload( va->module, ffmpeg_va_Stop, va );
vlc_object_release( va );
}
static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
const enum PixelFormat *pi_fmt )
{
......@@ -1168,12 +1196,10 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
msg_Dbg( p_dec, "Available decoder output format %d (%s)", pi_fmt[i],
name ? name : "unknown" );
vlc_va_t *p_va = vlc_object_create( p_dec, sizeof( *p_va ) );
if( unlikely(p_va == NULL) )
continue;
if( vlc_va_New( p_va, pi_fmt[i], p_sys->i_codec_id, &p_dec->fmt_in ) )
vlc_va_t *p_va = vlc_va_New( VLC_OBJECT(p_dec), pi_fmt[i],
p_sys->i_codec_id, &p_dec->fmt_in );
if( p_va == NULL )
{
vlc_object_release( p_va );
msg_Dbg( p_dec, "acceleration not available" );
continue;
}
......@@ -1199,7 +1225,7 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
if( p_sys->p_va->description )
msg_Info( p_dec, "Using %s for hardware decoding.", p_sys->p_va->description );
p_sys->b_direct_rendering = p_sys->p_va->direct_rendering;
p_sys->b_direct_rendering = p_va->direct_rendering;
msg_Info( p_dec, "VAAPI uses direct rendering: %s",
p_sys->b_direct_rendering ? "yes" : "no" );
p_context->draw_horiz_band = NULL;
......@@ -1210,4 +1236,4 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
/* Fallback to default behaviour */
return avcodec_default_get_format( p_context, pi_fmt );
}
#endif
......@@ -69,6 +69,8 @@
#include "xcb.h"
#include "glx.h"
#define VOUT_CFG_PREFIX "vaapi-vout-"
/* define for extra debugging */
#undef VAAPI_DEBUG
......@@ -309,11 +311,9 @@ static int CreateGLXSurface(vout_display_t *vd)
return VLC_EGENERIC;
}
#if !USE_OPENGL_ES
/* Set the texture parameters */
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 1.0);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
......
......@@ -63,6 +63,7 @@
#include "common.h"
#include "xcb.h"
#define VOUT_CFG_PREFIX "vaapi-vout-"
/* define for extra debugging */
#undef VAAPI_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment