# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_vout.h>
#include <png.h>
*****************************************************************************/
struct decoder_sys_t
{
- vlc_bool_t b_error;
+ bool b_error;
};
/*****************************************************************************
vlc_module_begin();
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_VCODEC );
- set_description( _("PNG video decoder") );
+ set_description( N_("PNG video decoder") );
set_capability( "decoder", 1000 );
set_callbacks( OpenDecoder, CloseDecoder );
add_shortcut( "png" );
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
- {
- msg_Err( p_dec, "out of memory" );
- return VLC_EGENERIC;
- }
+ return VLC_ENOMEM;
/* Set output properties */
p_dec->fmt_out.i_cat = VIDEO_ES;
static void user_error( png_structp p_png, png_const_charp error_msg )
{
decoder_t *p_dec = (decoder_t *)png_get_error_ptr( p_png );
- p_dec->p_sys->b_error = VLC_TRUE;
+ p_dec->p_sys->b_error = true;
msg_Err( p_dec, error_msg );
}
if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
- p_sys->b_error = VLC_FALSE;
+ p_sys->b_error = false;
p_png = png_create_read_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
if( p_png == NULL )
/* Decode picture */
p_row_pointers = malloc( sizeof(png_bytep) * i_height );
+ if( !p_row_pointers )
+ goto error;
for( i = 0; i < (int)i_height; i++ )
p_row_pointers[i] = p_pic->p->p_pixels + p_pic->p->i_pitch * i;
error:
- if( p_row_pointers ) free( p_row_pointers );
+ free( p_row_pointers );
png_destroy_read_struct( &p_png, &p_info, &p_end_info );
block_Release( p_block ); *pp_block = NULL;
return NULL;