[vlc-devel] commit: Fixed the order of destruction of ephemere subpictures having the same date . (Laurent Aimar )

git version control git at videolan.org
Tue Jul 28 21:44:20 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Jul 28 20:16:26 2009 +0200| [9c462ffb5d9ada2fb8058e5a93148325bb0665b6] | committer: Laurent Aimar 

Fixed the order of destruction of ephemere subpictures having the same date.

 Without this patch, all epehemere subpicture with the same start
date are blended over the picture.

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

 src/video_output/vout_subpictures.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index d844ef1..4f8512d 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -585,6 +585,8 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t render_date,
         mtime_t      start_date = render_date;
         mtime_t      ephemer_subtitle_date = 0;
         mtime_t      ephemer_system_date = 0;
+        int64_t      i_ephemer_subtitle_order = INT64_MIN;
+        int64_t      i_ephemer_system_order = INT64_MIN;
         int i_index;
 
         /* Select available pictures */
@@ -614,9 +616,14 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t render_date,
                 continue;
             }
 
-            mtime_t *pi_ephemer_date = p_current->b_subtitle ? &ephemer_subtitle_date : &ephemer_system_date;
-            if( p_current->i_start > *pi_ephemer_date )
+            mtime_t *pi_ephemer_date  = p_current->b_subtitle ? &ephemer_subtitle_date : &ephemer_system_date;
+            int64_t *pi_ephemer_order = p_current->b_subtitle ? &i_ephemer_subtitle_order : &i_ephemer_system_order;
+            if( p_current->i_start >= *pi_ephemer_date )
+            {
                 *pi_ephemer_date = p_current->i_start;
+                if( p_current->i_order > *pi_ephemer_order )
+                    *pi_ephemer_order = p_current->i_order;
+            }
 
             b_stop_valid = !p_current->b_ephemer || p_current->i_stop > p_current->i_start;
 
@@ -648,17 +655,23 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t render_date,
 
             const mtime_t stop_date = p_current->b_subtitle ? __MAX( start_date, p_sys->i_last_sort_date ) : system_date;
             const mtime_t ephemer_date = p_current->b_subtitle ? ephemer_subtitle_date : ephemer_system_date;
+            const int64_t i_ephemer_order = p_current->b_subtitle ? i_ephemer_subtitle_order : i_ephemer_system_order;
 
-            if( ( b_late && p_current->i_stop <= stop_date ) ||
-                ( p_current->b_ephemer && p_current->i_start < ephemer_date ) )
+            /* Destroy late and obsolete ephemer subpictures */
+            bool b_rejet = b_late && p_current->i_stop <= stop_date;
+            if( p_current->b_ephemer )
             {
-                /* Destroy late and obsolete ephemer subpictures */
-                SpuHeapDeleteSubpicture( &p_sys->heap, p_current );
+                if( p_current->i_start < ephemer_date )
+                    b_rejet = true;
+                else if( p_current->i_start == ephemer_date &&
+                         p_current->i_order < i_ephemer_order )
+                    b_rejet = true;
             }
+
+            if( b_rejet )
+                SpuHeapDeleteSubpicture( &p_sys->heap, p_current );
             else
-            {
                 SubpictureChain( &p_subpic, p_current );
-            }
         }
     }
 




More information about the vlc-devel mailing list