]> git.sesse.net Git - vlc/blobdiff - modules/gui/wince/interface.cpp
Fix Service Discovey plugin names character set
[vlc] / modules / gui / wince / interface.cpp
index 174bf7063761e640be7bac464c6dfac1574556aa..00035dd2b90d64f888a077990d9b6b74b97cf2b5 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#define __STDC_CONSTANT_MACROS 1
+#include <inttypes.h>
+
+#include <vlc_common.h>
 #include <vlc_aout.h>
 #include <vlc_vout.h>
 #include <vlc_interface.h>
+#include <vlc_input.h>
+#include <vlc_playlist.h>
 
 #include "wince.h"
+#define INT64_C(val) val##LL
 
 #include <windowsx.h>
 #include <commctrl.h>
@@ -498,11 +504,10 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
         {
             string about = (string)"VLC media player " PACKAGE_VERSION +
                 _("\n(WinCE interface)\n\n") +
-                _("(c) 1996-2006 - the VideoLAN Team\n\n") +
+                _("(c) 1996-2008 - the VideoLAN Team\n\n") +
                 _("Compiled by ") + VLC_CompileBy() + "@" +
                 VLC_CompileHost() + "." + VLC_CompileDomain() + ".\n" +
-                _("Compiler: ") + VLC_Compiler() + ".\n" +
-                _("Based on Git commit: ") + VLC_Changeset() + ".\n\n" +
+                _("Compiler: ") + VLC_Compiler() + ".\n\n" +
                 _("The VideoLAN team <videolan@videolan.org>\n"
                   "http://www.videolan.org/");
 
@@ -634,11 +639,10 @@ void Interface::OnShowDialog( int i_dialog_event )
 
 void Interface::OnPlayStream( void )
 {
-    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 ) return;
 
-    if( p_playlist->i_size && p_playlist->i_enabled )
+    if( !playlist_IsEmpty(p_playlist) )
     {
         vlc_value_t state;
 
@@ -650,7 +654,7 @@ void Interface::OnPlayStream( void )
             /* No stream was playing, start one */
             playlist_Play( p_playlist );
             TogglePlayButton( PLAYING_S );
-            vlc_object_release( p_playlist );
+            pl_Release( p_intf );
             return;
         }
 
@@ -670,14 +674,13 @@ void Interface::OnPlayStream( void )
 
         TogglePlayButton( state.i_int );
         vlc_object_release( p_input );
-        vlc_object_release( p_playlist );
     }
     else
     {
         /* If the playlist is empty, open a file requester instead */
-        vlc_object_release( p_playlist );
         OnShowDialog( ID_FILE_QUICKOPEN );
     }
+    pl_Release( p_intf );
 }
 
 void Interface::TogglePlayButton( int i_playing_status )
@@ -730,7 +733,6 @@ void Interface::OnVideoOnTop( void )
 
 void Interface::OnSliderUpdate( int wp )
 {
-    vlc_mutex_lock( &p_intf->change_lock );
     input_thread_t *p_input = p_intf->p_sys->p_input;
 
     int dwPos = SendMessage( hwndSlider, TBM_GETPOS, 0, 0 );
@@ -745,11 +747,11 @@ void Interface::OnSliderUpdate( int wp )
             var_Set( p_input, "position", pos );
         }
 
-        p_intf->p_sys->b_slider_free = VLC_TRUE;
+        p_intf->p_sys->b_slider_free = true;
     }
     else
     {
-        p_intf->p_sys->b_slider_free = VLC_FALSE;
+        p_intf->p_sys->b_slider_free = false;
 
         if( p_input )
         {
@@ -757,18 +759,16 @@ void Interface::OnSliderUpdate( int wp )
             char psz_time[ MSTRTIME_MAX_SIZE ], psz_total[ MSTRTIME_MAX_SIZE ];
             mtime_t i_seconds;
 
-            i_seconds = var_GetTime( p_input, "length" ) / I64C(1000000 );
+            i_seconds = var_GetTime( p_input, "length" ) / INT64_C(1000000 );
             secstotimestr( psz_total, i_seconds );
 
-            i_seconds = var_GetTime( p_input, "time" ) / I64C(1000000 );
+            i_seconds = var_GetTime( p_input, "time" ) / INT64_C(1000000 );
             secstotimestr( psz_time, i_seconds );
 
             SendMessage( hwndLabel, WM_SETTEXT, (WPARAM)1,
                          (LPARAM)_FROMMB(psz_time) );
         }
     }
-
-    vlc_mutex_unlock( &p_intf->change_lock );
 }
 
 void Interface::OnChange( int wp )
@@ -778,17 +778,19 @@ void Interface::OnChange( int wp )
     if( LOWORD(wp) == SB_THUMBPOSITION || LOWORD(wp) == SB_ENDSCROLL )
     {
         VolumeChange( 200 - (int)dwPos );
-        b_volume_hold = VLC_FALSE;
+        b_volume_hold = false;
     }
     else
     {
-        b_volume_hold = VLC_TRUE;
+        b_volume_hold = true;
     }
 }
 
 void Interface::VolumeChange( int i_volume )
 {
-    aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
+    playlist_t * p_playlist = pl_Hold( p_intf );
+    aout_VolumeSet( p_playlist, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
+    pl_Release( p_intf );
 }
 
 void Interface::VolumeUpdate()
@@ -797,7 +799,9 @@ void Interface::VolumeUpdate()
 
     if( b_volume_hold ) return;
 
+    playlist_t * p_playlist = pl_Hold( p_intf );
     aout_VolumeGet( p_intf, &i_volume );
+    pl_Release( p_intf );
 
     int i_volume_ctrl = 200 - i_volume * 200 * 2 / AOUT_VOLUME_MAX;
 
@@ -809,33 +813,30 @@ void Interface::VolumeUpdate()
 
 void Interface::OnStopStream( void )
 {
-    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 ) return;
 
     playlist_Stop( p_playlist );
     TogglePlayButton( PAUSE_S );
-    vlc_object_release( p_playlist );
+    pl_Release( p_intf );
 }
 
 void Interface::OnPrevStream( void )
 {
-    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 ) return;
 
     playlist_Prev( p_playlist );
-    vlc_object_release( p_playlist );
+    pl_Release( p_intf );
 }
 
 void Interface::OnNextStream( void )
 {
-    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 ) return;
 
     playlist_Next( p_playlist );
-    vlc_object_release( p_playlist );
+    pl_Release( p_intf );
 }
 
 void Interface::OnSlowStream( void )
@@ -845,7 +846,7 @@ void Interface::OnSlowStream( void )
 
     if( p_input == NULL ) return;
 
-    vlc_value_t val; val.b_bool = VLC_TRUE;
+    vlc_value_t val; val.b_bool = true;
     var_Set( p_input, "rate-slower", val );
     vlc_object_release( p_input );
 }
@@ -857,7 +858,7 @@ void Interface::OnFastStream( void )
 
     if( p_input == NULL ) return;
 
-    vlc_value_t val; val.b_bool = VLC_TRUE;
+    vlc_value_t val; val.b_bool = true;
     var_Set( p_input, "rate-faster", val );
     vlc_object_release( p_input );
 }