]> git.sesse.net Git - vlc/commitdiff
Removed unused or redondant fields from subpicture.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 15 Sep 2008 19:49:19 +0000 (21:49 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 15 Sep 2008 19:55:34 +0000 (21:55 +0200)
I removed:
 i_x/i_y: redondant with region i_x/i_y. Now a subpicture always represent the
 whole video.
 i_flags: unused anywhere in the core.

 I may have broken a few video filters (osdmenu mainly). I will fix it if you
report the problem and the way to reproduce it.

23 files changed:
include/vlc_vout.h
modules/codec/cc.c
modules/codec/csri.c
modules/codec/cvdsub.c
modules/codec/dvbsub.c
modules/codec/libass.c
modules/codec/spudec/parse.c
modules/codec/subtitles/subsass.c
modules/codec/subtitles/subsdec.c
modules/codec/svcdsub.c
modules/codec/telx.c
modules/codec/zvbi.c
modules/video_filter/dynamicoverlay/dynamicoverlay.c
modules/video_filter/logo.c
modules/video_filter/marq.c
modules/video_filter/mosaic.c
modules/video_filter/osdmenu.c
modules/video_filter/remoteosd.c
modules/video_filter/rss.c
src/control/mediacontrol_audio_video.c
src/osd/osd_text.c
src/video_output/video_text.c
src/video_output/vout_subpictures.c

index ef53fc86f6db254ca1b6eb3060e3b79a5de5892b..16de5390d30306089b6b6532ab851c05cbe7f08f 100644 (file)
@@ -353,14 +353,11 @@ struct subpicture_t
      * changed by the video output thread, or simply ignored depending of the
      * subtitle type. */
     /**@{*/
-    int          i_x;                    /**< offset from alignment position */
-    int          i_y;                    /**< offset from alignment position */
-    int          i_alpha;                                  /**< transparency */
     int          i_original_picture_width;  /**< original width of the movie */
     int          i_original_picture_height;/**< original height of the movie */
-    bool         b_absolute;                       /**< position is absolute */
-    int          i_flags;                                /**< position flags */
     bool         b_subtitle;            /**< the picture is a movie subtitle */
+    bool         b_absolute;                       /**< position is absolute */
+    int          i_alpha;                                  /**< transparency */
      /**@}*/
 
     /** Pointer to function that renders this subtitle in a picture */
index dc0c9f78af9605ff8a0e9e844383fa033f0b44dd..f575f669f645544c0468c4a615234e66d7dd6c7c 100644 (file)
@@ -357,8 +357,8 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
     /* Decode and format the subpicture unit */
     /* Normal text subs, easy markup */
     p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM;// | SUBPICTURE_ALIGN_LEFT;// | p_sys->i_align;
-    p_spu->i_x = 0; //p_sys->i_align ? 20 : 0;
-    p_spu->i_y = 10;
+    p_spu->p_region->i_x = 0; //p_sys->i_align ? 20 : 0;
+    p_spu->p_region->i_y = 10;
 
     p_spu->p_region->psz_text = psz_subtitle;
     p_spu->p_region->psz_html = psz_html;
index 2730fe88fd0400d58675857854aff073381b57fc..3086d6d45ebb9e6b0192f0560cdade466b21340e 100644 (file)
@@ -204,8 +204,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer,
             p_block->i_buffer );
 
-    p_spu->i_x = 0;
-    p_spu->i_y = 0;
     p_spu->i_start = p_block->i_pts;
     p_spu->i_stop = p_block->i_pts + p_block->i_length;
     p_spu->b_ephemer = false;
index 419ff204c1c2e266cb5b92dedcbd8745ec827ff0..90cdc33475d543bc4c343d911e0e502acdb45a01 100644 (file)
@@ -504,9 +504,6 @@ 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->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 = true;
@@ -526,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;
index dc83d551df20de3dd073ffb619dd6194742e14ce..30db44ea704f288110808c055474cd082b62169c 100644 (file)
@@ -1446,10 +1446,42 @@ static subpicture_t *render( decoder_t *p_dec )
     subpicture_t *p_spu;
     subpicture_region_t **pp_spu_region;
     int i, j, i_timeout = 0;
