Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1a3cf7e6 by Steve Lhomme at 2024-06-04T13:44:24+00:00
subpicture: initialize i_stop to VLC_TICK_INVALID rather than 0

To match the documentation.

- - - - -
b39d8e71 by Steve Lhomme at 2024-06-04T13:44:24+00:00
Revert "check the length is not VLC_TICK_INVALID explicitly"

This reverts commit 9143eafc854512d8a19e3fa789fb94726ad8689c,
commit 382ede8976bcb91e445a2debfa86d3f7f7034482,
commit c76ae3ab5b52ef6acd68c71d2f1d82ae0d6e9cdb,
commit 70d55311e4ebb005b94d234ed525be5cd6f0829e.

We want to check the length of 0 and not an invalid value.

- - - - -
b93fe566 by Steve Lhomme at 2024-06-04T13:44:24+00:00
demux/subtitles: set i_stop to VLC_TICK_INVALID when it's not known

This is the expected value in that case.

- - - - -
aaa29ba6 by Steve Lhomme at 2024-06-04T13:44:24+00:00
encttml: check i_stop is valid before using it

- - - - -
b0b6a5c0 by Steve Lhomme at 2024-06-04T13:44:24+00:00
encvtt: check i_stop is valid before using it

- - - - -
9b54fd0b by Steve Lhomme at 2024-06-04T13:44:24+00:00
dvbsub: don't compare i_stop if it's invalid

Considering VLC_TICK_INVALID is 0, when it's VLC_TICK_INVALID
the test should not pass.

- - - - -
c7035fab by Steve Lhomme at 2024-06-04T13:44:24+00:00
t140: don't compare i_stop if it's invalid

Considering VLC_TICK_INVALID is 0, when it's VLC_TICK_INVALID
the test should not pass.

- - - - -
99a1646c by Steve Lhomme at 2024-06-04T13:44:24+00:00
vout_subpictures: don't compare i_stop if it's invalid

According to the ephemer documentation:
/**< If this flag is set to true the subtitle
 will be displayed until the next one appears
 or if i_stop is reached when it is valid */

So i_stop should only be considered when it's valid.

- - - - -
69cb754b by Steve Lhomme at 2024-06-04T13:44:24+00:00
vout_subpictures: don't use i_stop if it's invalid to check for late 
entries

Considering VLC_TICK_INVALID is 0, the should behave the same as before.

- - - - -
a55cf7c2 by Steve Lhomme at 2024-06-04T13:44:24+00:00
spudec: don't compare i_stop if it's invalid

Considering VLC_TICK_INVALID is 0, when it's VLC_TICK_INVALID
the test should pass.

- - - - -
694497fa by Steve Lhomme at 2024-06-04T13:44:24+00:00
vlc_subpictures: move b_subtitle outside of the part the vout thread may modify

Only the SPU source should set this flag.

- - - - -


20 changed files:

- include/vlc_subpicture.h
- modules/codec/arib/aribsub.c
- modules/codec/dvbsub.c
- modules/codec/spudec/parse.c
- modules/codec/stl.c
- modules/codec/subsdec.c
- modules/codec/substx3g.c
- modules/codec/subsusf.c
- modules/codec/t140.c
- modules/codec/ttml/encttml.c
- modules/codec/webvtt/encvtt.c
- modules/codec/zvbi.c
- modules/demux/subtitle.c
- modules/spu/audiobargraph_v.c
- modules/spu/dynamicoverlay/dynamicoverlay.c
- modules/spu/logo.c
- modules/spu/marq.c
- modules/spu/mosaic.c
- modules/spu/rss.c
- src/video_output/vout_subpictures.c


Changes:

=====================================
include/vlc_subpicture.h
=====================================
@@ -255,6 +255,8 @@ struct subpicture_t
                                    will be displayed until the next one appears
                                    or if i_stop is reached when it is valid */
     bool            b_fade;                               /**< enable fading */
+    bool            b_subtitle;      /**< subtitle with timestamps relative to
+                                                                  the video */
     /**@}*/
 
     /** \name Display properties
@@ -262,7 +264,6 @@ struct subpicture_t
      * changed by the video output thread, or simply ignored depending of the
      * subtitle type. */
     /**@{*/
-    bool         b_subtitle;            /**< the picture is a movie subtitle */
     unsigned     i_original_picture_width;  /**< original width of the movie */
     unsigned     i_original_picture_height;/**< original height of the movie */
     int          i_alpha;                                  /**< transparency */


