[vlc-devel] [PATCH] Ticket 6311(New Enhacement), Display Position in OSD after mouse seek positions.

Tanmay tanmay.chaudhry at gmail.com
Wed Jun 5 22:47:40 CEST 2013


---
 modules/gui/qt4/input_manager.cpp | 48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 86176b7..9545934 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -35,6 +35,8 @@
 #include <vlc_url.h>
 #include <vlc_strings.h>
 #include <vlc_aout.h>
+#include <vlc_vout_osd.h>
+
 
 #include <QApplication>
 #include <QFile>
@@ -58,6 +60,15 @@ static int InputEvent( vlc_object_t *, const char *,
                        vlc_value_t, vlc_value_t, void * );
 static int VbiEvent( vlc_object_t *, const char *,
                      vlc_value_t, vlc_value_t, void * );
+static void DisplayPosition( intf_thread_t *,
+                             vout_thread_t *,
+                             input_thread_t *);
+
+#define DisplayMessage(vout, ...) \
+    do { \
+        if (vout) \
+            vout_OSDMessage(vout, SPU_DEFAULT_CHANNEL, __VA_ARGS__); \
+    } while(0)
 
 /* Ensure arbitratry (not dynamically allocated) event IDs are not in use */
 static inline void registerAndCheckEventIds( int start, int end )
@@ -773,6 +784,17 @@ void InputManager::sliderUpdate( float new_pos )
 {
     if( hasInput() )
         var_SetFloat( p_input, "position", new_pos );
+
+    playlist_t *p_playlist = pl_Get( p_intf );
+
+    /* Update the input */
+    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+
+    /* Update the vout */
+    vout_thread_t *p_vout = p_input ? input_GetVout( p_input ) : NULL;
+
+    DisplayPosition(p_intf, p_vout, p_input);
+
     emit seekRequested( new_pos );
 }
 
@@ -1268,3 +1290,29 @@ static int PLItemRemoved
     }
     return VLC_SUCCESS;
 }
+
+static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
+                             input_thread_t *p_input )
+{
+    char psz_duration[MSTRTIME_MAX_SIZE];
+    char psz_time[MSTRTIME_MAX_SIZE];
+    vlc_value_t time, pos;
+    mtime_t i_seconds;
+
+    if( p_vout == NULL ) return;
+
+    var_Get( p_input, "time", &time );
+    i_seconds = time.i_time / 1000000;
+    secstotimestr ( psz_time, i_seconds );
+
+    var_Get( p_input, "length", &time );
+    if( time.i_time > 0 )
+    {
+        secstotimestr( psz_duration, time.i_time / 1000000 );
+        DisplayMessage( p_vout, "%s / %s", psz_time, psz_duration );
+    }
+    else if( i_seconds > 0 )
+    {
+        DisplayMessage( p_vout, "%s", psz_time );
+    }
+}
-- 
1.8.3




More information about the vlc-devel mailing list