Commit 22267492 authored by Jean-Paul Saman's avatar Jean-Paul Saman

sanity checking

parent 416c0651
...@@ -222,8 +222,8 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -222,8 +222,8 @@ static int OpenDecoder( vlc_object_t *p_this )
int i_cat, i_codec_id, i_result; int i_cat, i_codec_id, i_result;
char *psz_namecodec; char *psz_namecodec;
AVCodecContext *p_context; AVCodecContext *p_context = NULL;
AVCodec *p_codec; AVCodec *p_codec = NULL;
/* *** determine codec type *** */ /* *** determine codec type *** */
if( !E_(GetFfmpegCodec)( p_dec->fmt_in.i_codec, &i_cat, &i_codec_id, if( !E_(GetFfmpegCodec)( p_dec->fmt_in.i_codec, &i_cat, &i_codec_id,
...@@ -244,7 +244,8 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -244,7 +244,8 @@ static int OpenDecoder( vlc_object_t *p_this )
E_(InitLibavcodec)(p_this); E_(InitLibavcodec)(p_this);
/* *** ask ffmpeg for a decoder *** */ /* *** ask ffmpeg for a decoder *** */
if( !( p_codec = avcodec_find_decoder( i_codec_id ) ) ) p_codec = avcodec_find_decoder( i_codec_id );
if( !p_codec )
{ {
msg_Dbg( p_dec, "codec not found (%s)", psz_namecodec ); msg_Dbg( p_dec, "codec not found (%s)", psz_namecodec );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -252,6 +253,8 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -252,6 +253,8 @@ static int OpenDecoder( vlc_object_t *p_this )
/* *** get a p_context *** */ /* *** get a p_context *** */
p_context = avcodec_alloc_context(); p_context = avcodec_alloc_context();
if( !p_context )
return -ENOMEM;
p_context->debug = config_GetInt( p_dec, "ffmpeg-debug" ); p_context->debug = config_GetInt( p_dec, "ffmpeg-debug" );
p_context->opaque = (void *)p_this; p_context->opaque = (void *)p_this;
...@@ -325,7 +328,7 @@ static void CloseDecoder( vlc_object_t *p_this ) ...@@ -325,7 +328,7 @@ static void CloseDecoder( vlc_object_t *p_this )
{ {
if( p_sys->p_context->extradata ) if( p_sys->p_context->extradata )
free( p_sys->p_context->extradata ); free( p_sys->p_context->extradata );
p_sys->p_context->extradata = NULL;
vlc_mutex_lock( lockval.p_address ); vlc_mutex_lock( lockval.p_address );
avcodec_close( p_sys->p_context ); avcodec_close( p_sys->p_context );
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
......
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