=====================================
modules/codec/arib/aribsub.c
=====================================
@@ -263,7 +263,7 @@ static subpicture_t *render( decoder_t *p_dec, 
arib_parser_t *p_parser,
 
     vlc_tick_t i_duration = VLC_TICK_FROM_US(arib_decoder_get_time( 
p_arib_decoder ));
     p_spu->i_start = p_block->i_pts;
-    p_spu->i_stop = i_duration ? p_block->i_pts + i_duration : 0;
+    p_spu->i_stop = i_duration ? p_block->i_pts + i_duration : 
VLC_TICK_INVALID;
     p_spu->b_ephemer  = i_duration == 0;
 
     arib_spu_updater_sys_t *p_spu_sys = p_spu->updater.sys;


=====================================
modules/codec/dvbsub.c
=====================================
@@ -2011,7 +2011,8 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t 
*p_subpic )
     bs_write( s, 8, 0xff );/* End marker */
     p_block->i_buffer = bs_pos( s ) / 8;
     p_block->i_pts = p_block->i_dts = p_subpic->i_start;
-    if( !p_subpic->b_ephemer && ( p_subpic->i_stop > p_subpic->i_start ) )
+    if( !p_subpic->b_ephemer &&
+        ( p_subpic->i_stop != VLC_TICK_INVALID && p_subpic->i_stop > 
p_subpic->i_start ) )
     {
         block_t *p_block_stop;
 
@@ -2108,7 +2109,7 @@ static void encode_page_composition( encoder_t *p_enc, 
bs_t *s,
 
     i_timeout = 0;
     if( p_subpic && !p_subpic->b_ephemer &&
-        ( p_subpic->i_stop > p_subpic->i_start ) )
+        ( p_subpic->i_stop != VLC_TICK_INVALID && p_subpic->i_stop > 
p_subpic->i_start ) )
     {
         i_timeout = SEC_FROM_VLC_TICK(p_subpic->i_stop - p_subpic->i_start);
     }
@@ -2650,4 +2651,3 @@ static void default_dds_init( decoder_t * p_dec )
     p_sys->display.i_height_minus1 = 576-1;
     p_sys->display.b_windowed = false;
 }
-


=====================================
modules/codec/spudec/parse.c
=====================================
@@ -210,7 +210,8 @@ static void OutputPicture( decoder_t *p_dec,
     p_spu->b_ephemer = p_spu_properties->b_ephemer;
     p_spu->b_subtitle = p_spu_properties->b_subtitle;
 
-    if( p_spu->i_stop <= p_spu->i_start && !p_spu->b_ephemer )
+    if( (p_spu->i_stop == VLC_TICK_INVALID || p_spu->i_stop <= p_spu->i_start) 
&&
+        !p_spu->b_ephemer )
     {
         /* This subtitle will live for 5 seconds or until the next subtitle */
         p_spu->i_stop = p_spu->i_start + VLC_TICK_FROM_MS(500 * 11);


=====================================
modules/codec/stl.c
=====================================
@@ -419,7 +419,7 @@ static int Decode(decoder_t *p_dec, block_t *p_block)
                 {
                     p_sub->i_start    = p_block->i_pts;
                     p_sub->i_stop     = p_block->i_pts + p_block->i_length;
-                    p_sub->b_ephemer  = (p_block->i_length == 
VLC_TICK_INVALID);
+                    p_sub->b_ephemer  = (p_block->i_length == 0);
                 }
                 decoder_QueueSub(p_dec, p_sub);
             }


=====================================
modules/codec/subsdec.c
=====================================
@@ -454,7 +454,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t 
*p_block )
     }
     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 == VLC_TICK_INVALID);
+    p_spu->b_ephemer  = (p_block->i_length == 0);
 
     subtext_updater_sys_t *p_spu_sys = p_spu->updater.sys;
 


=====================================
modules/codec/substx3g.c
=====================================
@@ -413,7 +413,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
 
     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 == VLC_TICK_INVALID);
+    p_spu->b_ephemer  = (p_block->i_length == 0);
 
     p_spu_sys->region.b_absolute = false;
     p_spu_sys->region.align = SUBPICTURE_ALIGN_BOTTOM;


=====================================
modules/codec/subsusf.c
=====================================
@@ -262,7 +262,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t 
*p_block )
 
     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 == VLC_TICK_INVALID);
