From c5bd872c66f60cee7f886bdfdc5b8e5ec5b0b17c Mon Sep 17 00:00:00 2001 From: Eric Petit <titer@videolan.org> Date: Thu, 10 Oct 2002 23:11:52 +0000 Subject: [PATCH] Some clean-up. Playlist works again. --- modules/gui/beos/Interface.cpp | 20 ++- modules/gui/beos/InterfaceWindow.cpp | 89 +++++------ modules/gui/beos/PlayListWindow.cpp | 14 +- modules/gui/beos/PlayListWindow.h | 17 ++- modules/gui/beos/VlcWrapper.cpp | 211 +++++++++++++-------------- modules/gui/beos/VlcWrapper.h | 14 +- 6 files changed, 188 insertions(+), 177 deletions(-) diff --git a/modules/gui/beos/Interface.cpp b/modules/gui/beos/Interface.cpp index 06e86b661bcf..7b31b98c1dbf 100644 --- a/modules/gui/beos/Interface.cpp +++ b/modules/gui/beos/Interface.cpp @@ -2,7 +2,7 @@ * intf_beos.cpp: beos interface ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: Interface.cpp,v 1.2 2002/09/30 18:30:27 titer Exp $ + * $Id: Interface.cpp,v 1.3 2002/10/10 23:11:52 titer Exp $ * * Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> @@ -71,6 +71,10 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) } p_intf->p_sys->p_input = NULL; + p_intf->p_sys->p_vlc_wrapper = new Intf_VLCWrapper( p_intf ); + p_intf->p_sys->p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); p_intf->pf_run = Run; @@ -124,6 +128,13 @@ static void Run( intf_thread_t *p_intf ) { while( !p_intf->b_die ) { + if( p_intf->p_sys->p_input == NULL ) + { + p_intf->p_sys->p_input = + (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, + FIND_ANYWHERE ); + } + /* Update the input */ if( p_intf->p_sys->p_input != NULL ) { @@ -135,13 +146,6 @@ static void Run( intf_thread_t *p_intf ) /* Manage the slider */ p_intf->p_sys->p_window->updateInterface(); } - - if( p_intf->p_sys->p_input == NULL ) - { - p_intf->p_sys->p_input = - (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, - FIND_ANYWHERE ); - } /* Wait a bit */ msleep( INTF_IDLE_SLEEP ); diff --git a/modules/gui/beos/InterfaceWindow.cpp b/modules/gui/beos/InterfaceWindow.cpp index 6ce75e5cb758..6477c07bfe43 100644 --- a/modules/gui/beos/InterfaceWindow.cpp +++ b/modules/gui/beos/InterfaceWindow.cpp @@ -2,7 +2,7 @@ * InterfaceWindow.cpp: beos interface ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: InterfaceWindow.cpp,v 1.2 2002/09/30 18:30:27 titer Exp $ + * $Id: InterfaceWindow.cpp,v 1.3 2002/10/10 23:11:52 titer Exp $ * * Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> @@ -67,11 +67,16 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, fSettings( new BMessage( 'sett' ) ) { p_intf = p_interface; - p_vlc_wrapper = p_vlc_wrapper->getVLCWrapper(p_intf); playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); fPlaylistIsEmpty = (p_playlist->i_size < 0); + fPlaylistWindow = new PlayListWindow( BRect( 20.0, 20.0, 170.0, 320.0 ), + "Playlist", + p_playlist, + this, + p_intf ); + // set the title bar SetName( "interface" ); SetTitle( VOUT_TITLE ); @@ -199,7 +204,7 @@ InterfaceWindow::FrameResized(float width, float height) void InterfaceWindow::MessageReceived( BMessage * p_message ) { int playback_status; // remember playback state - playback_status = p_vlc_wrapper->inputGetStatus(); + playback_status = p_intf->p_sys->p_vlc_wrapper->inputGetStatus(); switch( p_message->what ) { @@ -241,7 +246,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) if( p_message->FindString( "device", &psz_device ) == B_OK ) { BString device( psz_device ); - p_vlc_wrapper->openDisc( type, device, 0, 0 ); + p_intf->p_sys->p_vlc_wrapper->openDisc( type, device, 0, 0 ); } _UpdatePlaylist(); } @@ -251,9 +256,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) // this currently stops playback not nicely if (playback_status > UNDEF_S) { - p_vlc_wrapper->volume_mute(); + p_intf->p_sys->p_vlc_wrapper->volume_mute(); snooze( 400000 ); - p_vlc_wrapper->playlistStop(); + p_intf->p_sys->p_vlc_wrapper->playlistStop(); p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); } break; @@ -268,20 +273,20 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) /* pause if currently playing */ if ( playback_status == PLAYING_S ) { - p_vlc_wrapper->volume_mute(); + p_intf->p_sys->p_vlc_wrapper->volume_mute(); snooze( 400000 ); - p_vlc_wrapper->playlistPause(); + p_intf->p_sys->p_vlc_wrapper->playlistPause(); } else { - p_vlc_wrapper->volume_restore(); - p_vlc_wrapper->playlistPlay(); + p_intf->p_sys->p_vlc_wrapper->volume_restore(); + p_intf->p_sys->p_vlc_wrapper->playlistPlay(); } } else { /* Play a new file */ - p_vlc_wrapper->playlistPlay(); + p_intf->p_sys->p_vlc_wrapper->playlistPlay(); } break; @@ -289,9 +294,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) /* cycle the fast playback modes */ if (playback_status > UNDEF_S) { - p_vlc_wrapper->volume_mute(); + p_intf->p_sys->p_vlc_wrapper->volume_mute(); snooze( 400000 ); - p_vlc_wrapper->playFaster(); + p_intf->p_sys->p_vlc_wrapper->playFaster(); } break; @@ -299,9 +304,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) /* cycle the slow playback modes */ if (playback_status > UNDEF_S) { - p_vlc_wrapper->volume_mute(); + p_intf->p_sys->p_vlc_wrapper->volume_mute(); snooze( 400000 ); - p_vlc_wrapper->playSlower(); + p_intf->p_sys->p_vlc_wrapper->playSlower(); } break; @@ -309,8 +314,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) /* restore speed to normal if already playing */ if (playback_status > UNDEF_S) { - p_vlc_wrapper->volume_restore(); - p_vlc_wrapper->playlistPlay(); + p_intf->p_sys->p_vlc_wrapper->volume_restore(); + p_intf->p_sys->p_vlc_wrapper->playlistPlay(); } break; @@ -322,15 +327,15 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) /* adjust the volume */ if (playback_status > UNDEF_S) { - p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); - p_mediaControl->SetMuted( p_vlc_wrapper->is_muted() ); + p_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); + p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() ); } break; case VOLUME_MUTE: // toggle muting - p_vlc_wrapper->toggle_mute(); - p_mediaControl->SetMuted( p_vlc_wrapper->is_muted() ); + p_intf->p_sys->p_vlc_wrapper->toggle_mute(); + p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() ); break; case SELECT_CHANNEL: @@ -339,14 +344,14 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) int32 channel; if ( p_message->FindInt32( "channel", &channel ) == B_OK ) { - p_vlc_wrapper->toggleLanguage( channel ); + p_intf->p_sys->p_vlc_wrapper->toggleLanguage( channel ); // vlc seems to remember the volume for every channel, // but I would assume that to be somewhat annoying to the user // the next call will also unmute the volume, which is probably // desired as well, because if the user selects another language, // he probably wants to hear the change as well snooze( 400000 ); // we have to wait a bit, or the change will be reverted - p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); + p_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); } } break; @@ -356,7 +361,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) { int32 subtitle; if ( p_message->FindInt32( "subtitle", &subtitle ) == B_OK ) - p_vlc_wrapper->toggleSubtitle( subtitle ); + p_intf->p_sys->p_vlc_wrapper->toggleSubtitle( subtitle ); } break; @@ -369,7 +374,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) /* Disallow area 0 since it is used for video_ts.vob */ if( i_id > 0 ) { - p_vlc_wrapper->toggleTitle(i_id); + p_intf->p_sys->p_vlc_wrapper->toggleTitle(i_id); } break; } @@ -381,7 +386,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) if( i_id < p_intf->p_sys->p_input->stream.i_area_nb ) { - p_vlc_wrapper->toggleTitle(i_id); + p_intf->p_sys->p_vlc_wrapper->toggleTitle(i_id); } break; } @@ -390,7 +395,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) { int32 index; if ( p_message->FindInt32( "index", &index ) == B_OK ) - p_vlc_wrapper->toggleTitle( index ); + p_intf->p_sys->p_vlc_wrapper->toggleTitle( index ); } break; case PREV_CHAPTER: @@ -401,7 +406,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) if( i_id >= 0 ) { - p_vlc_wrapper->toggleChapter(i_id); + p_intf->p_sys->p_vlc_wrapper->toggleChapter(i_id); } break; } @@ -413,7 +418,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) if( i_id >= 0 ) { - p_vlc_wrapper->toggleChapter(i_id); + p_intf->p_sys->p_vlc_wrapper->toggleChapter(i_id); } break; } @@ -422,21 +427,21 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) { int32 index; if ( p_message->FindInt32( "index", &index ) == B_OK ) - p_vlc_wrapper->toggleChapter( index ); + p_intf->p_sys->p_vlc_wrapper->toggleChapter( index ); } break; case PREV_FILE: - p_vlc_wrapper->playlistPrev(); + p_intf->p_sys->p_vlc_wrapper->playlistPrev(); break; case NEXT_FILE: - p_vlc_wrapper->playlistNext(); + p_intf->p_sys->p_vlc_wrapper->playlistNext(); break; // general next/prev functionality (skips to whatever makes most sense) case NAVIGATE_PREV: - p_vlc_wrapper->navigatePrev(); + p_intf->p_sys->p_vlc_wrapper->navigatePrev(); break; case NAVIGATE_NEXT: - p_vlc_wrapper->navigateNext(); + p_intf->p_sys->p_vlc_wrapper->navigateNext(); break; // drag'n'drop and system messages case B_REFS_RECEIVED: @@ -458,7 +463,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) files.AddItem( new BString( (char*)path.Path() ) ); } // give the list to VLC - p_vlc_wrapper->openFiles(&files, replace); + p_intf->p_sys->p_vlc_wrapper->openFiles(&files, replace); _UpdatePlaylist(); } break; @@ -477,9 +482,9 @@ bool InterfaceWindow::QuitRequested() { if (p_intf->p_sys->p_input) { - p_vlc_wrapper->volume_mute(); + p_intf->p_sys->p_vlc_wrapper->volume_mute(); snooze( 400000 ); - p_vlc_wrapper->playlistStop(); + p_intf->p_sys->p_vlc_wrapper->playlistStop(); p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); } @@ -500,7 +505,7 @@ void InterfaceWindow::updateInterface() { if ( acquire_sem( p_mediaControl->fScrubSem ) == B_OK ) { - p_vlc_wrapper->setTimeAsFloat(p_mediaControl->GetSeekTo()); + p_intf->p_sys->p_vlc_wrapper->setTimeAsFloat(p_mediaControl->GetSeekTo()); } else if ( Lock() ) { @@ -517,13 +522,13 @@ void InterfaceWindow::updateInterface() // enable/disable skip buttons bool canSkipPrev; bool canSkipNext; - p_vlc_wrapper->getNavCapabilities( &canSkipPrev, &canSkipNext ); + p_intf->p_sys->p_vlc_wrapper->getNavCapabilities( &canSkipPrev, &canSkipNext ); p_mediaControl->SetSkippable( canSkipPrev, canSkipNext ); - if ( p_vlc_wrapper->has_audio() ) + if ( p_intf->p_sys->p_vlc_wrapper->has_audio() ) { p_mediaControl->SetAudioEnabled( true ); - p_mediaControl->SetMuted( p_vlc_wrapper->is_muted() ); + p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() ); } else p_mediaControl->SetAudioEnabled( false ); @@ -659,7 +664,7 @@ InterfaceWindow::_InputStreamChanged() //printf("InterfaceWindow::_InputStreamChanged()\n"); // TODO: move more stuff from updateInterface() here! snooze( 400000 ); - p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); + p_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); } /***************************************************************************** diff --git a/modules/gui/beos/PlayListWindow.cpp b/modules/gui/beos/PlayListWindow.cpp index 669fc61a0f43..1ba66dc1baec 100644 --- a/modules/gui/beos/PlayListWindow.cpp +++ b/modules/gui/beos/PlayListWindow.cpp @@ -2,7 +2,7 @@ * PlayListWindow.cpp: beos interface ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: PlayListWindow.cpp,v 1.2 2002/09/30 18:30:27 titer Exp $ + * $Id: PlayListWindow.cpp,v 1.3 2002/10/10 23:11:52 titer Exp $ * * Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> @@ -58,12 +58,14 @@ enum *****************************************************************************/ PlayListWindow::PlayListWindow( BRect frame, const char* name, playlist_t *playlist, - InterfaceWindow* mainWindow ) + InterfaceWindow* mainWindow, + intf_thread_t *p_interface ) : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ), fPlaylist( playlist ), fMainWindow( mainWindow ) { + this->p_intf = p_interface; SetName( "playlist" ); // set up the main menu bar @@ -222,7 +224,7 @@ void PlayListWindow::ReallyQuit() { Lock(); - Hide(); + Hide(); Quit(); } @@ -232,7 +234,7 @@ PlayListWindow::ReallyQuit() void PlayListWindow::UpdatePlaylist( bool rebuild ) { - /* if ( rebuild ) + if ( rebuild ) { // remove all items int32 count = fListView->CountItems(); @@ -241,8 +243,8 @@ PlayListWindow::UpdatePlaylist( bool rebuild ) // rebuild listview from VLC's playlist for ( int i = 0; i < fPlaylist->i_size; i++ ) - fListView->AddItem( new PlaylistItem( fPlaylist->p_item[i].psz_name ) ); + fListView->AddItem( new PlaylistItem( fPlaylist->pp_items[i]->psz_name ) ); } fListView->SetCurrent( fPlaylist->i_index ); - fListView->SetPlaying( Intf_VLCWrapper::is_playing() ); */ + fListView->SetPlaying( p_intf->p_sys->p_vlc_wrapper->is_playing() ); } diff --git a/modules/gui/beos/PlayListWindow.h b/modules/gui/beos/PlayListWindow.h index 2dc047150046..5c689b1b7026 100644 --- a/modules/gui/beos/PlayListWindow.h +++ b/modules/gui/beos/PlayListWindow.h @@ -2,7 +2,7 @@ * PlayListWindow.h: BeOS interface window class prototype ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: PlayListWindow.h,v 1.2 2002/09/30 18:30:27 titer Exp $ + * $Id: PlayListWindow.h,v 1.3 2002/10/10 23:11:52 titer Exp $ * * Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Tony Castley <tcastley@mail.powerup.com.au> @@ -40,7 +40,8 @@ class PlayListWindow : public BWindow PlayListWindow(BRect frame, const char* name, playlist_t* playlist, - InterfaceWindow* mainWindow ); + InterfaceWindow* mainWindow, + intf_thread_t *p_interface ); virtual ~PlayListWindow(); // BWindow @@ -54,11 +55,13 @@ class PlayListWindow : public BWindow private: - playlist_t* fPlaylist; - PlaylistView* fListView; - BView* fBackgroundView; - BMenuBar* fMenuBar; - InterfaceWindow* fMainWindow; + playlist_t * fPlaylist; + PlaylistView * fListView; + BView * fBackgroundView; + BMenuBar * fMenuBar; + InterfaceWindow * fMainWindow; + + intf_thread_t * p_intf; }; #endif // BEOS_PLAY_LIST_WINDOW_H diff --git a/modules/gui/beos/VlcWrapper.cpp b/modules/gui/beos/VlcWrapper.cpp index a3d3771df8af..b0f9104f204a 100644 --- a/modules/gui/beos/VlcWrapper.cpp +++ b/modules/gui/beos/VlcWrapper.cpp @@ -2,7 +2,7 @@ * intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port ) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: VlcWrapper.cpp,v 1.4 2002/09/30 18:30:27 titer Exp $ + * $Id: VlcWrapper.cpp,v 1.5 2002/10/10 23:11:52 titer Exp $ * * Authors: Florian G. Pflug <fgp@phlo.org> * Jon Lech Johansen <jon-vl@nanocrew.net> @@ -28,22 +28,24 @@ #include <vlc/vlc.h> #include <vlc/intf.h> +#include <audio_output.h> +#include <aout_internal.h> #include "VlcWrapper.h" -Intf_VLCWrapper *Intf_VLCWrapper::getVLCWrapper(intf_thread_t *p_if) +Intf_VLCWrapper *Intf_VLCWrapper::getVLCWrapper(intf_thread_t *p_interface) { static Intf_VLCWrapper *one_wrapper; if (one_wrapper == NULL ) { - one_wrapper = new Intf_VLCWrapper(p_if); + one_wrapper = new Intf_VLCWrapper(p_interface); } return one_wrapper; } -Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_if) +Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_interface) { - p_intf = p_if; + p_intf = p_interface; } Intf_VLCWrapper::~Intf_VLCWrapper() @@ -53,34 +55,34 @@ Intf_VLCWrapper::~Intf_VLCWrapper() #if 0 bool Intf_VLCWrapper::manage() { - p_main->p_intf->pf_manage( p_main->p_intf ); + /* p_main->p_intf->pf_manage( p_intf ); */ - if ( p_main->p_intf->b_die ) + if ( p_intf->b_die ) { // exit the lot return( 1 ); } - if ( p_input_bank->pp_input[0] != NULL ) + if ( p_intf->p_sys->p_input != NULL ) { - vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock ); - if( !p_input_bank->pp_input[0]->b_die ) + vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); + if( !p_intf->p_sys->p_input->b_die ) { /* New input or stream map change */ - if( p_input_bank->pp_input[0]->stream.b_changed || - p_main->p_intf->p_sys->i_part != - p_input_bank->pp_input[0]->stream.p_selected_area->i_part ) + if( p_intf->p_sys->p_input->stream.b_changed || + p_intf->p_sys->i_part != + p_intf->p_sys->p_input->stream.p_selected_area->i_part ) { setupMenus(); - p_main->p_intf->p_sys->b_disabled_menus = 0; + p_intf->p_sys->b_disabled_menus = 0; } } - vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock ); + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); } - else if ( !p_main->p_intf->p_sys->b_disabled_menus ) + else if ( !p_intf->p_sys->b_disabled_menus ) { setupMenus(); - p_main->p_intf->p_sys->b_disabled_menus = 1; + p_intf->p_sys->b_disabled_menus = 1; } return( 0 ); } @@ -199,34 +201,33 @@ void Intf_VLCWrapper::playlistJumpTo( int pos ) int Intf_VLCWrapper::playlistCurrentPos() { - /*playlistLock(); - int pos = p_main->p_playlist->i_index; + playlistLock(); + int pos = p_intf->p_sys->p_playlist->i_index; playlistUnlock(); - return pos;*/ + return pos; } int Intf_VLCWrapper::playlistSize() { - /*playlistLock(); - int size = p_main->p_playlist->i_size; + playlistLock(); + int size = p_intf->p_sys->p_playlist->i_size; playlistUnlock(); - return size;*/ + return size; } void Intf_VLCWrapper::playlistLock() { - /*vlc_mutex_lock( &p_main->p_playlist->change_lock );*/ + vlc_mutex_lock( &p_intf->p_sys->p_playlist->object_lock ); } void Intf_VLCWrapper::playlistUnlock() { - /*vlc_mutex_unlock( &p_main->p_playlist->change_lock );*/ + vlc_mutex_unlock( &p_intf->p_sys->p_playlist->object_lock ); } void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev, bool* canSkipNext ) { -#if 0 if ( canSkipPrev && canSkipNext ) { // init the parameters @@ -234,11 +235,12 @@ void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev, *canSkipNext = false; // get playlist info playlistLock(); - int pos = p_main->p_playlist->i_index; - int size = p_main->p_playlist->i_size; + int pos = p_intf->p_sys->p_playlist->i_index; + int size = p_intf->p_sys->p_playlist->i_size; playlistUnlock(); - input_thread_t* input = p_input_bank->pp_input[0]; + /* input_thread_t* input = p_input_bank->pp_input[0]; */ + input_thread_t* input = p_intf->p_sys->p_input; // see if we have got a stream going if ( input ) { @@ -269,7 +271,6 @@ void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev, if ( !*canSkipNext ) *canSkipNext = pos < size - 1; } -#endif } void Intf_VLCWrapper::navigatePrev() @@ -416,21 +417,18 @@ void Intf_VLCWrapper::navigateNext() void Intf_VLCWrapper::loop() { -#if 0 - intf_thread_t * p_intf = p_main->p_intf; - if ( p_intf->p_sys->b_loop ) { - intf_PlaylistDelete( p_main->p_playlist, - p_main->p_playlist->i_size - 1 ); + playlist_Delete( p_intf->p_sys->p_playlist, + p_intf->p_sys->p_playlist->i_size - 1 ); } else { - intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, - "vlc:loop" ); + playlist_Add( p_intf->p_sys->p_playlist, "vlc:loop", + PLAYLIST_APPEND | PLAYLIST_GO, + PLAYLIST_END ); } p_intf->p_sys->b_loop = !p_intf->p_sys->b_loop; -#endif } @@ -469,110 +467,104 @@ void Intf_VLCWrapper::playFaster() void Intf_VLCWrapper::volume_mute() { -/* - if( p_aout_bank->i_count > 0 - && p_aout_bank->pp_aout[0] != NULL ) + p_intf->p_sys->p_aout = + (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_intf->p_sys->p_aout != NULL ) { - if( !p_main->p_intf->p_sys->b_mute ) + if( !p_intf->p_sys->b_mute ) { - p_main->p_intf->p_sys->i_saved_volume = - p_aout_bank->pp_aout[0]->i_volume; - p_aout_bank->pp_aout[0]->i_volume = 0; - p_main->p_intf->p_sys->b_mute = 1; + p_intf->p_sys->i_saved_volume = p_intf->p_sys->p_aout->output.i_volume; + p_intf->p_sys->p_aout->output.i_volume = 0; + p_intf->p_sys->b_mute = 1; } } -*/ + } void Intf_VLCWrapper::volume_restore() { -/* - if( p_aout_bank->i_count > 0 - && p_aout_bank->pp_aout[0] != NULL ) + p_intf->p_sys->p_aout = + (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_intf->p_sys->p_aout != NULL ) { - p_aout_bank->pp_aout[0]->i_volume = - p_main->p_intf->p_sys->i_saved_volume; - p_main->p_intf->p_sys->i_saved_volume = 0; - p_main->p_intf->p_sys->b_mute = 0; + p_intf->p_sys->p_aout->output.i_volume = p_intf->p_sys->i_saved_volume; + p_intf->p_sys->i_saved_volume = 0; + p_intf->p_sys->b_mute = 0; } -*/ + } void Intf_VLCWrapper::set_volume(int value) { -#if 0 - if( p_aout_bank->i_count > 0 - && p_aout_bank->pp_aout[0] != NULL ) + p_intf->p_sys->p_aout = + (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_intf->p_sys->p_aout != NULL ) { // make sure value is within bounds if (value < 0) value = 0; if (value > AOUT_VOLUME_MAX) value = AOUT_VOLUME_MAX; - vlc_mutex_lock( &p_aout_bank->lock ); - // unmute volume if muted - if ( p_main->p_intf->p_sys->b_mute ) - p_main->p_intf->p_sys->b_mute = 0; - // set every stream to the given value - for ( int i = 0 ; i < p_aout_bank->i_count ; i++ ) - { - if ( p_aout_bank->pp_aout[i] ) - p_aout_bank->pp_aout[i]->i_volume = value; - } - vlc_mutex_unlock( &p_aout_bank->lock ); + vlc_mutex_lock( &p_intf->p_sys->p_aout->mixer_lock ); + // unmute volume if muted + if ( p_intf->p_sys->b_mute ) + { + p_intf->p_sys->b_mute = 0; + p_intf->p_sys->p_aout->output.i_volume = value; + } + vlc_mutex_unlock( &p_intf->p_sys->p_aout->mixer_lock ); } -#endif } void Intf_VLCWrapper::toggle_mute() { -/* - if( p_aout_bank->i_count > 0 - && p_aout_bank->pp_aout[0] != NULL ) + p_intf->p_sys->p_aout = + (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_intf->p_sys->p_aout != NULL ) { - if ( p_main->p_intf->p_sys->b_mute ) + if ( p_intf->p_sys->b_mute ) { - Intf_VLCWrapper::volume_restore(); + volume_restore(); } else { - Intf_VLCWrapper::volume_mute(); + volume_mute(); } } -*/ } bool Intf_VLCWrapper::is_muted() { -#if 0 bool muted = true; - if ( p_aout_bank->i_count > 0 ) + + p_intf->p_sys->p_aout = + (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_intf->p_sys->p_aout != NULL ) { - vlc_mutex_lock( &p_aout_bank->lock ); - for ( int i = 0 ; i < p_aout_bank->i_count ; i++ ) - { - if ( p_aout_bank->pp_aout[i] - && p_aout_bank->pp_aout[i]->i_volume > 0 ) - { - muted = false; - break; - } - } - vlc_mutex_unlock( &p_aout_bank->lock ); + vlc_mutex_lock( &p_intf->p_sys->p_aout->mixer_lock ); + if( p_intf->p_sys->p_aout->output.i_volume > 0 ) + { + muted = false; + } + vlc_mutex_unlock( &p_intf->p_sys->p_aout->mixer_lock ); // unfortunately, this is not reliable! // return p_main->p_intf->p_sys->b_mute; } return muted; -#endif } bool Intf_VLCWrapper::is_playing() { -/* + bool playing = false; - if ( p_input_bank->pp_input[0] ) + if ( p_intf->p_sys->p_input ) { - switch ( p_input_bank->pp_input[0]->stream.control.i_status ) + switch ( p_intf->p_sys->p_input->stream.control.i_status ) { case PLAYING_S: case FORWARD_S: @@ -588,30 +580,33 @@ bool Intf_VLCWrapper::is_playing() } } return playing; -*/ + } void Intf_VLCWrapper::maxvolume() { -/* - if( p_aout_bank->i_count > 0 - && p_aout_bank->pp_aout[0] != NULL ) + p_intf->p_sys->p_aout = + (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_intf->p_sys->p_aout != NULL ) { - if( p_main->p_intf->p_sys->b_mute ) + if( p_intf->p_sys->b_mute ) { - p_main->p_intf->p_sys->i_saved_volume = VOLUME_MAX; + p_intf->p_sys->i_saved_volume = AOUT_VOLUME_MAX; } else { - p_aout_bank->pp_aout[0]->i_volume = VOLUME_MAX; + p_intf->p_sys->p_aout->output.i_volume = AOUT_VOLUME_MAX; } } -*/ } bool Intf_VLCWrapper::has_audio() { - /* return (p_aout_bank->i_count > 0); */ + p_intf->p_sys->p_aout = + (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + return( p_intf->p_sys->p_aout != NULL ); } //void Intf_VLCWrapper::fullscreen() @@ -668,10 +663,10 @@ void Intf_VLCWrapper::setTimeAsFloat(float f_position) } } -bool Intf_VLCWrapper::playlistPlaying() +/* bool Intf_VLCWrapper::playlistPlaying() { - /* return( !p_main->p_playlist->b_stopped ); */ -} + return( !p_intf->p_sys->p_playlist->b_stopped ); +} */ BList *Intf_VLCWrapper::playlistAsArray() { @@ -698,9 +693,7 @@ BList *Intf_VLCWrapper::playlistAsArray() void Intf_VLCWrapper::openFiles( BList* o_files, bool replace ) { BString *o_file; - playlist_t *p_playlist = - (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); + playlist_t *p_playlist = p_intf->p_sys->p_playlist; while( ( o_file = (BString *)o_files->LastItem() ) ) { diff --git a/modules/gui/beos/VlcWrapper.h b/modules/gui/beos/VlcWrapper.h index 82f8f253fef5..64f34d3025e5 100644 --- a/modules/gui/beos/VlcWrapper.h +++ b/modules/gui/beos/VlcWrapper.h @@ -2,7 +2,7 @@ * intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port ) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: VlcWrapper.h,v 1.2 2002/09/30 18:30:27 titer Exp $ + * $Id: VlcWrapper.h,v 1.3 2002/10/10 23:11:52 titer Exp $ * * Authors: Florian G. Pflug <fgp@phlo.org> * Jon Lech Johansen <jon-vl@nanocrew.net> @@ -24,6 +24,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ class InterfaceWindow; +class Intf_VLCWrapper; /***************************************************************************** * intf_sys_t: description and status of FB interface @@ -33,8 +34,9 @@ struct intf_sys_t InterfaceWindow * p_window; char i_key; - /* The input thread */ - input_thread_t * p_input; + input_thread_t * p_input; + playlist_t * p_playlist; + aout_instance_t * p_aout; /* DVD mode */ vlc_bool_t b_disabled_menus; @@ -43,6 +45,8 @@ struct intf_sys_t int i_part; int i_saved_volume; int i_channel; + + Intf_VLCWrapper * p_vlc_wrapper; }; /* Intf_VLCWrapper is a singleton class @@ -143,8 +147,8 @@ public: void loop(); //private: - Intf_VLCWrapper( intf_thread_t *p_if ); - es_descriptor_t * p_audio_es; + Intf_VLCWrapper( intf_thread_t *p_intf ); + es_descriptor_t * p_audio_es; intf_thread_t *p_intf; }; -- GitLab