Commit 6558a8c4 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Revert "Implemented decoder_GetPictureCount() and vout_GetPictureCount()"

This reverts commit 91f15717.

Conflicts:
	modules/codec/avcodec/vaapi.c
	src/video_output/video_output.c
parent a464ed78
......@@ -99,7 +99,6 @@ struct decoder_t
* and decoder_LinkPicture/decoder_UnlinkPicture */
picture_t *(*pf_vout_buffer_new)( decoder_t * );
void (*pf_vout_buffer_del)( decoder_t *, picture_t * );
int (*pf_vout_buffer_size) (decoder_t * );
void (*pf_picture_link) ( decoder_t *, picture_t * );
void (*pf_picture_unlink) ( decoder_t *, picture_t * );
......@@ -193,11 +192,6 @@ VLC_API picture_t * decoder_NewPicture( decoder_t * ) VLC_USED;
*/
VLC_API void decoder_DeletePicture( decoder_t *, picture_t *p_picture );
/**
* It returns the size of the given picture pool.
*/
VLC_API int decoder_GetPictureCount( decoder_t * );
/**
* This function will increase the picture reference count.
* (picture_Hold is not usable.)
......
......@@ -159,11 +159,6 @@ VLC_API int vout_GetSnapshot( vout_thread_t *p_vout,
VLC_API picture_t * vout_GetPicture( vout_thread_t * );
VLC_API void vout_PutPicture( vout_thread_t *, picture_t * );
/**
* It returns the size of the given picture pool.
*/
VLC_API int vout_GetPictureCount( vout_thread_t * );
VLC_API void vout_HoldPicture( vout_thread_t *, picture_t * );
VLC_API void vout_ReleasePicture( vout_thread_t *, picture_t * );
......
......@@ -76,7 +76,7 @@ static inline void vlc_va_Delete(vlc_va_t *va)
va->close(va);
}
vlc_va_t *vlc_va_NewVaapi(vlc_object_t *obj, int codec_id, int count);
vlc_va_t *vlc_va_NewVaapi(vlc_object_t *obj, int codec_id);
vlc_va_t *vlc_va_NewDxva2(vlc_object_t *log, int codec_id);
#endif
......@@ -167,17 +167,10 @@ static VAProfile GetSupportedProfile( vlc_va_conn_t *p_conn, const int i_codec_i
return i_profile;
}
static int CalculateSurfaceCount( const int i_codec_id, const int i_requested )
static int CalculateSurfaceCount( const int i_codec_id )
{
int i_count = -1;
/* NOTE: The number of surfaces requested is calculated
based on the amount of pictures vout core needs for
direct rendering. In general that is 20/30 pictures.
i_surface_count = requested_count - (codec_needs + 1)
+ codec_needs + 1;
*/
switch( i_codec_id )
{
case CODEC_ID_MPEG1VIDEO:
......@@ -185,20 +178,16 @@ static int CalculateSurfaceCount( const int i_codec_id, const int i_requested )
case CODEC_ID_MPEG4: i_count = 2+1; break;
case CODEC_ID_WMV3: i_count = 2+1; break;
case CODEC_ID_VC1: i_count = 2+1; break;
case CODEC_ID_H264: i_count = 20+1;break;
case CODEC_ID_H264: i_count = 20+1; break;
default:
return -1;
}
int i_needed = __MAX(i_requested, i_count);
i_count += i_needed;
assert( i_count >= 23 );
return i_count;
return i_count * 2;
}
/* */
static int Open( vlc_va_vaapi_t *p_va, int i_codec_id, int i_requested )
static int Open( vlc_va_vaapi_t *p_va, int i_codec_id )
{
int i_profile;
......@@ -207,7 +196,7 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id, int i_requested )
p_va->i_config_id = VA_INVALID_ID;
p_va->image.image_id = VA_INVALID_ID;
p_va->i_surface_count = CalculateSurfaceCount(i_codec_id, i_requested);
p_va->i_surface_count = CalculateSurfaceCount(i_codec_id);
if (p_va->i_surface_count < 0 )
return VLC_EGENERIC;
......@@ -648,7 +637,7 @@ static bool QuerySurfaceReady( vlc_va_t *p_external, picture_t *pic )
}
/* */
vlc_va_t *vlc_va_NewVaapi( vlc_object_t *obj, int i_codec_id, int i_count )
vlc_va_t *vlc_va_NewVaapi( vlc_object_t *obj, int i_codec_id )
{
if( !vlc_xlib_init( obj ) )
return NULL;
......@@ -657,7 +646,7 @@ vlc_va_t *vlc_va_NewVaapi( vlc_object_t *obj, int i_codec_id, int i_count )
if( !p_va )
return NULL;
if( Open( p_va, i_codec_id, i_count ) )
if( Open( p_va, i_codec_id ) )
{
free( p_va );
return NULL;
......@@ -678,11 +667,10 @@ vlc_va_t *vlc_va_NewVaapi( vlc_object_t *obj, int i_codec_id, int i_count )
}
#else
vlc_va_t *vlc_va_NewVaapi( vlc_object_t *obj, int i_codec_id, int i_count )
vlc_va_t *vlc_va_NewVaapi( vlc_object_t *obj, int i_codec_id )
{
VLC_UNUSED( obj );
VLC_UNUSED( i_codec_id );
VLC_UNUSED( i_count );
return NULL;
}
#endif
......@@ -1178,8 +1178,7 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
}
#ifdef HAVE_AVCODEC_VAAPI
msg_Dbg( p_dec, "Trying VA API" );
int count = decoder_GetPictureCount( p_dec );
p_sys->p_va = vlc_va_NewVaapi( VLC_OBJECT(p_dec), p_sys->i_codec_id, count );
p_sys->p_va = vlc_va_NewVaapi( VLC_OBJECT(p_dec), p_sys->i_codec_id );
if( !p_sys->p_va )
msg_Warn( p_dec, "Failed to open VA API" );
#else
......
......@@ -73,7 +73,6 @@ static aout_buffer_t *aout_new_buffer( decoder_t *, int );
static picture_t *vout_new_buffer( decoder_t * );
static void vout_del_buffer( decoder_t *, picture_t * );
static int vout_get_buffer_size( decoder_t * );
static void vout_link_picture( decoder_t *, picture_t * );
static void vout_unlink_picture( decoder_t *, picture_t * );
......@@ -199,10 +198,6 @@ void decoder_DeletePicture( decoder_t *p_decoder, picture_t *p_picture )
{
p_decoder->pf_vout_buffer_del( p_decoder, p_picture );
}
int decoder_GetPictureCount( decoder_t *p_decoder )
{
return p_decoder->pf_vout_buffer_size( p_decoder );
}
void decoder_LinkPicture( decoder_t *p_decoder, picture_t *p_picture )
{
p_decoder->pf_picture_link( p_decoder, p_picture );
......@@ -809,7 +804,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_dec->pf_aout_buffer_new = aout_new_buffer;
p_dec->pf_vout_buffer_new = vout_new_buffer;
p_dec->pf_vout_buffer_del = vout_del_buffer;
p_dec->pf_vout_buffer_size = vout_get_buffer_size;
p_dec->pf_picture_link = vout_link_picture;
p_dec->pf_picture_unlink = vout_unlink_picture;
p_dec->pf_spu_buffer_new = spu_new_buffer;
......@@ -2493,11 +2487,6 @@ static void vout_del_buffer( decoder_t *p_dec, picture_t *p_pic )
vout_ReleasePicture( p_dec->p_owner->p_vout, p_pic );
}
static int vout_get_buffer_size( decoder_t *p_dec )
{
return vout_GetPictureCount( p_dec->p_owner->p_vout );
}
static void vout_link_picture( decoder_t *p_dec, picture_t *p_pic )
{
vout_HoldPicture( p_dec->p_owner->p_vout, p_pic );
......
......@@ -85,7 +85,6 @@ decoder_DeleteSubpicture
decoder_GetDisplayDate
decoder_GetDisplayRate
decoder_GetInputAttachments
decoder_GetPictureCount
decoder_LinkPicture
decoder_NewAudioBuffer
decoder_NewPicture
......@@ -631,7 +630,6 @@ vlm_MessageSimpleNew
vlm_New
vout_Close
vout_GetPicture
vout_GetPictureCount
vout_PutPicture
vout_HoldPicture
vout_ReleasePicture
......
......@@ -464,21 +464,6 @@ void vout_HoldPicture(vout_thread_t *vout, picture_t *picture)
vlc_mutex_unlock(&vout->p->picture_lock);
}
/**
* Return number of pictures available in the pool.
*/
int vout_GetPictureCount(vout_thread_t *vout)
{
if (vout == NULL)
return VOUT_MAX_PICTURES; /* FIXME: vout_internal.h has VOUT_MAX_PICTURES set to 20 */
vlc_mutex_lock(&vout->p->picture_lock);
int size = picture_pool_GetSize(vout->p->decoder_pool);
vlc_mutex_lock(&vout->p->picture_lock);
return size;
}
/* */
int vout_GetSnapshot(vout_thread_t *vout,
block_t **image_dst, picture_t **picture_dst,
......
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