+    int i_base_x;
+    int i_base_y;
 
     /* Allocate the subpicture internal data. */
     p_spu = p_dec->pf_spu_buffer_new( p_dec );
-    if( !p_spu ) return NULL;
+    if( !p_spu )
+        return NULL;
+
+    p_spu->b_absolute = p_sys->b_absolute;
+    /* Set the pf_render callback */
+    p_spu->i_start = (mtime_t) p_sys->i_pts;
+    //p_spu->i_stop = (mtime_t) 0;
+    p_spu->b_ephemer = true;
+    //p_spu->b_fade = true;
+    //p_spu->i_stop = p_spu->i_start + (mtime_t) (i_timeout * 1000000);
+
+    /* Correct positioning of SPU */
+    i_base_x = p_sys->i_spu_x;
+    i_base_y = p_sys->i_spu_y;
+    p_spu->i_original_picture_width = 720;
+    p_spu->i_original_picture_height = 576;
+
+    if( p_sys->p_display )
+    {
+        p_spu->i_original_picture_width = p_sys->p_display->i_width;
+        p_spu->i_original_picture_height = p_sys->p_display->i_height;
+
+        if( p_sys->p_display->b_windowed )
+        {
+            /* TODO: check that this actually works */
+            p_spu->i_original_picture_width = p_sys->p_display->i_max_x - p_sys->p_display->i_x;
+            p_spu->i_original_picture_height = p_sys->p_display->i_max_y - p_sys->p_display->i_y;
+            i_base_x += p_sys->p_display->i_x;
+            i_base_y += p_sys->p_display->i_y;
+        }
+    }
 
     pp_spu_region = &p_spu->p_region;
 
@@ -1519,8 +1551,8 @@ static subpicture_t *render( decoder_t *p_dec )
             msg_Err( p_dec, "cannot allocate SPU region" );
             continue;
         }
-        p_spu_region->i_x = p_regiondef->i_x;
-        p_spu_region->i_y = p_regiondef->i_y;
+        p_spu_region->i_x = i_base_x + p_regiondef->i_x;
+        p_spu_region->i_y = i_base_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;
@@ -1574,43 +1606,14 @@ 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_x = i_base_x + p_regiondef->i_x + p_object_def->i_x;
+            p_spu_region->i_y = i_base_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;
         }
     }
 
-    /* Set the pf_render callback */
-    p_spu->i_start = (mtime_t) p_sys->i_pts;
-    //p_spu->i_stop = (mtime_t) 0;
-    p_spu->b_ephemer = true;
-    //p_spu->b_fade = true;
-    //p_spu->i_stop = p_spu->i_start + (mtime_t) (i_timeout * 1000000);
-
-    /* Correct positioning of SPU */
-    p_spu->b_absolute = p_sys->b_absolute;
-    p_spu->i_x = p_sys->i_spu_x;
-    p_spu->i_y = p_sys->i_spu_y;
-    p_spu->i_original_picture_width = 720;
-    p_spu->i_original_picture_height = 576;
-
-    if( p_sys->p_display )
-    {
-        p_spu->i_original_picture_width = p_sys->p_display->i_width;
-        p_spu->i_original_picture_height = p_sys->p_display->i_height;
-
-        if( p_sys->p_display->b_windowed )
-        {
-            /* TODO: check that this actually works */
-            p_spu->i_original_picture_width = p_sys->p_display->i_max_x - p_sys->p_display->i_x;
-            p_spu->i_original_picture_height = p_sys->p_display->i_max_y - p_sys->p_display->i_y;
-            p_spu->i_x += p_sys->p_display->i_x;
-            p_spu->i_y += p_sys->p_display->i_y;
-        }
-    }
-
     return p_spu;
 }
 
