]> git.sesse.net Git - vlc/blobdiff - modules/codec/cvdsub.c
Removed unused or redondant fields from subpicture.
[vlc] / modules / codec / cvdsub.c
index 6e4955739adf874e75c6e68bf1251de9ec01c865..90cdc33475d543bc4c343d911e0e502acdb45a01 100644 (file)
@@ -31,7 +31,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_vout.h>
 #include <vlc_codec.h>
 
@@ -47,12 +48,12 @@ static int  PacketizerOpen( vlc_object_t * );
 static void DecoderClose  ( vlc_object_t * );
 
 vlc_module_begin();
-    set_description( _("CVD subtitle decoder") );
+    set_description( N_("CVD subtitle decoder") );
     set_capability( "decoder", 50 );
     set_callbacks( DecoderOpen, DecoderClose );
 
     add_submodule();
-    set_description( _("Chaoji VCD subtitle packetizer") );
+    set_description( N_("Chaoji VCD subtitle packetizer") );
     set_capability( "packetizer", 50 );
     set_callbacks( PacketizerOpen, DecoderClose );
 vlc_module_end();
@@ -116,8 +117,10 @@ static int DecoderOpen( vlc_object_t *p_this )
     }
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
 
-    p_sys->b_packetizer  = VLC_FALSE;
+    p_sys->b_packetizer  = false;
 
     p_sys->i_state = SUBTITLE_BLOCK_EMPTY;
     p_sys->p_spu   = NULL;
@@ -139,7 +142,7 @@ static int PacketizerOpen( vlc_object_t *p_this )
 
     if( DecoderOpen( p_this ) != VLC_SUCCESS ) return VLC_EGENERIC;
 
-    p_dec->p_sys->b_packetizer = VLC_TRUE;
+    p_dec->p_sys->b_packetizer = true;
 
     return VLC_SUCCESS;
 }
@@ -217,7 +220,7 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
 
     if( p_block->i_buffer < SPU_HEADER_LEN )
     {
-        msg_Dbg( p_dec, "invalid packet header (size %d < %d)" ,
+        msg_Dbg( p_dec, "invalid packet header (size %zu < %u)" ,
                  p_block->i_buffer, SPU_HEADER_LEN );
         block_Release( p_block );
         return NULL;
@@ -250,11 +253,11 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
 
         if( p_spu->i_buffer != p_sys->i_spu_size )
         {
-            msg_Warn( p_dec, "SPU packets size=%d should be %d",
+            msg_Warn( p_dec, "SPU packets size=%zu should be %zu",
                       p_spu->i_buffer, p_sys->i_spu_size );
         }
 
-        msg_Dbg( p_dec, "subtitle packet complete, size=%d", p_spu->i_buffer);
+        msg_Dbg( p_dec, "subtitle packet complete, size=%zuu", p_spu->i_buffer);
 
         ParseMetaInfo( p_dec, p_spu );
 
@@ -312,7 +315,7 @@ static void ParseHeader( decoder_t *p_dec, block_t *p_block )
     p_sys->i_image_length = p_sys->metadata_offset - p_sys->i_image_offset;
 
 #ifdef DEBUG_CVDSUB
-    msg_Dbg( p_dec, "total size: %d  image size: %d",
+    msg_Dbg( p_dec, "total size: %zu  image size: %zu",
              p_sys->i_spu_size, p_sys->i_image_length );
 #endif
 }
@@ -458,7 +461,8 @@ static void ParseMetaInfo( decoder_t *p_dec, block_t *p_spu  )
             p_sys->first_field_offset =
                 (p[2] << 8) + p[3] - p_sys->i_image_offset;
 #ifdef DEBUG_CVDSUB
-            msg_Dbg( p_dec, "1st_field_offset %d", p_sys->first_field_offset );
+            msg_Dbg( p_dec, "1st_field_offset %zu",
+                     p_sys->first_field_offset );
 #endif
             break;
 
@@ -468,7 +472,8 @@ static void ParseMetaInfo( decoder_t *p_dec, block_t *p_spu  )
             p_sys->second_field_offset =
                 (p[2] << 8) + p[3] - p_sys->i_image_offset;
 #ifdef DEBUG_CVDSUB
-            msg_Dbg( p_dec, "2nd_field_offset %d", p_sys->second_field_offset);
+            msg_Dbg( p_dec, "2nd_field_offset %zu",
+                     p_sys->second_field_offset);
 #endif
             break;
 
@@ -499,14 +504,9 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
     p_spu = p_dec->pf_spu_buffer_new( p_dec );
     if( !p_spu ) return NULL;
 
-    p_spu->b_pausable = VLC_TRUE;
-
-    p_spu->i_x = p_sys->i_x_start;
-    p_spu->i_x = p_spu->i_x * 3 / 4; /* FIXME: use aspect ratio for x? */
-    p_spu->i_y = p_sys->i_y_start;
     p_spu->i_start = p_data->i_pts;
     p_spu->i_stop  = p_data->i_pts + p_sys->i_duration;
-    p_spu->b_ephemer = VLC_TRUE;
+    p_spu->b_ephemer = true;
 
     /* Create new SPU region */
     memset( &fmt, 0, sizeof(video_format_t) );
@@ -523,7 +523,9 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
     }
 
     p_spu->p_region = p_region;
-    p_region->i_x = p_region->i_y = 0;
+    p_region->i_x = p_sys->i_x_start;
+    p_region->i_x = p_region->i_x * 3 / 4; /* FIXME: use aspect ratio for x? */
+    p_region->i_y = p_sys->i_y_start;
 
     /* Build palette */
     fmt.p_palette->i_entries = 4;