[vlc-devel] [PATCH] Add a OSD message when drag'n dropping a subtitle

Jean-Baptiste Kempf jb at videolan.org
Sun Jan 19 15:42:53 CET 2014


When adding a subtitle to an existing input, mark a message, to show the
success.
This will work in Qt4, MacOS and Skins2 interfaces

Close #8395
---
 include/vlc_input.h | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 53e22b6..d939078 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -36,6 +36,7 @@
 #include <vlc_epg.h>
 #include <vlc_events.h>
 #include <vlc_input_item.h>
+#include <vlc_vout_osd.h>
 
 #include <string.h>
 
@@ -526,14 +527,6 @@ static inline input_state_e input_GetState( input_thread_t * p_input )
     input_Control( p_input, INPUT_GET_STATE, &state );
     return state;
 }
-/**
- * It will add a new subtitle source to the input.
- * Provided for convenience.
- */
-static inline int input_AddSubtitle( input_thread_t *p_input, const char *psz_url, bool b_check_extension )
-{
-    return input_Control( p_input, INPUT_ADD_SUBTITLE, psz_url, b_check_extension );
-}
 
 /**
  * Return one of the video output (if any). If possible, you should use
@@ -559,6 +552,26 @@ static inline vout_thread_t *input_GetVout( input_thread_t *p_input )
 }
 
 /**
+ * It will add a new subtitle source to the input.
+ * Provided for convenience.
+ */
+static inline int input_AddSubtitle( input_thread_t *p_input, const char *psz_url, bool b_check_extension )
+{
+    int i_result = input_Control( p_input, INPUT_ADD_SUBTITLE, psz_url, b_check_extension );
+    if( i_result != VLC_SUCCESS )
+        return i_result;
+
+    vout_thread_t *p_vout = input_GetVout( p_input );
+    if( p_vout )
+    {
+        vout_OSDMessage(p_vout, SPU_DEFAULT_CHANNEL, _("Subtitle track added");
+        vlc_object_release( (vlc_object_t *)p_vout );
+    }
+    return i_result;
+}
+
+
+/**
  * Return the audio output (if any) associated with an input.
  * @param p_input an input thread
  * @return NULL on error, or the audio output (which needs to be
-- 
1.8.5.3




More information about the vlc-devel mailing list