@@ -2092,8 +2095,8 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
         }
         else
         {
-            bs_write( s, 16, p_subpic->i_x + p_region->i_x );
-            bs_write( s, 16, p_subpic->i_y + p_region->i_y );
+            bs_write( s, 16, p_region->i_x );
+            bs_write( s, 16, p_region->i_y );
         }
     }
 }
index c36845182d1d16bc049e0b59ae5fb2c3af508b11..5ae9c38860a3cee52b2ccb1916894a7a31157002 100644 (file)
@@ -272,8 +272,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer,
             p_block->i_buffer );
 
-    p_spu->i_x = 0;
-    p_spu->i_y = 0;
     p_spu->i_start = p_block->i_pts;
     p_spu->i_stop = p_block->i_pts + p_block->i_length;
     p_spu->b_ephemer = true;
index e8d91c963011b94aa95f190ac003a6c64a17d610..3e0efff3a86cf83139a80bb3ece27f93f774138f 100644 (file)
@@ -44,6 +44,8 @@ typedef struct
 {
     int i_width;
     int i_height;
+    int i_x;
+    int i_y;
 } spu_properties_t;
 
 static int  ParseControlSeq( decoder_t *, subpicture_t *, subpicture_data_t *,
@@ -277,15 +279,15 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
                 return VLC_EGENERIC;
             }
 
-            p_spu->i_x = (p_sys->buffer[i_index+1]<<4)|
+            p_spu_properties->i_x = (p_sys->buffer[i_index+1]<<4)|
                          ((p_sys->buffer[i_index+2]>>4)&0x0f);
             p_spu_properties->i_width = (((p_sys->buffer[i_index+2]&0x0f)<<8)|
-                              p_sys->buffer[i_index+3]) - p_spu->i_x + 1;
+                              p_sys->buffer[i_index+3]) - p_spu_properties->i_x + 1;
 
-            p_spu->i_y = (p_sys->buffer[i_index+4]<<4)|
+            p_spu_properties->i_y = (p_sys->buffer[i_index+4]<<4)|
                          ((p_sys->buffer[i_index+5]>>4)&0x0f);
             p_spu_properties->i_height = (((p_sys->buffer[i_index+5]&0x0f)<<8)|
-                              p_sys->buffer[i_index+6]) - p_spu->i_y + 1;
+                              p_sys->buffer[i_index+6]) - p_spu_properties->i_y + 1;
 
             /* Auto crop fullscreen subtitles */
             if( p_spu_properties->i_height > 250 )
@@ -672,8 +674,8 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
         return;
     }
 
-    p_spu->p_region->i_x = 0;
-    p_spu->p_region->i_y = p_spu_data->i_y_top_offset;
+    p_spu->p_region->i_x = p_spu_properties->i_x;
+    p_spu->p_region->i_y = p_spu_properties->i_y + p_spu_data->i_y_top_offset;
     p_p = p_spu->p_region->picture.p->p_pixels;
     i_pitch = p_spu->p_region->picture.p->i_pitch;
 
