[vlc-commits] vout: rework spu_Render()

Thomas Guillem git at videolan.org
Mon Mar 11 10:19:01 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Mar  6 18:18:39 2019 +0100| [81eaadbadd0529d7de1937d77b6fda8a409140e5] | committer: Thomas Guillem

vout: rework spu_Render()

Add rate (unused for now) and specify that render_osd_date is actually
vlc_tick_now().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=81eaadbadd0529d7de1937d77b6fda8a409140e5
---

 include/vlc_spu.h                    |  2 +-
 modules/stream_out/transcode/video.c |  4 ++--
 src/video_output/video_output.c      |  8 ++++----
 src/video_output/vout_subpictures.c  | 25 +++++++++++++------------
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/include/vlc_spu.h b/include/vlc_spu.h
index fef3d78799..3f5ef1ca48 100644
--- a/include/vlc_spu.h
+++ b/include/vlc_spu.h
@@ -74,7 +74,7 @@ VLC_API void spu_PutSubpicture( spu_t *, subpicture_t * );
  */
 VLC_API subpicture_t * spu_Render( spu_t *, const vlc_fourcc_t *p_chroma_list,
                                    const video_format_t *p_fmt_dst, const video_format_t *p_fmt_src,
-                                   vlc_tick_t render_subtitle_date, vlc_tick_t render_osd_date,
+                                   vlc_tick_t system_now, vlc_tick_t pts, float rate,
                                    bool ignore_osd, bool external_scale );
 
 /**
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 1a81722027..24556e1b2d 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -384,8 +384,8 @@ static picture_t * RenderSubpictures( sout_stream_t *p_stream, sout_stream_id_sy
     }
 
     subpicture_t *p_subpic = spu_Render( id->p_spu, NULL, &fmt,
-                                         &outfmt,
-                                         p_pic->date, p_pic->date, false, false );
+                                         &outfmt, vlc_tick_now(), p_pic->date, 1.f,
+                                         false, false );
 
     /* Overlay subpicture */
     if( p_subpic )
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index fa708955aa..7aac04be46 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -963,7 +963,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
         render_subtitle_date = sys->pause.date;
     else
         render_subtitle_date = filtered->date > 1 ? filtered->date : vlc_tick_now();
-    vlc_tick_t render_osd_date = vlc_tick_now(); /* FIXME wrong */
+    vlc_tick_t system_now = vlc_tick_now();
 
     /*
      * Get the subpicture to be displayed
@@ -1024,9 +1024,9 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
     video_format_ApplyRotation(&fmt_spu_rot, &fmt_spu);
     subpicture_t *subpic = spu_Render(sys->spu,
                                       subpicture_chromas, &fmt_spu_rot,
-                                      &vd->source,
-                                      render_subtitle_date, render_osd_date,
-                                      do_snapshot,
+                                      &vd->source, system_now,
+                                      render_subtitle_date,
+                                      1.f, do_snapshot,
                                       vd->info.can_scale_spu);
     /*
      * Perform rendering
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 7494423a3a..6d77d94f27 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -531,8 +531,8 @@ static int SubpictureCmp(const void *s0, const void *s1)
 static void SpuSelectSubpictures(spu_t *spu,
                                  size_t *subpicture_count,
                                  subpicture_t **subpicture_array,
+                                 vlc_tick_t system_now,
                                  vlc_tick_t render_subtitle_date,
-                                 vlc_tick_t render_osd_date,
                                  bool ignore_osd)
 {
     spu_private_t *sys = spu->p;
@@ -591,7 +591,7 @@ static void SpuSelectSubpictures(spu_t *spu,
                (ignore_osd && !current->b_subtitle))
                 continue;
 
-            const vlc_tick_t render_date = current->b_subtitle ? render_subtitle_date : render_osd_date;
+            const vlc_tick_t render_date = current->b_subtitle ? render_subtitle_date : system_now;
             if (render_date &&
                 render_date < current->i_start) {
                 /* Too early, come back next monday */
