X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Fimage.c;h=7a6457262034a739d6b97920491416bc96e2f5a2;hb=f659703fb4033420e0607d34bc7cd880a5802ea7;hp=c917f58af7c3e8639a45e815cb76e9b527b856e3;hpb=c1abcb019a04234e50764d30c8b6cb63620eeff9;p=vlc diff --git a/src/misc/image.c b/src/misc/image.c index c917f58af7..7a64572620 100644 --- a/src/misc/image.c +++ b/src/misc/image.c @@ -43,9 +43,10 @@ #include #include #include -#include +#include #include #include +#include static picture_t *ImageRead( image_handler_t *, block_t *, video_format_t *, video_format_t * ); @@ -74,11 +75,12 @@ vlc_fourcc_t image_Type2Fourcc( const char * ); vlc_fourcc_t image_Ext2Fourcc( const char * ); /*static const char *Fourcc2Ext( vlc_fourcc_t );*/ +#undef image_HandlerCreate /** * Create an image_handler_t instance * */ -image_handler_t *__image_HandlerCreate( vlc_object_t *p_this ) +image_handler_t *image_HandlerCreate( vlc_object_t *p_this ) { image_handler_t *p_image = calloc( 1, sizeof(image_handler_t) ); if( !p_image ) @@ -339,9 +341,15 @@ static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic, p_tmp_pic = p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic ); - p_block = p_image->p_enc->pf_encode_video( p_image->p_enc, p_tmp_pic ); - - p_image->p_filter->pf_video_buffer_del( p_image->p_filter, p_tmp_pic ); + if( likely(p_tmp_pic != NULL) ) + { + p_block = p_image->p_enc->pf_encode_video( p_image->p_enc, + p_tmp_pic ); + p_image->p_filter->pf_video_buffer_del( p_image->p_filter, + p_tmp_pic ); + } + else + p_block = NULL; } else { @@ -370,7 +378,7 @@ static int ImageWriteUrl( image_handler_t *p_image, picture_t *p_pic, p_fmt_out->i_chroma = image_Ext2Fourcc( psz_url ); } - file = utf8_fopen( psz_url, "wb" ); + file = vlc_fopen( psz_url, "wb" ); if( !file ) { msg_Err( p_image->p_parent, "%s: %m", psz_url ); @@ -683,8 +691,6 @@ static decoder_t *CreateDecoder( vlc_object_t *p_this, video_format_t *fmt ) static void DeleteDecoder( decoder_t * p_dec ) { - vlc_object_detach( p_dec ); - if( p_dec->p_module ) module_unneed( p_dec, p_dec->p_module ); es_format_Clean( &p_dec->fmt_in ); @@ -766,8 +772,6 @@ static encoder_t *CreateEncoder( vlc_object_t *p_this, video_format_t *fmt_in, static void DeleteEncoder( encoder_t * p_enc ) { - vlc_object_detach( p_enc ); - if( p_enc->p_module ) module_unneed( p_enc, p_enc->p_module ); es_format_Clean( &p_enc->fmt_in ); @@ -812,8 +816,6 @@ static filter_t *CreateFilter( vlc_object_t *p_this, es_format_t *p_fmt_in, static void DeleteFilter( filter_t * p_filter ) { - vlc_object_detach( p_filter ); - if( p_filter->p_module ) module_unneed( p_filter, p_filter->p_module ); es_format_Clean( &p_filter->fmt_in );