]> git.sesse.net Git - vlc/commitdiff
subpicture_t now has a b_pausable attribute. When set to VLC_TRUE (default value...
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 2 Sep 2006 17:03:36 +0000 (17:03 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 2 Sep 2006 17:03:36 +0000 (17:03 +0000)
12 files changed:
include/vlc_spu.h
include/vlc_symbols.h
include/vlc_video.h
modules/codec/cvdsub.c
modules/codec/fake.c
modules/codec/spudec/parse.c
modules/codec/subsdec.c
modules/codec/svcdsub.c
modules/stream_out/transcode.c
src/video_output/video_output.c
src/video_output/vout_intf.c
src/video_output/vout_subpictures.c

index 774af69e7207fca59102b9a042c732d1909e7175..4b6e9cbe5dd14ff0dc5cf5de061e2ff84051f5ef 100644 (file)
@@ -104,7 +104,7 @@ VLC_EXPORT( subpicture_region_t *,__spu_MakeRegion, ( vlc_object_t *, video_form
 #define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
 VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) );
 
-VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t ) );
+VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t, vlc_bool_t ) );
 VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *,  video_format_t *, picture_t *, picture_t *, subpicture_t *, int, int ) );
 
 /** @}*/
index a4c0669b15469a89272b143dad0ee1b730e29a72..3f5e8474eabfa11fdf8cf09ac7564aac4693debc 100644 (file)
@@ -323,7 +323,7 @@ struct module_symbols_t
     subpicture_region_t * (*__spu_CreateRegion_inner) (vlc_object_t *, video_format_t *);
     subpicture_region_t * (*__spu_MakeRegion_inner) (vlc_object_t *, video_format_t *, picture_t *);
     void (*__spu_DestroyRegion_inner) (vlc_object_t *, subpicture_region_t *);
-    subpicture_t * (*spu_SortSubpictures_inner) (spu_t *, mtime_t);
+    subpicture_t * (*spu_SortSubpictures_inner) (spu_t *, mtime_t, vlc_bool_t);
     void (*spu_RenderSubpictures_inner) (spu_t *,  video_format_t *, picture_t *, picture_t *, subpicture_t *, int, int);
     char * (*stream_ReadLine_inner) (stream_t *);
     stream_t * (*__stream_DemuxNew_inner) (vlc_object_t *p_obj, char *psz_demux, es_out_t *out);
index 35f7351fe376904d3c3ab10b95fee7297c4c9f13..f4b8947c9c5576a9034df60c231e35edfde36710 100644 (file)
@@ -246,6 +246,8 @@ struct subpicture_t
     vlc_bool_t      b_ephemer;    /**< If this flag is set to true the subtitle
                                 will be displayed untill the next one appear */
     vlc_bool_t      b_fade;                               /**< enable fading */
+    vlc_bool_t      b_pausable;               /**< subpicture will be paused if
+                                                            stream is paused */
     /**@}*/
 
     subpicture_region_t *p_region;  /**< region list composing this subtitle */
index 23f6e679cd404e810333647e18ebd3424017f878..6210af5ce21ebc4b54546a96c609013783aa5665 100644 (file)
@@ -496,6 +496,8 @@ 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;
index be899579a27d512083a86fed5f5c99e922c8cfc0..473936c691223c82343098ce9bd9398f6240a938 100644 (file)
@@ -285,6 +285,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     picture_t *p_image = (picture_t *)p_dec->p_sys;
     picture_t *p_pic;
 
+    printf("pouet\n");
+
     if( pp_block == NULL || !*pp_block ) return NULL;
     p_pic = p_dec->pf_vout_buffer_new( p_dec );
     if( p_pic == NULL )
index 6caebf6f0da305a36e0b8965627b74cd88807e71..38289c0cc516a7b67e5713db2c6706a893b8de21 100644 (file)
@@ -71,6 +71,8 @@ subpicture_t * E_(ParsePacket)( decoder_t *p_dec )
     p_spu = p_dec->pf_spu_buffer_new( p_dec );
     if( !p_spu ) return NULL;
 