@@ -633,7 +633,7 @@ static void SpuSelectSubpictures(spu_t *spu,
             subpicture_t *current = available_subpic[index];
             bool is_late = is_available_late[index];
 
-            const vlc_tick_t stop_date = current->b_subtitle ? __MAX(start_date, sys->last_sort_date) : render_osd_date;
+            const vlc_tick_t stop_date = current->b_subtitle ? __MAX(start_date, sys->last_sort_date) : system_now;
             const vlc_tick_t ephemer_date  = current->b_subtitle ? ephemer_subtitle_date  : ephemer_osd_date;
             const int64_t ephemer_order = current->b_subtitle ? ephemer_subtitle_order : ephemer_system_order;
 
@@ -1008,8 +1008,8 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
                                           const vlc_fourcc_t *chroma_list,
                                           const video_format_t *fmt_dst,
                                           const video_format_t *fmt_src,
+                                          vlc_tick_t system_now,
                                           vlc_tick_t render_subtitle_date,
-                                          vlc_tick_t render_osd_date,
                                           bool external_scale)
 {
     spu_private_t *sys = spu->p;
@@ -1122,7 +1122,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
                             subpic, region, virtual_scale,
                             chroma_list, fmt_dst,
                             subtitle_area, subtitle_area_count,
-                            subpic->b_subtitle ? render_subtitle_date : render_osd_date);
+                            subpic->b_subtitle ? render_subtitle_date : system_now);
             if (*output_last_ptr)
             {
                 if (do_external_scale)
@@ -1527,8 +1527,8 @@ subpicture_t *spu_Render(spu_t *spu,
                          const vlc_fourcc_t *chroma_list,
                          const video_format_t *fmt_dst,
                          const video_format_t *fmt_src,
-                         vlc_tick_t render_subtitle_date,
-                         vlc_tick_t render_osd_date,
+                         vlc_tick_t system_now,
+                         vlc_tick_t render_subtitle_date, float rate,
                          bool ignore_osd,
                          bool external_scale)
 {
@@ -1558,7 +1558,7 @@ subpicture_t *spu_Render(spu_t *spu,
         free(chain_update);
     }
     /* Run subpicture sources */
-    filter_chain_SubSource(sys->source_chain, spu, render_osd_date);
+    filter_chain_SubSource(sys->source_chain, spu, system_now);
     vlc_mutex_unlock(&sys->source_chain_lock);
 
     static const vlc_fourcc_t chroma_list_default_yuv[] = {
@@ -1588,8 +1588,8 @@ subpicture_t *spu_Render(spu_t *spu,
     subpicture_t *subpicture_array[VOUT_MAX_SUBPICTURES];
 
     /* Get an array of subpictures to render */
-    SpuSelectSubpictures(spu, &subpicture_count, subpicture_array,
-                         render_subtitle_date, render_osd_date, ignore_osd);
+    SpuSelectSubpictures(spu, &subpicture_count, subpicture_array, system_now,
+                         render_subtitle_date, ignore_osd);
     if (subpicture_count == 0) {
         vlc_mutex_unlock(&sys->lock);
         return NULL;
@@ -1600,7 +1600,7 @@ subpicture_t *spu_Render(spu_t *spu,
         subpicture_t *subpic = subpicture_array[i];
         subpicture_Update(subpic,
                           fmt_src, fmt_dst,
-                          subpic->b_subtitle ? render_subtitle_date : render_osd_date);
+                          subpic->b_subtitle ? render_subtitle_date : system_now);
     }
 
     /* Now order the subpicture array
@@ -1613,12 +1613,13 @@ subpicture_t *spu_Render(spu_t *spu,
                                                 chroma_list,
                                                 fmt_dst,
                                                 fmt_src,
+                                                system_now,
                                                 render_subtitle_date,
-                                                render_osd_date,
                                                 external_scale);
     vlc_mutex_unlock(&sys->lock);
 
     return render;
+    (void) rate;
 }
 
 void spu_OffsetSubtitleDate(spu_t *spu, vlc_tick_t duration)



More information about the vlc-commits mailing list