]> git.sesse.net Git - vlc/blobdiff - modules/packetizer/vc1.c
Document vlc_custom_create.
[vlc] / modules / packetizer / vc1.c
index 449dfc1436d4d07563350d9277f735c108dc275b..353281da83bc6ecd5993ae70920b55de52ab5e99 100644 (file)
@@ -2,7 +2,7 @@
  * vc1.c
  *****************************************************************************
  * Copyright (C) 2001, 2002, 2006 the VideoLAN team
- * $Id: copy.c 18231 2006-12-03 17:02:02Z courmisch $
+ * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@videolan.org>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include <vlc/vlc.h>
 #include <vlc_codec.h>
@@ -58,7 +61,7 @@ struct decoder_sys_t
      */
     block_bytestream_t bytestream;
     int i_state;
-    int i_offset;
+    size_t i_offset;
     uint8_t p_startcode[3];
 
     /* Current sequence header */
@@ -134,7 +137,7 @@ static int Open( vlc_object_t *p_this )
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
 
     p_sys->i_state = STATE_NOSYNC;
-    p_sys->bytestream = block_BytestreamInit( p_dec );
+    p_sys->bytestream = block_BytestreamInit();
     p_sys->p_startcode[0] = 0x00;
     p_sys->p_startcode[1] = 0x00;
     p_sys->p_startcode[2] = 0x01;
@@ -194,18 +197,20 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
     if( pp_block == NULL || *pp_block == NULL )
         return NULL;
 
-    if( (*pp_block)->i_flags & BLOCK_FLAG_DISCONTINUITY )
-    {
-        block_Release( *pp_block );
-        return NULL;
-    }
-    if( (*pp_block)->i_flags & BLOCK_FLAG_CORRUPTED )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
-        p_sys->i_state = STATE_NOSYNC;
-        if( p_sys->p_frame )
-            block_ChainRelease( p_sys->p_frame );
-        p_sys->p_frame = NULL;
-        p_sys->pp_last = &p_sys->p_frame;
+        if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
+        {
+            p_sys->i_state = STATE_NOSYNC;
+            block_BytestreamFlush( &p_sys->bytestream );
+
+            if( p_sys->p_frame )
+                block_ChainRelease( p_sys->p_frame );
+            p_sys->p_frame = NULL;
+            p_sys->pp_last = &p_sys->p_frame;
+            p_sys->b_frame = VLC_FALSE;
+        }
+//        p_sys->i_interpolated_dts = 0;
         block_Release( *pp_block );
         return NULL;
     }
@@ -422,8 +427,8 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
         if( i_ridu > 4 && (ridu[0]&0x80) == 0 ) /* for advanced profile, the first bit is 1 */
         {
             video_format_t *p_v = &p_dec->fmt_in.video;
-            const int i_potential_width  = GetWBE( &ridu[0] );
-            const int i_potential_height = GetWBE( &ridu[2] );
+            const size_t i_potential_width  = GetWBE( &ridu[0] );
+            const size_t i_potential_height = GetWBE( &ridu[2] );
 
             if( i_potential_width >= 2  && i_potential_width <= 8192 &&
                 i_potential_height >= 2 && i_potential_height <= 8192 )
@@ -489,7 +494,7 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
                         {64,33}, {160,99},{ 0, 0}, { 0, 0}
                     };
                     int i_ar = bs_read( &s, 4 );
-                    int i_ar_w, i_ar_h;
+                    unsigned i_ar_w, i_ar_h;
 
                     if( i_ar == 15 )
                     {