+ picture_t *p_image = p_dec->p_sys->p_image;
+
+ if( p_image != NULL )
+ p_image->pf_release( p_image );
+
+ vlc_mutex_destroy( &p_dec->p_sys->lock );
+ free( p_dec->p_sys );
+}
+
+/*****************************************************************************
+ * FakeCallback: Image source change callback.
+ *****************************************************************************/
+static int FakeCallback( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
+{
+ VLC_UNUSED(p_this); VLC_UNUSED(oldval);
+ decoder_t *p_dec = (decoder_t *)p_data;
+
+ if( !strcmp( psz_var, "fake-file" ) )
+ {
+ image_handler_t *p_handler;
+ picture_t *p_new_image;
+ video_format_t fmt_in, fmt_out;
+ char *psz_file = newval.psz_string;
+ picture_t *p_image;
+
+ vlc_mutex_lock( &p_dec->p_sys->lock );
+ p_image = p_dec->p_sys->p_image;
+
+ if( !psz_file || !*psz_file )
+ {
+ msg_Err( p_dec, "fake-file value must be non empty." );
+ vlc_mutex_unlock( &p_dec->p_sys->lock );
+ return VLC_EGENERIC;
+ }
+ msg_Dbg( p_dec, "Changing fake-file to %s.", psz_file );
+
+ memset( &fmt_in, 0, sizeof(fmt_in) );
+ fmt_out = p_dec->fmt_out.video;
+ p_handler = image_HandlerCreate( p_dec );
+ p_new_image = image_ReadUrl( p_handler, psz_file, &fmt_in, &fmt_out );
+ image_HandlerDelete( p_handler );
+
+ if( !p_new_image )
+ {
+ msg_Err( p_dec, "error while reading image (%s)", psz_file );
+ vlc_mutex_unlock( &p_dec->p_sys->lock );
+ return VLC_EGENERIC;
+ }