index 37250026c37fe17ae69f8b722fb502f234f57dac..1706c9c78cc6c9400735cfdc51fc77aba696a2df 100644 (file)
@@ -127,8 +127,8 @@ void ParseSSAString( decoder_t *p_dec,
     if( p_style == NULL )
     {
         p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
-        p_spu->i_x = p_sys->i_align ? 20 : 0;
-        p_spu->i_y = 10;
+        p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
+        p_spu->p_region->i_y = 10;
     }
     else
     {
@@ -137,13 +137,13 @@ void ParseSSAString( decoder_t *p_dec,
         p_spu->p_region->i_align = p_style->i_align;
         if( p_style->i_align & SUBPICTURE_ALIGN_LEFT )
         {
-            p_spu->i_x = (i_margin_l) ? i_margin_l : p_style->i_margin_h;
+            p_spu->p_region->i_x = (i_margin_l) ? i_margin_l : p_style->i_margin_h;
         }
         else if( p_style->i_align & SUBPICTURE_ALIGN_RIGHT )
         {
-            p_spu->i_x = (i_margin_r) ? i_margin_r : p_style->i_margin_h;
+            p_spu->p_region->i_x = (i_margin_r) ? i_margin_r : p_style->i_margin_h;
         }
-        p_spu->i_y = (i_margin_v) ? i_margin_v : p_style->i_margin_v;
+        p_spu->p_region->i_y = (i_margin_v) ? i_margin_v : p_style->i_margin_v;
     }
 }
 
index 2417e674216f952ffc93869ca9483d7442944406..b8f5743e35d5af1066f8f35a1ec0cafbbe343c13 100644 (file)
@@ -427,8 +427,8 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
     {
         /* Normal text subs, easy markup */
         p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
-        p_spu->i_x = p_sys->i_align ? 20 : 0;
-        p_spu->i_y = 10;
+        p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
+        p_spu->p_region->i_y = 10;
 
         /* Remove formatting from string */
 
@@ -616,8 +616,8 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
     /* Check for forced alignment */
     if( !strncmp( psz_subtitle, "{\\an", 4 ) && psz_subtitle[4] >= '1' && psz_subtitle[4] <= '9' && psz_subtitle[5] == '}' )
     {
-        static const pi_vertical[3] = { SUBPICTURE_ALIGN_BOTTOM, 0, SUBPICTURE_ALIGN_TOP };
-        static const pi_horizontal[3] = { SUBPICTURE_ALIGN_LEFT, 0, SUBPICTURE_ALIGN_RIGHT };
+        static const int pi_vertical[3] = { SUBPICTURE_ALIGN_BOTTOM, 0, SUBPICTURE_ALIGN_TOP };
+        static const int pi_horizontal[3] = { SUBPICTURE_ALIGN_LEFT, 0, SUBPICTURE_ALIGN_RIGHT };
         const int i_id = psz_subtitle[4] - '1';
 
         *pi_align = pi_vertical[i_id/3] | pi_horizontal[i_id%3];
index f0d174f5d36402403bbc80cf3bae7e26e6fdb332..2c54c170292b6b0390d2614939b9658a8fde5cd4 100644 (file)
@@ -473,8 +473,6 @@ 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->i_x = p_sys->i_x_start;
-    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 = true;
@@ -506,7 +504,8 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
     p_region->fmt.i_aspect = VOUT_ASPECT_FACTOR;
  
     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_y = p_sys->i_y_start;
 
     /* Build palette */
     fmt.p_palette->i_entries = 4;
index 0be2a04a03a64be9f8738aa11bb1cead5d5d55b2..6da895d0d279acc5da1915c9f4243884c9683c67 100644 (file)
@@ -717,10 +717,10 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
 
     /* Normal text subs, easy markup */
     p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
-    p_spu->i_x = p_sys->i_align ? 20 : 0;
-    p_spu->i_y = 10;
-
+    p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
+    p_spu->p_region->i_y = 10;
     p_spu->p_region->psz_text = strdup(psz_text);
+
     p_spu->i_start = p_block->i_pts;
     p_spu->i_stop = p_block->i_pts + p_block->i_length;
     p_spu->b_ephemer = (p_block->i_length == 0);
index c5c0e7b911091627bc22365eedfbf5be3f48ad82..88fe5bd2690d17617d7aef89314d0a98e55e839d 100644 (file)
@@ -495,9 +495,6 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
     p_spu->p_region->i_y = 0;
     p_spu->p_region->i_align = i_align;
 
-    /* Normal text subs, easy markup */
-    p_spu->i_flags = SUBPICTURE_ALIGN_BOTTOM;
-
     p_spu->i_start = i_pts;
     p_spu->i_stop = 0;
     p_spu->b_ephemer = true;
index 02e9a56cd3dbc7a9b5691a81260185462c5b0a8f..77bcd5d7940c4c52da8978f01d0a3a8d23619228 100644 (file)
@@ -337,9 +337,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         return NULL;
     }
 
-    p_spu->i_flags = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
-    p_spu->i_x = 0;
-    p_spu->i_y = 0;
     p_spu->b_absolute = true;
     p_spu->i_start = date;
     p_spu->i_stop = 0;
index 004096ac3a5643ee560f8751e04fd3f313530ccb..4c7321da3ff065ab3fbdc81a9433e034b660e0cd 100644 (file)
@@ -888,8 +888,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         p_spu->b_absolute = false;
     }
 
-    p_spu->i_x = p_sys->posx;
-    p_spu->i_y = p_sys->posy;
+    p_region->i_x = p_sys->posx;
+    p_region->i_y = p_sys->posy;
 
     p_spu->p_region = p_region;
 
index e454ca907c5a24913e1799effd6bab0f4fa2a331..030442b65dea8a8cf37096bbbd663ff9d0c6f54d 100644 (file)
@@ -317,8 +317,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         p_spu->b_absolute = false;
     }
 
