]> git.sesse.net Git - vlc/blobdiff - modules/gui/wince/timer.cpp
Qt: Remove the use of the Qt translations
[vlc] / modules / gui / wince / timer.cpp
index 546f2d9e26c41a3dbfdfc6c16d7f30569d949c2c..b7da9e9097b8604c61396a8f498af896e4532467 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>                                            /* strerror() */
-#include <stdio.h>
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
 #include <vlc_aout.h>
 #include <vlc_interface.h>
+#include <vlc_input.h>
+#include <vlc_playlist.h>
 
 #include "wince.h"
 
@@ -51,13 +54,11 @@ Timer::Timer( intf_thread_t *_p_intf, HWND hwnd, Interface *_p_main_interface)
     i_old_rate = INPUT_RATE_DEFAULT;
 
     /* Register callback for the intf-popupmenu variable */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Hold( p_intf );
     if( p_playlist != NULL )
     {
         var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-        vlc_object_release( p_playlist );
+        pl_Release( p_intf );
     }
 
     SetTimer( hwnd, 1, 200 /*milliseconds*/, NULL );
@@ -66,13 +67,11 @@ Timer::Timer( intf_thread_t *_p_intf, HWND hwnd, Interface *_p_main_interface)
 Timer::~Timer()
 {
     /* Unregister callback */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Hold( p_intf );
     if( p_playlist != NULL )
     {
         var_DelCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-        vlc_object_release( p_playlist );
+        pl_Release( p_intf );
     }
 }
 
@@ -91,8 +90,6 @@ void Timer::Notify( void )
     vlc_value_t val;
     char *shortname;
 
-    vlc_mutex_lock( &p_intf->change_lock );
-
     /* Update the input */
     if( p_intf->p_sys->p_input == NULL )
     {
@@ -108,12 +105,13 @@ void Timer::Notify( void )
             ShowWindow( p_main_interface->hwndVol, SW_SHOW );
 
             // only for local file, check if works well with net url
-            shortname = strrchr( p_intf->p_sys->p_input->input.p_item->psz_name, '\\' );
+            input_item_t *p_item =input_GetItem(p_intf->p_sys->p_input);
+            shortname = strrchr( input_item_GetURL(p_item), '\\' );
             if (! shortname)
-                shortname = p_intf->p_sys->p_input->input.p_item->psz_name;
+                shortname = input_item_GetURL(p_item);
             else shortname++;
-                        
-            SendMessage( p_main_interface->hwndSB, SB_SETTEXT, 
+            SendMessage( p_main_interface->hwndSB, SB_SETTEXT,
                          (WPARAM) 0, (LPARAM)_FROMMB(shortname) );
 
             p_main_interface->TogglePlayButton( PLAYING_S );
@@ -130,7 +128,7 @@ void Timer::Notify( void )
         p_main_interface->TogglePlayButton( PAUSE_S );
         i_old_playing_status = PAUSE_S;
 
-        SendMessage( p_main_interface->hwndSB, SB_SETTEXT, 
+        SendMessage( p_main_interface->hwndSB, SB_SETTEXT,
                      (WPARAM) 0, (LPARAM)(LPCTSTR) TEXT(""));
 
         vlc_object_release( p_intf->p_sys->p_input );
@@ -141,7 +139,7 @@ void Timer::Notify( void )
     {
         input_thread_t *p_input = p_intf->p_sys->p_input;
 
-        if( !p_input->b_die )
+        if( vlc_object_alive (p_input) )
         {
             /* New input or stream map change */
             p_intf->p_sys->b_playing = 1;
@@ -164,14 +162,14 @@ void Timer::Notify( void )
                         p_intf->p_sys->i_slider_pos =
                             (int)(SLIDER_MAX_POS * pos.f_float);
 
-                        SendMessage( p_main_interface->hwndSlider, TBM_SETPOS, 
+                        SendMessage( p_main_interface->hwndSlider, TBM_SETPOS,
                                      1, p_intf->p_sys->i_slider_pos );
 
                         var_Get( p_intf->p_sys->p_input, "time", &time );
                         i_seconds = time.i_time / 1000000;
                         secstotimestr ( psz_time, i_seconds );
 
-                        SendMessage( p_main_interface->hwndLabel, WM_SETTEXT, 
+                        SendMessage( p_main_interface->hwndLabel, WM_SETTEXT,
                                      (WPARAM)1, (LPARAM)_FROMMB(psz_time) );
                     }
                 }
@@ -203,30 +201,26 @@ void Timer::Notify( void )
                 _stprintf( psz_text + 2, _T("x%.2f"), 1000.0 / val.i_int );
                 psz_text[0] = psz_text[1] = _T('\t');
 
-                SendMessage( p_main_interface->hwndSB, SB_SETTEXT, 
+                SendMessage( p_main_interface->hwndSB, SB_SETTEXT,
                              (WPARAM) 1, (LPARAM)(LPCTSTR) psz_text );
 
                 i_old_rate = val.i_int;
             }
         }
     }
-    else if( p_intf->p_sys->b_playing && !intf_ShouldDie( p_intf ) )
+    else if( p_intf->p_sys->b_playing && vlc_object_alive( p_intf ) )
     {
         p_intf->p_sys->b_playing = 0;
         p_main_interface->TogglePlayButton( PAUSE_S );
         i_old_playing_status = PAUSE_S;
     }
 
-    if( intf_ShouldDie( p_intf ) )
+    if( !vlc_object_alive( p_intf ) )
     {
-        vlc_mutex_unlock( &p_intf->change_lock );
-
         /* Prepare to die, young Skywalker */
 /*        p_main_interface->Close(TRUE);*/
         return;
     }
-
-    vlc_mutex_unlock( &p_intf->change_lock );
 }
 
 /*****************************************************************************