Commit c5bd872c authored by Eric Petit's avatar Eric Petit

Some clean-up. Playlist works again.

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