-    p_spu->i_x = p_sys->i_xoff;
-    p_spu->i_y = p_sys->i_yoff;
+    p_spu->p_region->i_x = p_sys->i_xoff;
+    p_spu->p_region->i_y = p_sys->i_yoff;
 
     p_spu->p_region->p_style = p_sys->p_style;
 
index 8c6ac46f684cacbb0c27256e854d4a87b5ed9a3a..b581dbd53ebaa66963e2820ffc474dca1b26285f 100644 (file)
@@ -458,7 +458,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     p_spu->i_stop = 0;
     p_spu->b_ephemer = true;
     p_spu->i_alpha = p_sys->i_alpha;
-    p_spu->i_flags = p_sys->i_align;
     p_spu->b_absolute = false;
 
     vlc_mutex_lock( &p_sys->lock );
index 3393d660b3290b65d2a4aa5f109302eae3a91037..d8f68f7a3e2eb3539908e9407e184abfb8dafc45 100644 (file)
@@ -451,6 +451,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
     filter_sys_t *p_sys = p_filter->p_sys;
     subpicture_t *p_spu = NULL;
     subpicture_region_t *p_region = NULL;
+    int i_x, i_y;
 
     if( !p_sys->b_update || (p_sys->i_update <= 0) )
             return NULL;
@@ -472,7 +473,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
         p_spu->b_absolute = true;
     else
         p_spu->b_absolute = p_sys->b_absolute;
-    p_spu->i_flags = p_sys->i_position;
 
     /* Determine the duration of the subpicture */
     if( p_sys->i_end_date > 0 )
@@ -505,8 +505,11 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
             NULL );
 
         /* proper positioning of OSD menu image */
-        p_spu->i_x = p_filter->p_sys->p_menu->p_state->i_x;
-        p_spu->i_y = p_filter->p_sys->p_menu->p_state->i_y;
+        p_region->i_x = p_filter->p_sys->p_menu->p_state->i_x;
+        p_region->i_y = p_filter->p_sys->p_menu->p_state->i_y;
+        /* FIXME is it needed ?
+        p_region->i_align = p_sys->i_position;
+        */
         p_spu->p_region = p_region;
         p_spu->i_alpha = 0xFF; /* Picture is completely non transparent. */
         return p_spu;
@@ -535,14 +538,16 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
     /* proper positioning of OSD menu image */
     if( p_filter->p_sys->p_menu->i_style == OSD_MENU_STYLE_CONCAT )
     {
-        p_spu->i_x = p_filter->p_sys->p_menu->p_button->i_x;
-        p_spu->i_y = p_filter->p_sys->p_menu->p_button->i_y;
+        i_x = p_filter->p_sys->p_menu->p_button->i_x;
+        i_y = p_filter->p_sys->p_menu->p_button->i_y;
     }
     else
     {
-        p_spu->i_x = p_filter->p_sys->p_menu->p_state->i_x;
-        p_spu->i_y = p_filter->p_sys->p_menu->p_state->i_y;
+        i_x = p_filter->p_sys->p_menu->p_state->i_x;
+        i_y = p_filter->p_sys->p_menu->p_state->i_y;
     }
