[vlc-commits] input: force subtitles coming from subtitles_Detect

Thomas Guillem git at videolan.org
Sun Jun 5 17:03:22 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Jun  5 17:01:15 2016 +0200| [410431432eeaa90380e2b14aac03c8003dbea83f] | committer: Thomas Guillem

input: force subtitles coming from subtitles_Detect

This restore an historical behavior that was removed with input slaves patches.

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

 include/vlc_input_item.h |    1 +
 src/input/input.c        |    6 ++++--
 src/input/item.c         |    1 +
 src/input/subtitles.c    |    3 +++
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 936afed..b55eb09 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -161,6 +161,7 @@ struct input_item_slave
 {
     enum slave_type     i_type;     /**< Slave type (spu, audio) */
     enum slave_priority i_priority; /**< Slave priority */
+    bool                b_forced;   /**< Slave should be selected */
     char                psz_uri[];  /**< Slave mrl */
 };
 
diff --git a/src/input/input.c b/src/input/input.c
index 22958fd..d4acfda 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1079,8 +1079,10 @@ static void LoadSlaves( input_thread_t *p_input )
         if( p_slave->i_type == SLAVE_TYPE_SPU )
         {
             msg_Err( p_input, "Loading spu slave: %s", p_slave->psz_uri );
-            const unsigned i_flags = p_slave->i_priority == SLAVE_PRIORITY_USER
-                                   ? SUB_FORCED : SUB_CANFAIL;
+            unsigned i_flags = p_slave->i_priority == SLAVE_PRIORITY_USER
+                               ? SUB_FORCED : SUB_CANFAIL;
+            if( p_slave->b_forced )
+                i_flags |= SUB_FORCED;
             input_SubtitleAdd( p_input, p_slave->psz_uri, i_flags );
         }
         else
diff --git a/src/input/item.c b/src/input/item.c
index 9478064..90e31dc 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -653,6 +653,7 @@ input_item_slave_t *input_item_slave_New(const char *psz_uri, enum slave_type i_
 
     p_slave->i_type = i_type;
     p_slave->i_priority = i_priority;
+    p_slave->b_forced = false;
     strcpy( p_slave->psz_uri, psz_uri );
 
     return p_slave;
diff --git a/src/input/subtitles.c b/src/input/subtitles.c
index cda172e..ed6d72a 100644
--- a/src/input/subtitles.c
+++ b/src/input/subtitles.c
@@ -334,7 +334,10 @@ int subtitles_Detect( input_thread_t *p_this, char *psz_path, const char *psz_na
                         input_item_slave_New( psz_uri, SLAVE_TYPE_SPU, i_prio )
                         : NULL;
                     if( p_sub )
+                    {
+                        p_sub->b_forced = true;
                         INSERT_ELEM( pp_slaves, i_slaves, i_slaves, p_sub );
+                    }
                     free( psz_uri );
                 }
                 free( path );



More information about the vlc-commits mailing list