+    p_spu->b_ephemer = (p_block->i_length == 0);
     if (p_sys->i_original_width > 0 && p_sys->i_original_height > 0)
     {
         p_spu->i_original_picture_width = p_sys->i_original_width;


=====================================
modules/codec/t140.c
=====================================
@@ -117,7 +117,8 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t 
*p_spu )
     p_block->p_buffer[p_block->i_buffer] = 0;
 
     p_block->i_pts = p_block->i_dts = p_spu->i_start;
-    if( !p_spu->b_ephemer && ( p_spu->i_stop > p_spu->i_start ) )
+    if( !p_spu->b_ephemer &&
+        ( p_spu->i_stop != VLC_TICK_INVALID && p_spu->i_stop > p_spu->i_start 
) )
         p_block->i_length = p_spu->i_stop - p_spu->i_start;
 
     return p_block;


=====================================
modules/codec/ttml/encttml.c
=====================================
@@ -202,7 +202,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t 
*p_spu )
             if( p_block )
             {
                 p_block->i_dts = p_block->i_pts = VLC_TICK_0 + p_spu->i_start;
-                if( p_spu->i_stop > p_spu->i_start )
+                if( p_spu->i_stop != VLC_TICK_INVALID && p_spu->i_stop > 
p_spu->i_start )
                     p_block->i_length = p_spu->i_stop - p_spu->i_start;
             }
         }


=====================================
modules/codec/webvtt/encvtt.c
=====================================
@@ -237,7 +237,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t 
*p_spu )
     if( p_block )
     {
         p_block->i_pts = p_block->i_dts = p_spu->i_start;
-        if( p_spu->i_stop > p_spu->i_start )
+        if( p_spu->i_stop != VLC_TICK_INVALID && p_spu->i_stop > 
p_spu->i_start )
             p_block->i_length = p_spu->i_stop - p_spu->i_start;
     }
 


=====================================
modules/codec/zvbi.c
=====================================
@@ -582,7 +582,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec,
     }
     else
     {
-        p_spu->i_stop = 0;
+        p_spu->i_stop = VLC_TICK_INVALID;
         p_region->b_absolute = true;
         p_region->i_align = i_align;
         // bottom center based on "vbi-position"


=====================================
modules/demux/subtitle.c
=====================================
@@ -872,7 +872,7 @@ static int Demux( demux_t *p_demux )
             {
                 p_block->i_dts =
                 p_block->i_pts = VLC_TICK_0 + p_subtitle->i_start * 
p_sys->f_rate;
-                if( p_subtitle->i_stop >= 0 && p_subtitle->i_stop >= 
p_subtitle->i_start )
+                if( p_subtitle->i_stop != VLC_TICK_INVALID && 
p_subtitle->i_stop >= p_subtitle->i_start )
                     p_block->i_length = (p_subtitle->i_stop - 
p_subtitle->i_start) * p_sys->f_rate;
 
                 es_out_Send( p_demux->out, p_sys->es, p_block );
@@ -1032,7 +1032,7 @@ static int ParseMicroDvd( vlc_object_t *p_obj, 
subs_properties_t *p_props,
 
     /* */
     p_subtitle->i_start  =  VLC_TICK_0 + i_start * p_props->i_microsecperframe;
-    p_subtitle->i_stop   = i_stop >= 0 ? (VLC_TICK_0 + i_stop  * 
p_props->i_microsecperframe) : -1;
+    p_subtitle->i_stop   = i_stop >= 0 ? (VLC_TICK_0 + i_stop  * 
p_props->i_microsecperframe) : VLC_TICK_INVALID;
     p_subtitle->psz_text = psz_text;
     return VLC_SUCCESS;
 }
@@ -1578,7 +1578,7 @@ static int ParseMPL2(vlc_object_t *p_obj, 
subs_properties_t *p_props,
             sscanf( s, "[%d][%d] %[^\r\n]", &i_start, &i_stop, psz_text ) == 3)
         {
             p_subtitle->i_start = VLC_TICK_0 + VLC_TICK_FROM_MS(i_start * 100);
-            p_subtitle->i_stop  = i_stop >= 0 ? VLC_TICK_0 + 
VLC_TICK_FROM_MS(i_stop  * 100) : -1;
+            p_subtitle->i_stop  = i_stop >= 0 ? VLC_TICK_0 + 
VLC_TICK_FROM_MS(i_stop  * 100) : VLC_TICK_INVALID;
             break;
         }
         free( psz_text );


=====================================
modules/spu/audiobargraph_v.c
=====================================
@@ -363,7 +363,7 @@ static subpicture_t *FilterSub(filter_t *p_filter, 
vlc_tick_t date)
         goto exit;
 
     p_spu->i_start = date;
-    p_spu->i_stop = 0;
+    p_spu->i_stop = VLC_TICK_INVALID;
     p_spu->b_ephemer = true;
 
     /* Send an empty subpicture to clear the display when needed */


=====================================
modules/spu/dynamicoverlay/dynamicoverlay.c
=====================================
@@ -347,7 +347,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t 
date )
         return NULL;
 
     p_spu->i_start = date;
-    p_spu->i_stop = 0;
+    p_spu->i_stop = VLC_TICK_INVALID;
     p_spu->b_ephemer = true;
 
     vlc_vector_foreach(p_overlay, &p_sys->overlays)


=====================================
modules/spu/logo.c
=====================================
@@ -346,7 +346,7 @@ static subpicture_t *FilterSub( filter_t *p_filter, 
vlc_tick_t date )
         goto exit;
 
     p_spu->i_start = date;
-    p_spu->i_stop = 0;
+    p_spu->i_stop = VLC_TICK_INVALID;
     p_spu->b_ephemer = true;
 
     /* Send an empty subpicture to clear the display when needed */


=====================================
modules/spu/marq.c
=====================================
@@ -298,7 +298,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t 
date )
 
     p_region->p_text = text_segment_New( msg );
     p_spu->i_start = date;
