Commit 5240dc3b authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

avcodec: cleanup VA API case in ffmpeg_GetFrameBuf.

parent b0527b5b
...@@ -30,8 +30,6 @@ struct vlc_va_t { ...@@ -30,8 +30,6 @@ struct vlc_va_t {
char *description; char *description;
vlc_object_t *obj; vlc_object_t *obj;
bool b_direct;
int (*setup)(vlc_va_t *, void **hw, vlc_fourcc_t *output, int (*setup)(vlc_va_t *, void **hw, vlc_fourcc_t *output,
int width, int height); int width, int height);
int (*get)(vlc_va_t *, AVFrame *frame); int (*get)(vlc_va_t *, AVFrame *frame);
......
...@@ -754,7 +754,8 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -754,7 +754,8 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if( p_sys->p_va && p_sys->p_ff_pic->opaque ) if( p_sys->p_va && p_sys->p_ff_pic->opaque )
{ {
p_pic = (picture_t *)p_sys->p_ff_pic->opaque; p_pic = (picture_t *)p_sys->p_ff_pic->opaque;
decoder_LinkPicture( p_dec, p_pic ); if( p_pic->format.i_chroma != VLC_CODEC_VAAPI_SURFACE )
decoder_LinkPicture( p_dec, p_pic );
/* Fill p_picture_t from AVVideoFrame and do chroma conversion /* Fill p_picture_t from AVVideoFrame and do chroma conversion
* if needed */ * if needed */
...@@ -796,7 +797,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -796,7 +797,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
} }
/* Send decoded frame to vout */ /* Send decoded frame to vout */
if( i_pts > VLC_TS_INVALID) if( i_pts > VLC_TS_INVALID )
{ {
p_pic->date = i_pts; p_pic->date = i_pts;
...@@ -999,25 +1000,26 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, ...@@ -999,25 +1000,26 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
if( p_sys->p_va ) if( p_sys->p_va )
{ {
do /* */
{ p_ff_pic->type = FF_BUFFER_TYPE_USER;
if( p_dec->b_die ) #if LIBAVCODEC_VERSION_MAJOR < 54
return -1; /* FIXME what is that, should give good value */
p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context ); p_ff_pic->age = 256*256*256*64; // FIXME FIXME from ffmpeg
} while( p_sys->p_va->b_direct && p_pic == NULL ); #endif
if( p_pic && p_pic->format.i_chroma == VLC_CODEC_VAAPI_SURFACE ) /* NOTE: Get first picture from video output instead of from the
* normal (non-accellerated vouts) mechanism. The drawback is that
* decoding the first pictures is delayed with the creation of the
* video output module.
*/
p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context );
if( p_pic && ( p_pic->format.i_chroma == VLC_CODEC_VAAPI_SURFACE ) )
{ {
p_sys->p_va->b_direct = true;
p_ff_pic->opaque = (void*)p_pic; p_ff_pic->opaque = (void*)p_pic;
p_ff_pic->type = FF_BUFFER_TYPE_USER; decoder_LinkPicture( p_dec, p_pic );
#if LIBAVCODEC_VERSION_MAJOR < 54
/* FIXME what is that, should give good value */
p_ff_pic->age = 256*256*256*64; // FIXME FIXME from ffmpeg
#endif
vlc_va_Put( p_sys->p_va, p_ff_pic, p_pic ); vlc_va_Put( p_sys->p_va, p_ff_pic, p_pic );
} }
else if( !p_sys->p_va->b_direct ) else
{ {
if( p_pic ) picture_Release( p_pic ); if( p_pic ) picture_Release( p_pic );
#ifdef HAVE_AVCODEC_VA #ifdef HAVE_AVCODEC_VA
...@@ -1029,18 +1031,10 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, ...@@ -1029,18 +1031,10 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
msg_Err( p_dec, "vlc_va_Setup failed" ); msg_Err( p_dec, "vlc_va_Setup failed" );
return -1; return -1;
} }
msg_Info( p_dec, "vlc_va_Setup" );
#else #else
assert(0); assert(0);
#endif #endif
/* */
p_ff_pic->type = FF_BUFFER_TYPE_USER;
#if LIBAVCODEC_VERSION_MAJOR < 54
/* FIXME what is that, should give good value */
p_ff_pic->age = 256*256*256*64; // FIXME FIXME from ffmpeg
#endif
if( vlc_va_Get( p_sys->p_va, p_ff_pic ) ) if( vlc_va_Get( p_sys->p_va, p_ff_pic ) )
{ {
msg_Err( p_dec, "vaGrabSurface failed" ); msg_Err( p_dec, "vaGrabSurface failed" );
......
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