+    p_region->i_x = i_x;
+    p_region->i_y = i_y;
 
     if( p_filter->p_sys->p_menu->i_style == OSD_MENU_STYLE_CONCAT )
     {
@@ -582,8 +587,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
             }
             else
             {
-                p_new->i_x = p_region_tail->fmt.i_visible_width;
-                p_new->i_y = p_button->i_y;
+                p_new->i_x = i_x+p_region_tail->fmt.i_visible_width;
+                p_new->i_y = i_y+p_button->i_y;
                 p_region_tail->p_next = p_new;
                 p_region_tail = p_new;
             }
index 1bd84ca14e36a999ffe528bbedcdfbfc6a86653f..04ef5d2fe3ff93322e9aa7cb8914e6eb7fbd8125 100644 (file)
@@ -1182,8 +1182,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     p_spu->b_absolute = false;
 
 
-    p_spu->i_x = 0;
-    p_spu->i_y = 0;
     p_spu->i_original_picture_width = 0; /*Let vout core do the horizontal scaling */
     p_spu->i_original_picture_height = fmt.i_height;
 
index f4d9e215890068e580ea31174e52576a2abe6ccd..29a42debce6b731bb5beada81942083b31671a1b 100644 (file)
@@ -530,9 +530,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         p_spu->b_absolute = false;
     }
 
-    p_spu->i_x = p_sys->i_xoff;
-    p_spu->i_y = p_sys->i_yoff;
-
     p_spu->p_region->p_style = p_sys->p_style;
 
     if( p_feed->p_pic )
@@ -558,6 +555,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         }
         else
         {
+            p_region->i_x = p_sys->i_xoff;
+            p_region->i_y = p_sys->i_yoff;
             vout_CopyPicture( p_filter, &p_region->picture, p_pic );
             p_spu->p_region->p_next = p_region;
         }
index e0a6f7c55dd7061b83c561b9720d2fa6b12a48eb..cf6f0268c96e3708e587f21aa5c98da3960556aa 100644 (file)
@@ -127,44 +127,10 @@ int mediacontrol_showtext( vout_thread_t *p_vout, int i_channel,
                            int i_flags, int i_hmargin, int i_vmargin,
                            mtime_t i_start, mtime_t i_stop )
 {
-    subpicture_t *p_spu;
-    video_format_t fmt;
-
-    if( !psz_string ) return VLC_EGENERIC;
-
-    p_spu = spu_CreateSubpicture( p_vout->p_spu );
-    if( !p_spu ) return VLC_EGENERIC;
-
-    /* Create a new subpicture region */
-    memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
-    fmt.i_aspect = 0;
-    fmt.i_width = fmt.i_height = 0;
-    fmt.i_x_offset = fmt.i_y_offset = 0;
-    p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_vout), &fmt );
-    if( !p_spu->p_region )
-    {
-        msg_Err( p_vout, "cannot allocate SPU region" );
-        spu_DestroySubpicture( p_vout->p_spu, p_spu );
-        return VLC_EGENERIC;
-    }
-
-    p_spu->p_region->psz_text = strdup( psz_string );
-    p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK;
-    p_spu->p_region->p_style = p_style;
-    p_spu->i_start = i_start;
-    p_spu->i_stop = i_stop;
-    p_spu->b_ephemer = false;
-    p_spu->b_absolute = false;
-
-    p_spu->i_x = i_hmargin;
-    p_spu->i_y = i_vmargin;
-    p_spu->i_flags = i_flags & ~SUBPICTURE_ALIGN_MASK;
-    p_spu->i_channel = i_channel;
-
-    spu_DisplaySubpicture( p_vout->p_spu, p_spu );
-
-    return VLC_SUCCESS;
+    return osd_ShowTextAbsolute( p_vout->p_spu, i_channel,
+                                 psz_string, p_style,
+                                 i_flags, i_hmargin, i_vmargin,
+                                 i_start, i_stop );
 }
 
 