-    p_spu->i_stop  = p_sys->i_timeout == 0 ? 0 : date + p_sys->i_timeout;
+    p_spu->i_stop  = p_sys->i_timeout == 0 ? VLC_TICK_INVALID : date + 
p_sys->i_timeout;
     p_spu->b_ephemer = true;
 
     /*  where to locate the string: */


=====================================
modules/spu/mosaic.c
=====================================
@@ -458,7 +458,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t 
date )
     /* Initialize subpicture */
     p_spu->i_channel = 0;
     p_spu->i_start  = date;
-    p_spu->i_stop = 0;
+    p_spu->i_stop = VLC_TICK_INVALID;
     p_spu->b_ephemer = true;
     p_spu->i_alpha = p_sys->i_alpha;
 


=====================================
modules/spu/rss.c
=====================================
@@ -477,7 +477,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t 
date )
     if( p_sys->p_style->i_font_size > 0 )
         region->fmt.i_visible_height = p_sys->p_style->i_font_size;
     p_spu->i_start = date;
-    p_spu->i_stop  = 0;
+    p_spu->i_stop  = VLC_TICK_INVALID;
     p_spu->b_ephemer = true;
 
     /*  where to locate the string: */


=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -875,8 +875,10 @@ spu_SelectSubpictures(spu_t *spu, vlc_tick_t system_now,
 
             /* If the spu is ephemer, the stop time is invalid, but it has 
been converted to
                system time and used in comparisons below */
-            const bool is_stop_valid = !current->b_ephemer || 
render_entry->orgstop > render_entry->orgstart;
-            render_entry->is_late = is_stop_valid && current->i_stop <= 
render_date;
+            const bool is_stop_valid = !current->b_ephemer ||
+                (render_entry->orgstop != VLC_TICK_INVALID && 
render_entry->orgstop > render_entry->orgstart);
+            render_entry->is_late = is_stop_valid &&
+                (current->i_stop == VLC_TICK_INVALID || current->i_stop <= 
render_date);
 
             /* start_date will be used for correct automatic overlap support
              * in case picture that should not be displayed anymore 
(display_time)
@@ -2149,7 +2151,7 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
 
     /* An ephemer with stop time can be ephemer,
        but a pic without stop time must be ephemer */
-    if(subpic->i_stop < subpic->i_start)
+    if(subpic->i_stop != VLC_TICK_INVALID && subpic->i_stop < subpic->i_start)
         subpic->b_ephemer = true;
 
     if (spu_channel_Push(channel, subpic, orgstart, orgstop))



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/2e462c506231d1e8e449f1d75dc615d79215f6b2...694497fa0e8f38bf8c0cd1b36385891a82f2d80e

-- 
This project does not include diff previews in email notifications.
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/2e462c506231d1e8e449f1d75dc615d79215f6b2...694497fa0e8f38bf8c0cd1b36385891a82f2d80e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to