set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_VCODEC )
set_callbacks( Open, Close )
- add_shortcut ( "vdadecoder" )
add_integer ( "avcodec-vda-pix-fmt", 0, VDA_PIX_FMT_TEXT,
VDA_PIX_FMT_LONGTEXT, false)
change_integer_list( nvda_pix_fmt_list, nvda_pix_fmt_list_text )
uint8_t *pp_plane[3];
size_t pi_pitch[3];
+ if (!buffer)
+ return;
+
CVPixelBufferLockBaseAddress( buffer, 0 );
for( int i = 0; i < 3; i++ )
i_width, i_height, cache );
CVPixelBufferUnlockBaseAddress( buffer, 0 );
+ CVPixelBufferRelease( buffer );
}
/*****************************************************************************
}
CVPixelBufferUnlockBaseAddress( buffer, 0 );
+ CVPixelBufferRelease( buffer );
}
-static int Setup( vlc_va_t *p_external, void **pp_hw_ctx, vlc_fourcc_t *pi_chroma,
+static int Setup( vlc_va_t *external, void **pp_hw_ctx, vlc_fourcc_t *pi_chroma,
int i_width, int i_height )
{
-
- vlc_va_vda_t *p_va = vlc_va_vda_Get( p_external );
+ vlc_va_vda_t *p_va = vlc_va_vda_Get( external );
if( p_va->hw_ctx.width == i_width
&& p_va->hw_ctx.height == i_height
case 1 :
p_va->hw_ctx.cv_pix_fmt_type = kCVPixelFormatType_422YpCbCr8;
p_va->i_chroma = VLC_CODEC_UYVY;
+ msg_Dbg(p_va->p_log, "using pixel format 422YpCbCr8");
break;
case 0 :
default :
p_va->hw_ctx.cv_pix_fmt_type = kCVPixelFormatType_420YpCbCr8Planar;
p_va->i_chroma = VLC_CODEC_I420;
CopyInitCache( &p_va->image_cache, i_width );
+ msg_Dbg(p_va->p_log, "using pixel format 420YpCbCr8Planar");
}
ok:
p_va->i_extradata );
if( status )
{
- msg_Err( p_va->p_log, "Failed to create the decoder : %i", status );
+ msg_Err( p_va->p_log, "Failed to create decoder: %i", status );
return VLC_EGENERIC;
}
+ else
+ msg_Dbg( p_va->p_log, "VDA decoder created");
return VLC_SUCCESS;
}
-static int Get( vlc_va_t *p_external, AVFrame *p_ff )
+static int Get( vlc_va_t *external, AVFrame *p_ff )
{
- VLC_UNUSED( p_external );
+ msg_Dbg(external, "Get");
+ VLC_UNUSED( external );
/* */
for( int i = 0; i < 4; i++ )
return VLC_SUCCESS;
}
-static int Extract( vlc_va_t *p_external, picture_t *p_picture, AVFrame *p_ff )
+static int Extract( vlc_va_t *external, picture_t *p_picture, AVFrame *p_ff )
{
- vlc_va_vda_t *p_va = vlc_va_vda_Get( p_external );
+ vlc_va_vda_t *p_va = vlc_va_vda_Get( external );
CVPixelBufferRef cv_buffer = ( CVPixelBufferRef )p_ff->data[3];
if( !cv_buffer )
if( p_va->hw_ctx.cv_pix_fmt_type == kCVPixelFormatType_420YpCbCr8Planar )
{
- if( !p_va->image_cache.buffer )
+ if( !p_va->image_cache.buffer ) {
+ CVPixelBufferRelease( cv_buffer );
return VLC_EGENERIC;
+ }
vda_Copy420YpCbCr8Planar( p_picture,
cv_buffer,
return VLC_SUCCESS;
}
-static void Release( vlc_va_t *p_external, AVFrame *p_ff )
+static void Release( vlc_va_t *external, AVFrame *p_ff )
{
- VLC_UNUSED( p_external );
+ VLC_UNUSED( external );
CVPixelBufferRef cv_buffer = ( CVPixelBufferRef )p_ff->data[3];
if ( cv_buffer )
- CFRelease( cv_buffer );
+ CVPixelBufferRelease( cv_buffer );
}
-static void Close( vlc_va_t *p_external )
+static void Close( vlc_va_t *external )
{
- vlc_va_vda_t *p_va = vlc_va_vda_Get( p_external );
+ vlc_va_vda_t *p_va = vlc_va_vda_Get( external );
+
+ msg_Dbg(p_va->p_log, "destroying VDA decoder");
ff_vda_destroy_decoder( &p_va->hw_ctx ) ;
static int Open( vlc_va_t *external, int i_codec_id, const es_format_t *fmt )
{
+ msg_Dbg( external, "opening VDA module" );
if( i_codec_id != AV_CODEC_ID_H264 )
+ {
+ msg_Warn( external, "input codec isn't H264, canceling VDA decoding" );
return VLC_EGENERIC;
+ }
if( fmt->p_extra == NULL || fmt->i_extra < 7 )
{