index fc878fc37b6e4bc40e323041be8568174c58154b..ea2c969ac4d6919b7fffd127fb694d922b227bb5 100644 (file)
@@ -79,7 +79,14 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
     if( !psz_string ) return VLC_EGENERIC;
 
     p_spu = spu_CreateSubpicture( p_spu_channel );
-    if( !p_spu ) return VLC_EGENERIC;
+    if( !p_spu )
+        return VLC_EGENERIC;
+
+    p_spu->i_channel = i_channel;
+    p_spu->i_start = i_start;
+    p_spu->i_stop = i_stop;
+    p_spu->b_ephemer = true;
+    p_spu->b_absolute = false;
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
@@ -97,15 +104,8 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
 
     p_spu->p_region->psz_text = strdup( psz_string );
     p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK;
-    p_spu->i_start = i_start;
-    p_spu->i_stop = i_stop;
-    p_spu->b_ephemer = true;
-    p_spu->b_absolute = false;
-
-    p_spu->i_x = i_hmargin;
-    p_spu->i_y = i_vmargin;
-    p_spu->i_flags = i_flags & ~SUBPICTURE_ALIGN_MASK;
-    p_spu->i_channel = i_channel;
+    p_spu->p_region->i_x = i_hmargin;
+    p_spu->p_region->i_y = i_vmargin;
 
     spu_DisplaySubpicture( p_spu_channel, p_spu );
 
index 2083438707dbf764e05636ab00100de85b163da2..a0499bb0e66cf1eb692d3851e9e73c5d757ea965 100644 (file)
@@ -81,7 +81,16 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
     if( !psz_string ) return VLC_EGENERIC;
 
     p_spu = spu_CreateSubpicture( p_vout->p_spu );
-    if( !p_spu ) return VLC_EGENERIC;
+    if( !p_spu )
+        return VLC_EGENERIC;
+
+    p_spu->i_channel = i_channel;
+    p_spu->i_start = i_start;
+    p_spu->i_stop = i_stop;
+    p_spu->b_ephemer = true;
+    p_spu->b_absolute = false;
+    p_spu->b_fade = true;
+
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
@@ -99,16 +108,8 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
 
     p_spu->p_region->psz_text = strdup( psz_string );
     p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK;
-    p_spu->i_start = i_start;
-    p_spu->i_stop = i_stop;
-    p_spu->b_ephemer = true;
-    p_spu->b_absolute = false;
-    p_spu->b_fade = true;
-
-    p_spu->i_x = i_hmargin;
-    p_spu->i_y = i_vmargin;
-    p_spu->i_flags = i_flags & ~SUBPICTURE_ALIGN_MASK;
-    p_spu->i_channel = i_channel;
+    p_spu->p_region->i_x = i_hmargin;
+    p_spu->p_region->i_y = i_vmargin;
 
     spu_DisplaySubpicture( p_vout->p_spu, p_spu );
 
