// Now attempt to open the file or device with filename
#if LIBAVFORMAT_VERSION_MAJOR > 52
+ self->video_format = avformat_alloc_context();
self->video_format->flags |= AVFMT_FLAG_PRIV_OPT;
#endif
error = av_open_input_file( &self->video_format, filename, format, 0, ¶ms ) < 0;
error = av_open_input_file( &self->video_format, URL, format, 0, ¶ms ) < 0;
// Set MLT properties onto video AVFormatContext
- apply_properties( self->video_format, properties, AV_OPT_FLAG_DECODING_PARAM );
+ if ( !error && self->video_format )
+ {
+ apply_properties( self->video_format, properties, AV_OPT_FLAG_DECODING_PARAM );
#if LIBAVFORMAT_VERSION_MAJOR > 52
- if ( self->video_format->iformat && self->video_format->iformat->priv_class && self->video_format->priv_data )
- apply_properties( self->video_format->priv_data, properties, AV_OPT_FLAG_DECODING_PARAM );
- av_demuxer_open( self->video_format, ¶ms );
+ if ( self->video_format->iformat && self->video_format->iformat->priv_class && self->video_format->priv_data )
+ apply_properties( self->video_format->priv_data, properties, AV_OPT_FLAG_DECODING_PARAM );
+ error = av_demuxer_open( self->video_format, ¶ms );
+ }
+ else if ( self->video_format )
+ {
+ avformat_free_context( self->video_format );
+ self->video_format = NULL;
#endif
+ }
// Cleanup AVFormatParameters
if ( params.standard )