Commit 3913a4ce authored by Jean-Paul Saman's avatar Jean-Paul Saman

Merge branch 'master' of git.m2x.eu:vlc-gpu

parents 7639d019 30cf73d9
......@@ -30,8 +30,6 @@ struct vlc_va_t {
char *description;
vlc_object_t *obj;
bool b_direct;
int (*setup)(vlc_va_t *, void **hw, vlc_fourcc_t *output,
int width, int height);
int (*get)(vlc_va_t *, AVFrame *frame);
......
......@@ -754,7 +754,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if( p_sys->p_va && 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 ) decoder_LinkPicture( p_dec, p_pic );
/* Fill p_picture_t from AVVideoFrame and do chroma conversion
* if needed */
......@@ -796,7 +796,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
}
/* Send decoded frame to vout */
if( i_pts > VLC_TS_INVALID)
if( i_pts > VLC_TS_INVALID )
{
p_pic->date = i_pts;
......@@ -999,25 +999,25 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
if( p_sys->p_va )
{
do
{
if( p_dec->b_die )
return -1;
p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context );
} while( p_sys->p_va->b_direct && p_pic == NULL );
/* */
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( 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->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
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 );
#ifdef HAVE_AVCODEC_VA
......@@ -1029,18 +1029,10 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
msg_Err( p_dec, "vlc_va_Setup failed" );
return -1;
}
msg_Info( p_dec, "vlc_va_Setup" );
#else
assert(0);
#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 ) )
{
msg_Err( p_dec, "vaGrabSurface failed" );
......@@ -1163,7 +1155,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
if( p_sys->p_va )
{
picture_t *p_pic = (picture_t*)p_ff_pic->opaque;
if( p_pic && p_pic->format.i_chroma == VLC_CODEC_VAAPI_SURFACE )
if( p_pic )
decoder_UnlinkPicture( p_dec, p_pic );
else
vlc_va_Release( p_sys->p_va, p_ff_pic );
......@@ -1180,8 +1172,8 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
else
{
picture_t *p_pic = (picture_t*)p_ff_pic->opaque;
decoder_UnlinkPicture( p_dec, p_pic );
if( p_pic )
decoder_UnlinkPicture( p_dec, p_pic );
}
for( int i = 0; i < 4; i++ )
p_ff_pic->data[i] = NULL;
......
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