]> git.sesse.net Git - vlc/commitdiff
* modules/gui/beos/AudioOutput.cpp: more cleaning
authorEric Petit <titer@videolan.org>
Thu, 8 May 2003 10:40:31 +0000 (10:40 +0000)
committerEric Petit <titer@videolan.org>
Thu, 8 May 2003 10:40:31 +0000 (10:40 +0000)
 * modules/gui/beos/VideoOutput.cpp: in fullscreen, add an item "Show
   Interface" to the popup

modules/gui/beos/AudioOutput.cpp
modules/gui/beos/MsgVals.h
modules/gui/beos/VideoOutput.cpp

index 18199c75e2ad50fadf55245fe2eb597d86dcddfe..34db378c532e34600b83b4ff041e2dc9a4282895 100644 (file)
@@ -2,7 +2,7 @@
  * AudioOutput.cpp: BeOS audio output
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: AudioOutput.cpp,v 1.28 2003/05/07 19:20:23 titer Exp $
+ * $Id: AudioOutput.cpp,v 1.29 2003/05/08 10:40:31 titer Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -46,19 +46,10 @@ extern "C"
  * aout_sys_t: BeOS audio output method descriptor
  *****************************************************************************/
 
-typedef struct latency_t
-{
-    VLC_COMMON_MEMBERS
-    
-    BSoundPlayer * p_player;
-    mtime_t        latency;
-
-} latency_t;
-
 typedef struct aout_sys_t
 {
     BSoundPlayer * p_player;
-    latency_t *    p_latency;
+    mtime_t        latency;
     
 } aout_sys_t;
 
@@ -68,7 +59,6 @@ typedef struct aout_sys_t
 static void Play         ( void * p_aout, void * p_buffer, size_t size,
                            const media_raw_audio_format & format );
 static void DoNothing    ( aout_instance_t * p_aout );