index 5d102c21ad955d7e90a6431eb7e0c6e5b9782d6b..2894b276e5ae59cdd8d8bdddba4b46f60c99422c 100644 (file)
@@ -660,20 +660,10 @@ static void SpuRegionPlace( int *pi_x, int *pi_y,
                             const video_format_t *p_fmt,
                             const subpicture_t *p_subpic,
                             const subpicture_region_t *p_region,
-                            int i_subpic_x,
-                            int i_inv_scale_x, int i_inv_scale_y,
-                            int i_scale_width, int i_scale_height )
+                            int i_inv_scale_x, int i_inv_scale_y )
 {
-    /* FIXME i_delta_x/y and i_x/y in absolute mode does not use the same
-     * it seems weird unless I missed something
-     * At this point we have:
-     *   i_subpic_x == p_subpic->i_x * i_scale_width / SCALE_UNIT
-     *   p_region->i_x/i_y have already been scaled by i_scale_width/i_scale_height.
-     * */
-    int i_delta_x = ( i_subpic_x + p_region->i_x ) *
-                                            i_inv_scale_x / SCALE_UNIT;
-    int i_delta_y = ( p_subpic->i_y + p_region->i_y ) *
-                                            i_inv_scale_y / SCALE_UNIT;
+    int i_delta_x = p_region->i_x * i_inv_scale_x / SCALE_UNIT;
+    int i_delta_y = p_region->i_y * i_inv_scale_y / SCALE_UNIT;
     int i_x, i_y;
 
     if( p_region->i_align & SUBPICTURE_ALIGN_TOP )
@@ -704,10 +694,8 @@ static void SpuRegionPlace( int *pi_x, int *pi_y,
 
     if( p_subpic->b_absolute )
     {
-        i_x = (p_region->i_x + i_subpic_x * i_scale_width / SCALE_UNIT) *
-                i_inv_scale_x / SCALE_UNIT;
-        i_y = (p_region->i_y + p_subpic->i_y * i_scale_height / SCALE_UNIT) *
-                i_inv_scale_y / SCALE_UNIT;
+        i_x = i_delta_x;
+        i_y = i_delta_y;
     }
 
     *pi_x = __MAX( i_x, 0 );
@@ -718,7 +706,6 @@ static void SpuRenderRegion( spu_t *p_spu,
                              picture_t *p_pic_dst,
                              subpicture_t *p_subpic, subpicture_region_t *p_region,
                              const int i_scale_width_orig, const int i_scale_height_orig,
-                             const int pi_subpic_x[SCALE_SIZE],
                              const int pi_scale_width[SCALE_SIZE],
                              const int pi_scale_height[SCALE_SIZE],
                              const video_format_t *p_fmt )
@@ -869,9 +856,8 @@ static void SpuRenderRegion( spu_t *p_spu,
 
     /* */
     SpuRegionPlace( &i_x_offset, &i_y_offset,
-                    p_fmt, p_subpic, p_region, pi_subpic_x[i_scale_idx],
-                    i_inv_scale_x, i_inv_scale_y,
-                    pi_scale_width[i_scale_idx], pi_scale_height[i_scale_idx] );
+                    p_fmt, p_subpic, p_region,
+                    i_inv_scale_x, i_inv_scale_y );
 
     if( p_spu->i_margin != 0 && !b_force_crop )
     {
@@ -1059,7 +1045,6 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
         subpicture_region_t *p_region;
         int pi_scale_width[ SCALE_SIZE ];
         int pi_scale_height[ SCALE_SIZE ];
-        int pi_subpic_x[ SCALE_SIZE ];
         int k;
 
         if( !p_subpic->p_region )
@@ -1171,19 +1156,15 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
         }
 
         /* Take care of the aspect ratio */
-        for( k = 0; k < SCALE_SIZE ; k++ )
-            pi_subpic_x[k] = p_subpic->i_x;
-
         if( ( p_region->fmt.i_sar_num * p_fmt->i_sar_den ) !=
             ( p_region->fmt.i_sar_den * p_fmt->i_sar_num ) )
         {
+            /* FIXME FIXME what about region->i_x/i_y ? */
             for( k = 0; k < SCALE_SIZE; k++ )
             {
                 pi_scale_width[k] = pi_scale_width[k] *
                     (int64_t)p_region->fmt.i_sar_num * p_fmt->i_sar_den /
                     p_region->fmt.i_sar_den / p_fmt->i_sar_num;
-
-                pi_subpic_x[k] = p_subpic->i_x * pi_scale_width[ k ] / SCALE_UNIT;
             }
         }
 
@@ -1191,7 +1172,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
         for( ; p_region != NULL; p_region = p_region->p_next )
             SpuRenderRegion( p_spu, p_pic_dst,
                              p_subpic, p_region, i_scale_width_orig, i_scale_height_orig,
-                             pi_subpic_x, pi_scale_width, pi_scale_height,
+                             pi_scale_width, pi_scale_height,
                              p_fmt );
     }