]> git.sesse.net Git - vlc/commitdiff
avformat: remove NOFILE hack, fix MXF seeking
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Sat, 19 Sep 2009 09:12:07 +0000 (12:12 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 20 Sep 2009 08:40:46 +0000 (11:40 +0300)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
modules/demux/avformat/demux.c

index a1fdfd396125feb2b3a261f670c2e8a8e17b26bf..39ada49629c03c3445c4fb6c8f6f2fa9eebfbc87 100644 (file)
@@ -111,7 +111,6 @@ int OpenDemux( vlc_object_t *p_this )
     AVProbeData   pd;
     AVInputFormat *fmt;
     unsigned int  i;
-    bool          b_avfmt_nofile;
     int64_t       i_start_time = -1;
 
     /* Init Probe data */
@@ -194,15 +193,11 @@ int OpenDemux( vlc_object_t *p_this )
     init_put_byte( &p_sys->io, p_sys->io_buffer, p_sys->io_buffer_size,
                    0, &p_sys->url, IORead, NULL, IOSeek );
 
-    b_avfmt_nofile = p_sys->fmt->flags & AVFMT_NOFILE;
-    p_sys->fmt->flags |= AVFMT_NOFILE; /* libavformat must not fopen/fclose */
-
     /* Open it */
     if( av_open_input_stream( &p_sys->ic, &p_sys->io, p_demux->psz_path,
                               p_sys->fmt, NULL ) )
     {
         msg_Err( p_demux, "av_open_input_stream failed" );
-        if( !b_avfmt_nofile ) p_sys->fmt->flags ^= AVFMT_NOFILE;
         CloseDemux( p_this );
         return VLC_EGENERIC;
     }
@@ -212,12 +207,10 @@ int OpenDemux( vlc_object_t *p_this )
     {
         vlc_avcodec_unlock();
         msg_Err( p_demux, "av_find_stream_info failed" );
-        if( !b_avfmt_nofile ) p_sys->fmt->flags ^= AVFMT_NOFILE;
         CloseDemux( p_this );
         return VLC_EGENERIC;
     }
     vlc_avcodec_unlock();
-    if( !b_avfmt_nofile ) p_sys->fmt->flags ^= AVFMT_NOFILE;
 
     for( i = 0; i < p_sys->ic->nb_streams; i++ )
     {
@@ -399,14 +392,10 @@ void CloseDemux( vlc_object_t *p_this )
 {
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
-    bool b_avfmt_nofile;
 
     FREENULL( p_sys->tk );
 
-    b_avfmt_nofile = p_sys->fmt->flags & AVFMT_NOFILE;
-    p_sys->fmt->flags |= AVFMT_NOFILE; /* libavformat must not fopen/fclose */
-    if( p_sys->ic ) av_close_input_file( p_sys->ic );
-    if( !b_avfmt_nofile ) p_sys->fmt->flags ^= AVFMT_NOFILE;
+    if( p_sys->ic ) av_close_input_stream( p_sys->ic );
 
     for( int i = 0; i < p_sys->i_attachments; i++ )
         free( p_sys->attachments[i] );