-static int  CheckLatency ( latency_t * p_latency );
 
 /*****************************************************************************
  * OpenAudio
@@ -122,22 +112,8 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
         return -1;
     }
 
-    /* FIXME
-     * We should check BSoundPlayer Latency() everytime we call
-     * aout_OutputNextBuffer(). Unfortunatly, it does not seem to work
-     * correctly: on my computer, it hangs for about 5 seconds at the
-     * beginning of the file. This is not acceptable, so we will start
-     * playing the file with a default latency (my computer's one ;p )
-     * and we create a thread which is going to update it ASAP. */
-    p_sys->p_latency = (latency_t*) vlc_object_create( p_aout, sizeof(latency_t) );
-    p_sys->p_latency->p_player = p_sys->p_player;
-    p_sys->p_latency->latency = 27613;
-    if( vlc_thread_create( p_sys->p_latency, "latency", CheckLatency,
-                           VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
-    {
-        msg_Err( p_aout, "cannot create Latency thread" );
-    }
-
+    /* Start playing */
+    p_sys->latency = p_sys->p_player->Latency();
     p_sys->p_player->Start();
     p_sys->p_player->SetHasData( true );
 
@@ -152,11 +128,6 @@ void E_(CloseAudio) ( vlc_object_t * p_this )
     aout_instance_t * p_aout = (aout_instance_t *) p_this;
     aout_sys_t * p_sys = (aout_sys_t *) p_aout->output.p_sys;
 
-    /* Stop the latency thread */
-    p_sys->p_latency->b_die = VLC_TRUE;
-    vlc_thread_join( p_sys->p_latency );
-    vlc_object_destroy( p_sys->p_latency );
-    
     /* Clean up */
     p_sys->p_player->Stop();
     delete p_sys->p_player;
@@ -172,16 +143,21 @@ static void Play( void * _p_aout, void * _p_buffer, size_t i_size,
     aout_instance_t * p_aout = (aout_instance_t*) _p_aout;
     float * p_buffer = (float*) _p_buffer;
     aout_sys_t * p_sys = (aout_sys_t*) p_aout->output.p_sys;
-    
-    /* FIXME (see above) */
-    mtime_t play_time = mdate() + p_sys->p_latency->latency;
-    
-    aout_buffer_t * p_aout_buffer =
-        aout_OutputNextBuffer( p_aout, play_time, VLC_FALSE );
+    aout_buffer_t * p_aout_buffer;
+
+    p_aout_buffer = aout_OutputNextBuffer( p_aout,
+                                           mdate() + p_sys->latency,
+                                           VLC_FALSE );
 
     if( p_aout_buffer != NULL )
     {
-        p_aout->p_vlc->pf_memcpy( p_buffer, p_aout_buffer->p_buffer, i_size );
+        p_aout->p_vlc->pf_memcpy( p_buffer, p_aout_buffer->p_buffer,
+                                  MIN( i_size, p_aout_buffer->i_nb_bytes ) );
+        if( p_aout_buffer->i_nb_bytes < i_size )
+        {
+            p_aout->p_vlc->pf_memset( p_buffer + p_aout_buffer->i_nb_bytes,
+                                      0, i_size - p_aout_buffer->i_nb_bytes );
+        }
         aout_BufferFree( p_aout_buffer );
     }
     else
@@ -197,16 +173,3 @@ static void DoNothing( aout_instance_t *p_aout )
 {
     return;
 }
-
-/*****************************************************************************
- * CheckLatency
- *****************************************************************************/
-static int CheckLatency( latency_t * p_latency )
-{
-    while( !p_latency->b_die )
-    {
-        p_latency->latency = p_latency->p_player->Latency();
-        snooze( 5000 );
-    }
-    return VLC_SUCCESS;
-}
index 1e3a79d01d303d23c105549b3704bd2e3837875c..b08b34c3e04cb9ca4ffec139be8249c633df77ee 100644 (file)
@@ -2,7 +2,7 @@
  * MsgVals.h
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: MsgVals.h,v 1.7 2003/02/09 17:10:52 stippi Exp $
+ * $Id: MsgVals.h,v 1.8 2003/05/08 10:40:31 titer Exp $
  *
  * Authors: Tony Castley <tcastley@mail.powerup.com.au>
  *          Stephan Aßmus <stippi@yellowbites.com>
@@ -58,6 +58,7 @@ const uint32 NAVIGATE_NEXT      = 'navn';    // could be chapter, title or file
 const uint32 OPEN_PREFERENCES   = 'pref';
 const uint32 OPEN_MESSAGES      = 'mess';
 const uint32 TOGGLE_ON_TOP      = 'ontp';
+const uint32 SHOW_INTERFACE     = 'shin';
 const uint32 TOGGLE_FULL_SCREEN = 'tgfs';
 const uint32 RESIZE_50          = 'rshl';
 const uint32 RESIZE_100         = 'rsor';
index 8b76614907584cec040066a604a54fc4826264ef..bd5f863b48cea84d4e75c2be9352361cf6c7c3e1 100644 (file)
@@ -2,7 +2,7 @@
  * vout_beos.cpp: beos video output display method
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: VideoOutput.cpp,v 1.18 2003/05/07 14:49:19 titer Exp $
+ * $Id: VideoOutput.cpp,v 1.19 2003/05/08 10:40:31 titer Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -300,7 +300,6 @@ VideoWindow::VideoWindow(int v_width, int v_height, BRect frame,
     AddShortcut( '3', 0, new BMessage( RESIZE_200 ) );
     
     // workaround for french keyboards
-    fprintf( stderr, "%x\n", '&' );
     AddShortcut( '&', 0, new BMessage( RESIZE_50 ) );
     AddShortcut( 'é', 0, new BMessage( RESIZE_100 ) );
         // FIXME - this one doesn't work because 'é' is a multi-byte character
@@ -327,6 +326,9 @@ VideoWindow::MessageReceived( BMessage *p_message )
 {
        switch( p_message->what )
        {
+           case SHOW_INTERFACE:
+               SetInterfaceShowing( true );
+               break;
                case TOGGLE_FULL_SCREEN:
                        BWindow::Zoom();
                        break;
@@ -384,6 +386,7 @@ VideoWindow::MessageReceived( BMessage *p_message )
                                        char* path = config_GetPsz( p_vout, "beos-screenshotpath" );
                                        if ( !path )
                                                path = strdup( DEFAULT_SCREEN_SHOT_PATH );
+                                       /* TODO: handle the format */
                                        /* config_GetPsz( p_vout, "beos-screenshotformat" ); */
                                        int32 format = DEFAULT_SCREEN_SHOT_FORMAT;
                                        _SaveScreenShot( temp, path, format );
@@ -1115,6 +1118,13 @@ VLCView::MouseDown(BPoint where)
                                // launch popup menu
                                BPopUpMenu *menu = new BPopUpMenu("context menu");
                                menu->SetRadioMode(false);
+                               // In full screen, add an item to show/hide the interface
+                               if( videoWindow->IsFullScreen() )
+                               {
+                                   BMenuItem *intfItem =
+                                       new BMenuItem( _("Show Interface"), new BMessage(SHOW_INTERFACE) );
+                                   menu->AddItem( intfItem );
+                               }
                                // Resize to 50%
                                BMenuItem *halfItem = new BMenuItem(_("50%"), new BMessage(RESIZE_50));
                                menu->AddItem(halfItem);