- // And open again for our audio context
- av_open_input_file( &self->audio_format, filename, NULL, 0, NULL );
- apply_properties( self->audio_format, properties, AV_OPT_FLAG_DECODING_PARAM );
-#if LIBAVFORMAT_VERSION_MAJOR > 52
- if ( self->audio_format->iformat && self->audio_format->iformat->priv_class && self->audio_format->priv_data )
- apply_properties( self->audio_format->priv_data, properties, AV_OPT_FLAG_DECODING_PARAM );
-#endif
- av_find_stream_info( self->audio_format );
+ if ( self->seekable )
+ {
+ // And open again for our audio context
+#if LIBAVFORMAT_VERSION_INT > ((53<<16)+(6<<8)+0)
+ avformat_open_input( &self->audio_format, filename, NULL, NULL );
+ apply_properties( self->audio_format, properties, AV_OPT_FLAG_DECODING_PARAM );
+ if ( self->audio_format->iformat && self->audio_format->iformat->priv_class && self->audio_format->priv_data )
+ apply_properties( self->audio_format->priv_data, properties, AV_OPT_FLAG_DECODING_PARAM );
+ avformat_find_stream_info( self->audio_format, NULL );
+#else
+ av_open_input_file( &self->audio_format, filename, NULL, 0, NULL );
+ apply_properties( self->audio_format, properties, AV_OPT_FLAG_DECODING_PARAM );
+#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(110<<8)+0)
+ if ( self->audio_format->iformat && self->audio_format->iformat->priv_class && self->audio_format->priv_data )
+ apply_properties( self->audio_format->priv_data, properties, AV_OPT_FLAG_DECODING_PARAM );
+#endif
+ av_find_stream_info( self->audio_format );
+#endif
+ }
+ else
+ {
+ self->audio_format = self->video_format;
+ }