]> git.sesse.net Git - vlc/blobdiff - modules/demux/avi/avi.c
modules: use vlc_object_alive()
[vlc] / modules / demux / avi / avi.c
index ab34db7848d2a74412602211f0b8d5438dc7458d..42eb4cc2b7eacd82bdfd9eaa63341f35c106da3c 100644 (file)
@@ -28,7 +28,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
 
@@ -356,10 +356,7 @@ static int Open( vlc_object_t * p_this )
     {
         avi_track_t           *tk     = malloc( sizeof( avi_track_t ) );
         if( !tk )
-        {
-            msg_Err( p_demux, "Out of memory" );
             goto error;
-        }
 
         avi_chunk_list_t      *p_strl = AVI_ChunkFind( p_hdrl, AVIFOURCC_strl, i );
         avi_chunk_strh_t      *p_strh = AVI_ChunkFind( p_strl, AVIFOURCC_strh, 0 );
@@ -549,10 +546,10 @@ static int Open( vlc_object_t * p_this )
                     __MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
                            p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) );
                 fmt.p_extra = &p_vids->p_bih[1];
-                msg_Dbg( p_demux, "stream[%d] video(%4.4s) %dx%d %dbpp %ffps",
+                msg_Dbg( p_demux, "stream[%d] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps",
                          i, (char*)&p_vids->p_bih->biCompression,
-                         p_vids->p_bih->biWidth,
-                         p_vids->p_bih->biHeight,
+                         (uint32_t)p_vids->p_bih->biWidth,
+                         (uint32_t)p_vids->p_bih->biHeight,
                          p_vids->p_bih->biBitCount,
                          (float)tk->i_rate/(float)tk->i_scale );
 
@@ -661,9 +658,13 @@ aviindex:
                           (mtime_t)1000000 )
     {
         msg_Warn( p_demux, "broken or missing index, 'seek' will be "
-                           "axproximative or will have strange behaviour" );
+                           "approximative or will exhibit strange behavior" );
         if( i_do_index == 0 && !b_index )
         {
+            if( !p_sys->b_seekable ) {
+                b_index = true;
+                goto aviindex;
+            }
             int i_create;
             i_create = intf_UserYesNo( p_demux, _("AVI Index") ,
                         _( "This AVI file is broken. Seeking will not "
@@ -976,7 +977,7 @@ static int Demux_Seekable( demux_t *p_demux )
                      * affect the reading speed too much. */
                     if( !(++i_loop_count % 1024) )
                     {
-                        if( p_demux->b_die ) return -1;
+                        if( !vlc_object_alive (p_demux) ) return -1;
                         msleep( 10000 );
 
                         if( !(i_loop_count % (1024 * 10)) )
@@ -1594,7 +1595,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux, unsigned int i_stream )
 
     for( ;; )
     {
-        if( p_demux->b_die ) return VLC_EGENERIC;
+        if( !vlc_object_alive (p_demux) ) return VLC_EGENERIC;
 
         if( AVI_PacketGetHeader( p_demux, &avi_pk ) )
         {
@@ -1614,7 +1615,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux, unsigned int i_stream )
              * affect the reading speed too much. */
             if( !(++i_loop_count % 1024) )
             {
-                if( p_demux->b_die ) return VLC_EGENERIC;
+                if( !vlc_object_alive (p_demux) ) return VLC_EGENERIC;
                 msleep( 10000 );
 
                 if( !(i_loop_count % (1024 * 10)) )
@@ -2097,7 +2098,7 @@ static int AVI_PacketSearch( demux_t *p_demux )
          * this code is called only on broken files). */
         if( !(++i_count % 1024) )
         {
-            if( p_demux->b_die ) return VLC_EGENERIC;
+            if( !vlc_object_alive (p_demux) ) return VLC_EGENERIC;
 
             msleep( 10000 );
             if( !(i_count % (1024 * 10)) )
@@ -2393,7 +2394,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
     {
         avi_packet_t pk;
 
-        if( p_demux->b_die )
+        if( !vlc_object_alive (p_demux) )
         {
             return;
         }