+    p_spu->b_pausable = VLC_TRUE;
+
     /* Rationale for the "p_spudec->i_rle_size * 4": we are going to
      * expand the RLE stuff so that we won't need to read nibbles later
      * on. This will speed things up a lot. Plus, we'll only need to do
index 2d7a8b52f5723ea33a3b41fec14eea6832f0e080..ee5ef448082e4c8b516dc39ea05996c45822140c 100644 (file)
@@ -381,6 +381,8 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
         return NULL;
     }
 
+    p_spu->b_pausable = VLC_TRUE;
+
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
     fmt.i_chroma = VLC_FOURCC('T','E','X','T');
index 67d97e71b4facbbba3c845276d3fc79ca2613f30..b6135431d1fb2fb9bff8a3c24790c35571370ca4 100644 (file)
@@ -466,6 +466,8 @@ 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_y = p_sys->i_y_start;
     p_spu->i_start = p_data->i_pts;
index d16007c16b56b2278368c81fbf28bdea8a9ec104..89866cc3fe0c0b427f7189c50f7dbbc50f06aa0f 100644 (file)
@@ -2319,7 +2319,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
         /* Check if we have a subpicture to overlay */
         if( p_sys->p_spu )
         {
-            p_subpic = spu_SortSubpictures( p_sys->p_spu, p_pic->date );
+            p_subpic = spu_SortSubpictures( p_sys->p_spu, p_pic->date,
+                       VLC_FALSE /* Fixme: check if stream is paused */ );
             /* TODO: get another pic */
         }
 
@@ -2884,7 +2885,7 @@ static int transcode_osd_process( sout_stream_t *p_stream,
     /* Check if we have a subpicture to send */
     if( p_sys->p_spu && in->i_dts > 0)
     {
-        p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts );
+        p_subpic = spu_SortSubpictures( p_sys->p_spu, in->i_dts, VLC_FALSE );
     }
     else
     {
index 50978dabfebce97eb4eb39250609931151ba185e..886dd4b2ead9e496b769535745373856109f39a7 100644 (file)
@@ -780,6 +780,8 @@ static void RunThread( vout_thread_t *p_vout)
         display_date = 0;
         current_date = mdate();
 
+        p_input = NULL;
+
         i_loops++;
         if( i_loops % 20 == 0 )
         {
@@ -1042,7 +1044,11 @@ static void RunThread( vout_thread_t *p_vout)
          */
         if( display_date > 0 )
         {
-            p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date );
+            if( !p_input )
+                p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT,
+                                           FIND_PARENT );
+            p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date,
+            p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : VLC_FALSE );
         }
 
         /*
index f9c1407a4115e95e97e0f96c51927529641ff74c..d1041be97307560bbfd40a1d1d4998128aea1372 100644 (file)
@@ -445,7 +445,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
     picture_t *p_pif;
     vlc_value_t val, format;
     DIR *path;
-    
+
     int i_ret;
 
     var_Get( p_vout, "snapshot-path", &val );
index 5d1c19a755f5fb95fd338e5135cc5183ae3d6cd5..912a9f479752ac13d509dd745ad0e408a68aaf83 100644 (file)
@@ -401,6 +401,7 @@ subpicture_t *spu_CreateSubpicture( spu_t *p_spu )
     memset( p_subpic, 0, sizeof(subpicture_t) );
     p_subpic->i_status   = RESERVED_SUBPICTURE;
     p_subpic->b_absolute = VLC_TRUE;
+    p_subpic->b_pausable = VLC_FALSE;
     p_subpic->b_fade     = VLC_FALSE;
     p_subpic->i_alpha    = 0xFF;
     p_subpic->p_region   = 0;
@@ -412,7 +413,7 @@ subpicture_t *spu_CreateSubpicture( spu_t *p_spu )
     p_subpic->pf_create_region = __spu_CreateRegion;
     p_subpic->pf_make_region = __spu_MakeRegion;
     p_subpic->pf_destroy_region = __spu_DestroyRegion;
-    
+
     return p_subpic;
 }
 
@@ -823,7 +824,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
  * to be removed if a newer one is available), which makes it a lot
  * more difficult to guess if a subpicture has to be rendered or not.
  *****************************************************************************/
-subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date )
+subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date,
+                                   vlc_bool_t b_paused )
 {
     int i_index, i_channel;
     subpicture_t *p_subpic = NULL;
@@ -869,7 +871,9 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date )
             if( display_date > p_spu->p_subpicture[i_index].i_stop &&
                 ( !p_spu->p_subpicture[i_index].b_ephemer ||
                   p_spu->p_subpicture[i_index].i_stop >
-                  p_spu->p_subpicture[i_index].i_start ) )
+                  p_spu->p_subpicture[i_index].i_start ) &&
+                !( p_spu->p_subpicture[i_index].b_pausable &&
+                   b_paused ) )
             {
                 /* Too late, destroy the subpic */
                 spu_DestroySubpicture( p_spu, &p_spu->p_subpicture[i_index] );