[vlc-commits] demux: mp4: add support for forced tx3g spu (fix #16803)

Francois Cartegnie git at videolan.org
Tue Apr 12 12:49:58 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 12 12:48:51 2016 +0200| [691ddcdb6fbf4f459d0db56f64fbda46e0cb6440] | committer: Francois Cartegnie

demux: mp4: add support for forced tx3g spu (fix #16803)

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

 modules/demux/mp4/essetup.c |    3 +++
 modules/demux/mp4/mp4.c     |   14 ++++++++++++--
 modules/demux/mp4/mp4.h     |    1 +
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index a8f39e5..bd7e9ca 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -866,7 +866,10 @@ int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
             p_track->fmt.i_codec = VLC_CODEC_TX3G;
 
             if( p_text->i_display_flags & 0xC0000000 )
+            {
                 p_track->fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN + 1;
+                p_track->b_forced_spu = true;
+            }
 
             text_style_t *p_style = text_style_Create( STYLE_NO_DEFAULTS );
             if ( p_style )
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 504f799..582e9fd 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -198,6 +198,16 @@ static MP4_Box_t * MP4_GetTrakByTrackID( MP4_Box_t *p_moov, const uint32_t i_id
     return p_trak;
 }
 
+static es_out_id_t * MP4_AddTrackES( es_out_t *out, mp4_track_t *p_track )
+{
+    es_out_id_t *p_es = es_out_Add( out, &p_track->fmt );
+    /* Force SPU which isn't selected/defaulted */
+    if( p_track->fmt.i_cat == SPU_ES && p_es && p_track->b_forced_spu )
+        es_out_Control( out, ES_OUT_SET_ES_DEFAULT, p_es );
+
+    return p_es;
+}
+
 /* Return time in microsecond of a track */
 static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track )
 {
@@ -2339,7 +2349,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
     }
 
     if( pp_es )
-        *pp_es = es_out_Add( p_demux->out, &p_track->fmt );
+        *pp_es = MP4_AddTrackES( p_demux->out, p_track );
 
     return VLC_SUCCESS;
 }
@@ -2640,7 +2650,7 @@ static void MP4_TrackRestart( demux_t *p_demux, mp4_track_t *p_track,
 
             if( !p_track->b_chapters_source )
             {
-                p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt );
+                p_track->p_es = MP4_AddTrackES( p_demux->out, p_track );
                 p_track->b_ok = !!p_track->p_es;
             }
         }
diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h
index 228c37c..ebd7477 100644
--- a/modules/demux/mp4/mp4.h
+++ b/modules/demux/mp4/mp4.h
@@ -70,6 +70,7 @@ typedef struct
     int b_enable;           /* is the trak enable by default */
     bool b_selected;  /* is the trak being played */
     bool b_chapters_source;   /* True when used for chapter only */
+    bool b_forced_spu; /* forced track selection (never done by default/priority) */
     uint32_t i_switch_group;
 
     bool b_mac_encoding;



More information about the vlc-commits mailing list