]> git.sesse.net Git - vlc/blobdiff - modules/codec/dvbsub.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / codec / dvbsub.c
index 50bd066dc25462fc114d3aadbc0b3b6f25402a59..8fc151ae8b882833616f17329d8f6cc72cb2bd48 100644 (file)
@@ -32,7 +32,7 @@
  * FIXME:
  * DVB subtitles coded as strings of characters are not handled correctly.
  * The character codes in the string should actually be indexes referring to a
- * character table identified in the subtitle descriptor. 
+ * character table identified in the subtitle descriptor.
  *
  * The spec is quite vague in this area, but what is meant is perhaps that it
  * refers to the character index in the codepage belonging to the language specified
@@ -52,7 +52,7 @@
 #define POSX_LONGTEXT N_("X coordinate of the rendered subtitle")
 
 #define POSY_TEXT N_("Decoding Y coordinate")
-#define POSY_LONGTEXT N_("Y coordinate of the rendered subtitle") 
+#define POSY_LONGTEXT N_("Y coordinate of the rendered subtitle")
 
 #define POS_TEXT N_("Subpicture position")
 #define POS_LONGTEXT N_( \
@@ -102,7 +102,7 @@ vlc_module_begin();
 
     add_integer( ENC_CFG_PREFIX "x", -1, NULL, ENC_POSX_TEXT, ENC_POSX_LONGTEXT, VLC_FALSE );
     add_integer( ENC_CFG_PREFIX "y", -1, NULL, ENC_POSY_TEXT, ENC_POSY_LONGTEXT, VLC_FALSE );
-    add_suppressed_integer( ENC_CFG_PREFIX "timeout" ); /* Suppressed since 0.8.5 */
+    add_obsolete_integer( ENC_CFG_PREFIX "timeout" ); /* Suppressed since 0.8.5 */
 vlc_module_end();
 
 static const char *ppsz_enc_options[] = { "x", "y", NULL };
@@ -249,7 +249,7 @@ struct decoder_sys_t
 #define DVBSUB_OT_BASIC_CHAR            0x01
 #define DVBSUB_OT_COMPOSITE_STRING      0x02
 /* Pixel DATA TYPES */
-/* According to EN 300-743, table 9 */ 
+/* According to EN 300-743, table 9 */
 #define DVBSUB_DT_2BP_CODE_STRING       0x10
 #define DVBSUB_DT_4BP_CODE_STRING       0x11
 #define DVBSUB_DT_8BP_CODE_STRING       0x12
@@ -297,9 +297,14 @@ static int Open( vlc_object_t *p_this )
 
     p_dec->pf_decode_sub = Decode;
     p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
+    if( !p_sys )
+    {
+        msg_Err( p_dec, "out of memory" );
+        return VLC_ENOMEM;
+    }
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
-    p_sys->i_pts          = (mtime_t) 0;    
+    p_sys->i_pts          = (mtime_t) 0;
     p_sys->i_id           = p_dec->fmt_in.subs.dvb.i_id & 0xFFFF;
     p_sys->i_ancillary_id = p_dec->fmt_in.subs.dvb.i_id >> 16;
 
@@ -971,7 +976,7 @@ static void decode_display_definition( decoder_t *p_dec, bs_t *s )
         p_display->i_max_x = bs_read( s, 16 );
         p_display->i_y     = bs_read( s, 16 );
         p_display->i_max_y = bs_read( s, 16 );
-        i_processed_length += 64;  
+        i_processed_length += 64;
     }
 
     p_sys->p_display = p_display;
@@ -1492,6 +1497,7 @@ static subpicture_t *render( decoder_t *p_dec )
         }
         p_spu_region->i_x = p_regiondef->i_x;
         p_spu_region->i_y = p_regiondef->i_y;
+        p_spu_region->i_align = p_sys->i_spu_position;
         *pp_spu_region = p_spu_region;
         pp_spu_region = &p_spu_region->p_next;
 
@@ -1546,6 +1552,7 @@ static subpicture_t *render( decoder_t *p_dec )
             p_spu_region->psz_text = strdup( p_object_def->psz_text );
             p_spu_region->i_x = p_regiondef->i_x + p_object_def->i_x;
             p_spu_region->i_y = p_regiondef->i_y + p_object_def->i_y;
+            p_spu_region->i_align = p_sys->i_spu_position;
             *pp_spu_region = p_spu_region;
             pp_spu_region = &p_spu_region->p_next;
         }
@@ -1660,7 +1667,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     return VLC_SUCCESS;
 }
 
-/* FIXME: this routine is a hack to convert VLC_FOURCC('Y','U','V','A') 
+/* FIXME: this routine is a hack to convert VLC_FOURCC('Y','U','V','A')
  *        into VLC_FOURCC('Y','U','V','P')
  */
 static subpicture_t *YuvaYuvp( encoder_t *p_enc, subpicture_t *p_subpic )
@@ -1896,7 +1903,14 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
     if( !p_region ) return NULL;
 
     if( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') &&
-        p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') ) return NULL;
+        p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') )
+    {
+        char psz_fourcc[5];
+        memset( &psz_fourcc, 0, sizeof(char)*5 );
+        vlc_fourcc_to_char( p_region->fmt.i_chroma, &psz_fourcc );
+        msg_Err( p_enc, "chroma %4s not supported", &psz_fourcc );
+        return NULL;
+    }
 
     if( p_region->fmt.p_palette )
     {
@@ -2008,7 +2022,7 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
         }
 
         if( ( p_sys->p_regions[i_regions].i_width <
-              (int)p_region->fmt.i_visible_width ) || 
+              (int)p_region->fmt.i_visible_width ) ||
             ( p_sys->p_regions[i_regions].i_width >
               (int)p_region->fmt.i_visible_width ) )
         {
@@ -2058,8 +2072,8 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
         }
         else
         {
-            bs_write( s, 16, p_region->i_x );
-            bs_write( s, 16, p_region->i_y );
+            bs_write( s, 16, p_subpic->i_x + p_region->i_x );
+            bs_write( s, 16, p_subpic->i_y + p_region->i_y );
         }
     }
 }