Commit 3436a50b authored by Eric Petit's avatar Eric Petit

* ALL: more intensive use of the VLCWrapper class

 * PreferencesWindow.*: renamed a few variables (using some of the
   OpenTracker conventions)
 * clean up
parent d6b20103
...@@ -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.4 2002/10/30 06:12:27 titer Exp $ * $Id: Interface.cpp,v 1.5 2002/11/26 01:06:08 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>
...@@ -72,12 +72,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -72,12 +72,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
return( 1 ); return( 1 );
} }
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_wrapper = new Intf_VLCWrapper( p_intf );
p_intf->p_sys->p_aout = NULL;
p_intf->p_sys->p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
p_intf->p_sys->p_vlc_wrapper = new Intf_VLCWrapper( p_intf );
p_intf->pf_run = Run; p_intf->pf_run = Run;
...@@ -110,26 +105,12 @@ void E_(CloseIntf) ( vlc_object_t *p_this ) ...@@ -110,26 +105,12 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
{ {
intf_thread_t *p_intf = (intf_thread_t*) p_this; intf_thread_t *p_intf = (intf_thread_t*) p_this;
if( p_intf->p_sys->p_input )
{
vlc_object_release( p_intf->p_sys->p_input );
}
if( p_intf->p_sys->p_playlist )
{
vlc_object_release( p_intf->p_sys->p_playlist );
}
if( p_intf->p_sys->p_aout )
{
vlc_object_release( p_intf->p_sys->p_aout );
}
/* Destroy the interface window */ /* Destroy the interface window */
p_intf->p_sys->p_window->Lock(); p_intf->p_sys->p_window->Lock();
p_intf->p_sys->p_window->Quit(); p_intf->p_sys->p_window->Quit();
/* Destroy structure */ /* Destroy structure */
delete p_intf->p_sys->p_wrapper;
free( p_intf->p_sys ); free( p_intf->p_sys );
} }
...@@ -141,33 +122,8 @@ static void Run( intf_thread_t *p_intf ) ...@@ -141,33 +122,8 @@ 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 ) if( p_intf->p_sys->p_wrapper->UpdateInputAndAOut() )
{
p_intf->p_sys->p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
}
if( p_intf->p_sys->p_aout == NULL )
{
p_intf->p_sys->p_aout =
(aout_instance_t*)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
}
/* Update the input */
if( p_intf->p_sys->p_input != NULL )
{ {
if( p_intf->p_sys->p_input->b_dead )
{
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
if( p_intf->p_sys->p_aout )
{
vlc_object_release( p_intf->p_sys->p_aout );
p_intf->p_sys->p_aout = NULL;
}
}
/* Manage the slider */ /* Manage the slider */
p_intf->p_sys->p_window->updateInterface(); p_intf->p_sys->p_window->updateInterface();
} }
......
...@@ -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.8 2002/11/23 15:00:54 titer Exp $ * $Id: InterfaceWindow.cpp,v 1.9 2002/11/26 01:06:08 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>
...@@ -43,11 +43,11 @@ ...@@ -43,11 +43,11 @@
#include <vlc/intf.h> #include <vlc/intf.h>
/* BeOS interface headers */ /* BeOS interface headers */
#include "VlcWrapper.h"
#include "MsgVals.h" #include "MsgVals.h"
#include "MediaControlView.h" #include "MediaControlView.h"
#include "PlayListWindow.h" #include "PlayListWindow.h"
#include "PreferencesWindow.h" #include "PreferencesWindow.h"
#include "VlcWrapper.h"
#include "InterfaceWindow.h" #include "InterfaceWindow.h"
#define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps #define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps
...@@ -62,19 +62,17 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -62,19 +62,17 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
: BWindow( frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, : BWindow( frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ), B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
p_intf( p_interface ), p_intf( p_interface ),
fInputThread( NULL ),
fFilePanel( NULL ), fFilePanel( NULL ),
fLastUpdateTime( system_time() ), fLastUpdateTime( system_time() ),
fSettings( new BMessage( 'sett' ) ) fSettings( new BMessage( 'sett' ) )
{ {
p_intf = p_interface; p_intf = p_interface;
playlist_t *p_playlist = p_intf->p_sys->p_playlist; p_wrapper = p_intf->p_sys->p_wrapper;
fPlaylistIsEmpty = (p_playlist->i_size < 0); fPlaylistIsEmpty = ( p_wrapper->PlaylistSize() < 0 );
fPlaylistWindow = new PlayListWindow( BRect( 100.0, 100.0, 400.0, 350.0 ), fPlaylistWindow = new PlayListWindow( BRect( 100.0, 100.0, 400.0, 350.0 ),
"Playlist", "Playlist",
p_playlist,
this, this,
p_intf ); p_intf );
BScreen *p_screen = new BScreen(); BScreen *p_screen = new BScreen();
...@@ -214,7 +212,7 @@ InterfaceWindow::FrameResized(float width, float height) ...@@ -214,7 +212,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_intf->p_sys->p_vlc_wrapper->inputGetStatus(); playback_status = p_wrapper->inputGetStatus();
switch( p_message->what ) switch( p_message->what )
{ {
...@@ -256,7 +254,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -256,7 +254,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_intf->p_sys->p_vlc_wrapper->openDisc( type, device, 0, 0 ); p_wrapper->openDisc( type, device, 0, 0 );
} }
_UpdatePlaylist(); _UpdatePlaylist();
} }
...@@ -266,9 +264,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -266,9 +264,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_intf->p_sys->p_vlc_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playlistStop(); p_wrapper->playlistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
} }
break; break;
...@@ -283,20 +281,20 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -283,20 +281,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_intf->p_sys->p_vlc_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playlistPause(); p_wrapper->playlistPause();
} }
else else
{ {
p_intf->p_sys->p_vlc_wrapper->volume_restore(); p_wrapper->volume_restore();
p_intf->p_sys->p_vlc_wrapper->playlistPlay(); p_wrapper->playlistPlay();
} }
} }
else else
{ {
/* Play a new file */ /* Play a new file */
p_intf->p_sys->p_vlc_wrapper->playlistPlay(); p_wrapper->playlistPlay();
} }
break; break;
...@@ -304,9 +302,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -304,9 +302,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_intf->p_sys->p_vlc_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playFaster(); p_wrapper->playFaster();
} }
break; break;
...@@ -314,9 +312,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -314,9 +312,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_intf->p_sys->p_vlc_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playSlower(); p_wrapper->playSlower();
} }
break; break;
...@@ -324,8 +322,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -324,8 +322,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_intf->p_sys->p_vlc_wrapper->volume_restore(); p_wrapper->volume_restore();
p_intf->p_sys->p_vlc_wrapper->playlistPlay(); p_wrapper->playlistPlay();
} }
break; break;
...@@ -337,15 +335,15 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -337,15 +335,15 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
/* adjust the volume */ /* adjust the volume */
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
p_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); p_wrapper->set_volume( p_mediaControl->GetVolume() );
p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() ); p_mediaControl->SetMuted( p_wrapper->is_muted() );
} }
break; break;
case VOLUME_MUTE: case VOLUME_MUTE:
// toggle muting // toggle muting
p_intf->p_sys->p_vlc_wrapper->toggle_mute(); p_wrapper->toggle_mute();
p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() ); p_mediaControl->SetMuted( p_wrapper->is_muted() );
break; break;
case SELECT_CHANNEL: case SELECT_CHANNEL:
...@@ -354,14 +352,14 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -354,14 +352,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_intf->p_sys->p_vlc_wrapper->toggleLanguage( channel ); p_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_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); p_wrapper->set_volume( p_mediaControl->GetVolume() );
} }
} }
break; break;
...@@ -371,33 +369,19 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -371,33 +369,19 @@ 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_intf->p_sys->p_vlc_wrapper->toggleSubtitle( subtitle ); p_wrapper->toggleSubtitle( subtitle );
} }
break; break;
// specific navigation messages // specific navigation messages
case PREV_TITLE: case PREV_TITLE:
{ {
int i_id; p_wrapper->PrevTitle();
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id - 1;
/* Disallow area 0 since it is used for video_ts.vob */
if( i_id > 0 )
{
p_intf->p_sys->p_vlc_wrapper->toggleTitle(i_id);
}
break; break;
} }
case NEXT_TITLE: case NEXT_TITLE:
{ {
int i_id; p_wrapper->NextTitle();
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id + 1;
if( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{
p_intf->p_sys->p_vlc_wrapper->toggleTitle(i_id);
}
break; break;
} }
case TOGGLE_TITLE: case TOGGLE_TITLE:
...@@ -405,31 +389,17 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -405,31 +389,17 @@ 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_intf->p_sys->p_vlc_wrapper->toggleTitle( index ); p_wrapper->toggleTitle( index );
} }
break; break;
case PREV_CHAPTER: case PREV_CHAPTER:
{ {
int i_id; p_wrapper->PrevChapter();
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_part - 1;
if( i_id >= 0 )
{
p_intf->p_sys->p_vlc_wrapper->toggleChapter(i_id);
}
break; break;
} }
case NEXT_CHAPTER: case NEXT_CHAPTER:
{ {
int i_id; p_wrapper->NextChapter();
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_part + 1;
if( i_id >= 0 )
{
p_intf->p_sys->p_vlc_wrapper->toggleChapter(i_id);
}
break; break;
} }
case TOGGLE_CHAPTER: case TOGGLE_CHAPTER:
...@@ -437,21 +407,21 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -437,21 +407,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_intf->p_sys->p_vlc_wrapper->toggleChapter( index ); p_wrapper->toggleChapter( index );
} }
break; break;
case PREV_FILE: case PREV_FILE:
p_intf->p_sys->p_vlc_wrapper->playlistPrev(); p_wrapper->playlistPrev();
break; break;
case NEXT_FILE: case NEXT_FILE:
p_intf->p_sys->p_vlc_wrapper->playlistNext(); p_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_intf->p_sys->p_vlc_wrapper->navigatePrev(); p_wrapper->navigatePrev();
break; break;
case NAVIGATE_NEXT: case NAVIGATE_NEXT:
p_intf->p_sys->p_vlc_wrapper->navigateNext(); p_wrapper->navigateNext();
break; break;
// drag'n'drop and system messages // drag'n'drop and system messages
case B_REFS_RECEIVED: case B_REFS_RECEIVED:
...@@ -473,7 +443,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -473,7 +443,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_intf->p_sys->p_vlc_wrapper->openFiles(&files, replace); p_wrapper->openFiles(&files, replace);
_UpdatePlaylist(); _UpdatePlaylist();
} }
break; break;
...@@ -501,13 +471,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -501,13 +471,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
*****************************************************************************/ *****************************************************************************/
bool InterfaceWindow::QuitRequested() bool InterfaceWindow::QuitRequested()
{ {
if (p_intf->p_sys->p_input) p_wrapper->playlistStop();
{ p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
p_intf->p_sys->p_vlc_wrapper->volume_mute();
snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playlistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
}
p_intf->b_die = 1; p_intf->b_die = 1;
...@@ -521,44 +486,37 @@ bool InterfaceWindow::QuitRequested() ...@@ -521,44 +486,37 @@ bool InterfaceWindow::QuitRequested()
*****************************************************************************/ *****************************************************************************/
void InterfaceWindow::updateInterface() void InterfaceWindow::updateInterface()
{ {
input_thread_t* input = p_intf->p_sys->p_input; if( /* has_input */ true )
if ( input ) {
{
if ( acquire_sem( p_mediaControl->fScrubSem ) == B_OK ) if ( acquire_sem( p_mediaControl->fScrubSem ) == B_OK )
{ {
p_intf->p_sys->p_vlc_wrapper->setTimeAsFloat(p_mediaControl->GetSeekTo()); p_wrapper->setTimeAsFloat(p_mediaControl->GetSeekTo());
} }
else if ( Lock() ) else if ( Lock() )
{ {
bool hasTitles = input->stream.i_area_nb > 1; bool hasTitles = p_wrapper->HasTitles();
bool hasChapters = input->stream.p_selected_area->i_part_nb > 1; bool hasChapters = p_wrapper->HasChapters();
p_mediaControl->SetStatus( input->stream.control.i_status, p_mediaControl->SetStatus( p_wrapper->InputStatus(),
input->stream.control.i_rate ); p_wrapper->InputRate() );
p_mediaControl->SetProgress( input->stream.p_selected_area->i_tell, p_mediaControl->SetProgress( p_wrapper->InputTell(),
input->stream.p_selected_area->i_size ); p_wrapper->InputSize() );
_SetMenusEnabled( true, hasChapters, hasTitles ); _SetMenusEnabled( true, hasChapters, hasTitles );
_UpdateSpeedMenu( input->stream.control.i_rate ); _UpdateSpeedMenu( p_wrapper->InputRate() );
// enable/disable skip buttons // enable/disable skip buttons
bool canSkipPrev; bool canSkipPrev;
bool canSkipNext; bool canSkipNext;
p_intf->p_sys->p_vlc_wrapper->getNavCapabilities( &canSkipPrev, &canSkipNext ); p_wrapper->getNavCapabilities( &canSkipPrev, &canSkipNext );
p_mediaControl->SetSkippable( canSkipPrev, canSkipNext ); p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );
if ( p_intf->p_sys->p_vlc_wrapper->has_audio() ) if ( p_wrapper->has_audio() )
{ {
p_mediaControl->SetAudioEnabled( true ); p_mediaControl->SetAudioEnabled( true );
p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() ); p_mediaControl->SetMuted( p_wrapper->is_muted() );
} else } else
p_mediaControl->SetAudioEnabled( false ); p_mediaControl->SetAudioEnabled( false );
if ( input != fInputThread )
{
fInputThread = input;
_InputStreamChanged();
}
Unlock(); Unlock();
} }
// update playlist as well // update playlist as well
...@@ -568,22 +526,15 @@ void InterfaceWindow::updateInterface() ...@@ -568,22 +526,15 @@ void InterfaceWindow::updateInterface()
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
} }
} }
else
_SetMenusEnabled(false);
playlist_t *p_playlist = p_intf->p_sys->p_playlist; else
_SetMenusEnabled(false);
if ( fPlaylistIsEmpty != ( p_playlist->i_size < 0) )
if ( Lock() )
{ {
if ( Lock() ) p_mediaControl->SetEnabled( p_wrapper->PlaylistSize() );
{ Unlock();
fPlaylistIsEmpty = !fPlaylistIsEmpty;
p_mediaControl->SetEnabled( !fPlaylistIsEmpty );
Unlock();
}
} }
if ( input != fInputThread )
fInputThread = input;
fLastUpdateTime = system_time(); fLastUpdateTime = system_time();
} }
...@@ -607,9 +558,7 @@ InterfaceWindow::_UpdatePlaylist() ...@@ -607,9 +558,7 @@ InterfaceWindow::_UpdatePlaylist()
{ {
fPlaylistWindow->UpdatePlaylist( true ); fPlaylistWindow->UpdatePlaylist( true );
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
playlist_t *p_playlist = p_intf->p_sys->p_playlist; p_mediaControl->SetEnabled( p_wrapper->PlaylistSize() );
fPlaylistIsEmpty = p_playlist->i_size < 1;
p_mediaControl->SetEnabled( !fPlaylistIsEmpty );
} }
} }
...@@ -684,7 +633,7 @@ InterfaceWindow::_InputStreamChanged() ...@@ -684,7 +633,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_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() ); p_wrapper->set_volume( p_mediaControl->GetVolume() );
} }
/***************************************************************************** /*****************************************************************************
...@@ -1005,6 +954,7 @@ void LanguageMenu::_GetChannels() ...@@ -1005,6 +954,7 @@ void LanguageMenu::_GetChannels()
menu_item->SetMarked( true ); menu_item->SetMarked( true );
} }
#if 0
input_thread_t* input = p_intf->p_sys->p_input; input_thread_t* input = p_intf->p_sys->p_input;
if ( input ) if ( input )
{ {
...@@ -1060,6 +1010,7 @@ void LanguageMenu::_GetChannels() ...@@ -1060,6 +1010,7 @@ void LanguageMenu::_GetChannels()
if ( ( emptyItemAdded || kind != AUDIO_ES ) && addedItems > 1 ) if ( ( emptyItemAdded || kind != AUDIO_ES ) && addedItems > 1 )
AddItem( new BSeparatorItem(), 1 ); AddItem( new BSeparatorItem(), 1 );
} }
#endif
} }
...@@ -1089,6 +1040,7 @@ void TitleMenu::AttachedToWindow() ...@@ -1089,6 +1040,7 @@ void TitleMenu::AttachedToWindow()
while ( BMenuItem* item = RemoveItem( 0L ) ) while ( BMenuItem* item = RemoveItem( 0L ) )
delete item; delete item;
#if 0
input_thread_t* input = p_intf->p_sys->p_input; input_thread_t* input = p_intf->p_sys->p_input;
if ( input ) if ( input )
{ {
...@@ -1113,6 +1065,7 @@ void TitleMenu::AttachedToWindow() ...@@ -1113,6 +1065,7 @@ void TitleMenu::AttachedToWindow()
// done messing with stream // done messing with stream
vlc_mutex_unlock( &input->stream.stream_lock ); vlc_mutex_unlock( &input->stream.stream_lock );
} }
#endif
BMenu::AttachedToWindow(); BMenu::AttachedToWindow();
} }
...@@ -1142,6 +1095,7 @@ void ChapterMenu::AttachedToWindow() ...@@ -1142,6 +1095,7 @@ void ChapterMenu::AttachedToWindow()
while ( BMenuItem* item = RemoveItem( 0L ) ) while ( BMenuItem* item = RemoveItem( 0L ) )
delete item; delete item;
#if 0
input_thread_t* input = p_intf->p_sys->p_input; input_thread_t* input = p_intf->p_sys->p_input;
if ( input ) if ( input )
{ {
...@@ -1166,5 +1120,6 @@ void ChapterMenu::AttachedToWindow() ...@@ -1166,5 +1120,6 @@ void ChapterMenu::AttachedToWindow()
vlc_mutex_unlock( &input->stream.stream_lock ); vlc_mutex_unlock( &input->stream.stream_lock );
} }
BMenu::AttachedToWindow(); BMenu::AttachedToWindow();
#endif
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype * InterfaceWindow.h: BeOS interface window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.4 2002/10/30 00:59:21 titer Exp $ * $Id: InterfaceWindow.h,v 1.5 2002/11/26 01:06:08 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>
...@@ -125,7 +125,6 @@ class InterfaceWindow : public BWindow ...@@ -125,7 +125,6 @@ class InterfaceWindow : public BWindow
intf_thread_t* p_intf; intf_thread_t* p_intf;
es_descriptor_t* p_spu_es; es_descriptor_t* p_spu_es;
input_thread_t* fInputThread;
bool fPlaylistIsEmpty; bool fPlaylistIsEmpty;
BFilePanel* fFilePanel; BFilePanel* fFilePanel;
...@@ -153,7 +152,7 @@ class InterfaceWindow : public BWindow ...@@ -153,7 +152,7 @@ class InterfaceWindow : public BWindow
BMessage* fSettings; // we keep the message arround BMessage* fSettings; // we keep the message arround
// for forward compatibility // for forward compatibility
Intf_VLCWrapper * p_vlc_wrapper; Intf_VLCWrapper * p_wrapper;
}; };
#endif // BEOS_INTERFACE_WINDOW_H #endif // BEOS_INTERFACE_WINDOW_H
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* MediaControlView.cpp: beos interface * MediaControlView.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MediaControlView.cpp,v 1.6 2002/10/29 17:33:11 titer Exp $ * $Id: MediaControlView.cpp,v 1.7 2002/11/26 01:06:08 titer Exp $
* *
* Authors: Tony Castley <tony@castley.net> * Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com> * Stephan Aßmus <stippi@yellowbites.com>
...@@ -1307,13 +1307,13 @@ PositionInfoView::Pulse() ...@@ -1307,13 +1307,13 @@ PositionInfoView::Pulse()
if ( now - fLastPulseUpdate > 900000 ) if ( now - fLastPulseUpdate > 900000 )
{ {
int32 index, size; int32 index, size;
p_intf->p_sys->p_vlc_wrapper->getPlaylistInfo( index, size ); p_intf->p_sys->p_wrapper->getPlaylistInfo( index, size );
SetFile( index, size ); SetFile( index, size );
p_intf->p_sys->p_vlc_wrapper->getTitleInfo( index, size ); p_intf->p_sys->p_wrapper->getTitleInfo( index, size );
SetTitle( index, size ); SetTitle( index, size );
p_intf->p_sys->p_vlc_wrapper->getChapterInfo( index, size ); p_intf->p_sys->p_wrapper->getChapterInfo( index, size );
SetChapter( index, size ); SetChapter( index, size );
SetTime( p_intf->p_sys->p_vlc_wrapper->getTimeAsString() ); SetTime( p_intf->p_sys->p_wrapper->getTimeAsString() );
fLastPulseUpdate = now; fLastPulseUpdate = now;
} }
} }
......
...@@ -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.3 2002/10/10 23:11:52 titer Exp $ * $Id: PlayListWindow.cpp,v 1.4 2002/11/26 01:06:08 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>
...@@ -57,15 +57,15 @@ enum ...@@ -57,15 +57,15 @@ enum
* PlayListWindow::PlayListWindow * PlayListWindow::PlayListWindow
*****************************************************************************/ *****************************************************************************/
PlayListWindow::PlayListWindow( BRect frame, const char* name, PlayListWindow::PlayListWindow( BRect frame, const char* name,
playlist_t *playlist,
InterfaceWindow* mainWindow, InterfaceWindow* mainWindow,
intf_thread_t *p_interface ) 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 ),
fMainWindow( mainWindow ) fMainWindow( mainWindow )
{ {
this->p_intf = p_interface; p_intf = p_interface;
p_wrapper = p_intf->p_sys->p_wrapper;
SetName( "playlist" ); SetName( "playlist" );
// set up the main menu bar // set up the main menu bar
...@@ -242,9 +242,9 @@ PlayListWindow::UpdatePlaylist( bool rebuild ) ...@@ -242,9 +242,9 @@ PlayListWindow::UpdatePlaylist( bool rebuild )
delete item; delete item;
// 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 < p_wrapper->PlaylistSize(); i++ )
fListView->AddItem( new PlaylistItem( fPlaylist->pp_items[i]->psz_name ) ); fListView->AddItem( new PlaylistItem( p_wrapper->PlaylistItemName( i ) ) );
} }
fListView->SetCurrent( fPlaylist->i_index ); fListView->SetCurrent( p_wrapper->PlaylistCurrent() );
fListView->SetPlaying( p_intf->p_sys->p_vlc_wrapper->is_playing() ); fListView->SetPlaying( p_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.3 2002/10/10 23:11:52 titer Exp $ * $Id: PlayListWindow.h,v 1.4 2002/11/26 01:06:08 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>
...@@ -39,7 +39,6 @@ class PlayListWindow : public BWindow ...@@ -39,7 +39,6 @@ class PlayListWindow : public BWindow
public: public:
PlayListWindow(BRect frame, PlayListWindow(BRect frame,
const char* name, const char* name,
playlist_t* playlist,
InterfaceWindow* mainWindow, InterfaceWindow* mainWindow,
intf_thread_t *p_interface ); intf_thread_t *p_interface );
virtual ~PlayListWindow(); virtual ~PlayListWindow();
...@@ -54,14 +53,13 @@ class PlayListWindow : public BWindow ...@@ -54,14 +53,13 @@ class PlayListWindow : public BWindow
void UpdatePlaylist( bool rebuild = false ); void UpdatePlaylist( bool rebuild = false );
private: private:
playlist_t * fPlaylist;
PlaylistView * fListView; PlaylistView * fListView;
BView * fBackgroundView; BView * fBackgroundView;
BMenuBar * fMenuBar; BMenuBar * fMenuBar;
InterfaceWindow * fMainWindow; InterfaceWindow * fMainWindow;
intf_thread_t * p_intf; intf_thread_t * p_intf;
Intf_VLCWrapper * p_wrapper;
}; };
#endif // BEOS_PLAY_LIST_WINDOW_H #endif // BEOS_PLAY_LIST_WINDOW_H
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface * PreferencesWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.2 2002/11/23 15:00:54 titer Exp $ * $Id: PreferencesWindow.cpp,v 1.3 2002/11/26 01:06:08 titer Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -46,105 +46,105 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name, ...@@ -46,105 +46,105 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
BRect rect; BRect rect;
/* "background" view */ /* "background" view */
p_prefs_view = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW ); fPrefsView = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
p_prefs_view->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) ); fPrefsView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
AddChild( p_prefs_view ); AddChild( fPrefsView );
/* add the tabs */ /* add the tabs */
rect = Bounds(); rect = Bounds();
rect.top += 10; rect.top += 10;
rect.bottom -= 65; rect.bottom -= 65;
p_tabview = new BTabView( rect, "preferences view" ); fTabView = new BTabView( rect, "preferences view" );
p_tabview->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) ); fTabView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
p_ffmpeg_view = new BView( p_tabview->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW ); fFfmpegView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
p_ffmpeg_view->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) ); fFfmpegView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
p_adjust_view = new BView( p_tabview->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW ); fAdjustView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
p_adjust_view->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) ); fAdjustView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
p_ffmpeg_tab = new BTab(); fFfmpegTab = new BTab();
p_tabview->AddTab( p_ffmpeg_view, p_ffmpeg_tab ); fTabView->AddTab( fFfmpegView, fFfmpegTab );
p_ffmpeg_tab->SetLabel( "Ffmpeg" ); fFfmpegTab->SetLabel( "Ffmpeg" );
p_adjust_tab = new BTab(); fAdjustTab = new BTab();
p_tabview->AddTab( p_adjust_view, p_adjust_tab ); fTabView->AddTab( fAdjustView, fAdjustTab );
p_adjust_tab->SetLabel( "Adjust" ); fAdjustTab->SetLabel( "Adjust" );
/* fills the tabs */ /* fills the tabs */
/* ffmpeg tab */ /* ffmpeg tab */
rect = p_ffmpeg_view->Bounds(); rect = fFfmpegView->Bounds();
rect.InsetBy( 10, 10 ); rect.InsetBy( 10, 10 );
rect.bottom = rect.top + 30; rect.bottom = rect.top + 30;
p_pp_slider = new BSlider( rect, "post-processing", "MPEG4 post-processing level", fPpSlider = new BSlider( rect, "post-processing", "MPEG4 post-processing level",
new BMessage( SLIDER_UPDATE ), new BMessage( SLIDER_UPDATE ),
0, 6, B_TRIANGLE_THUMB, 0, 6, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW ); B_FOLLOW_LEFT, B_WILL_DRAW );
p_pp_slider->SetHashMarks(B_HASH_MARKS_BOTTOM); fPpSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
p_pp_slider->SetHashMarkCount( 7 ); fPpSlider->SetHashMarkCount( 7 );
p_pp_slider->SetLimitLabels( "None", "Maximum" ); fPpSlider->SetLimitLabels( "None", "Maximum" );
p_ffmpeg_view->AddChild( p_pp_slider ); fFfmpegView->AddChild( fPpSlider );
/* adjust tab */ /* adjust tab */
rect = p_adjust_view->Bounds(); rect = fAdjustView->Bounds();
rect.InsetBy( 10, 10 ); rect.InsetBy( 10, 10 );
rect.bottom = rect.top + 30; rect.bottom = rect.top + 30;
p_brightness_slider = new BSlider( rect, "brightness", "Brightness", fBrightnessSlider = new BSlider( rect, "brightness", "Brightness",
new BMessage( SLIDER_UPDATE ), new BMessage( SLIDER_UPDATE ),
0, 200, B_TRIANGLE_THUMB, 0, 200, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW ); B_FOLLOW_LEFT, B_WILL_DRAW );
p_brightness_slider->SetValue( 100 * config_GetFloat( p_intf, "Brightness" ) ); fBrightnessSlider->SetValue( 100 * config_GetFloat( p_intf, "Brightness" ) );
rect.OffsetBy( 0, 40 ); rect.OffsetBy( 0, 40 );
p_contrast_slider = new BSlider( rect, "contrast", "Contrast", fContrastSlider = new BSlider( rect, "contrast", "Contrast",
new BMessage( SLIDER_UPDATE ), new BMessage( SLIDER_UPDATE ),
0, 200, B_TRIANGLE_THUMB, 0, 200, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW ); B_FOLLOW_LEFT, B_WILL_DRAW );
p_contrast_slider->SetValue( 100 * config_GetFloat( p_intf, "Contrast" ) ); fContrastSlider->SetValue( 100 * config_GetFloat( p_intf, "Contrast" ) );
rect.OffsetBy( 0, 40 ); rect.OffsetBy( 0, 40 );
p_hue_slider = new BSlider( rect, "hue", "Hue", fHueSlider = new BSlider( rect, "hue", "Hue",
new BMessage( SLIDER_UPDATE ), new BMessage( SLIDER_UPDATE ),
0, 360, B_TRIANGLE_THUMB, 0, 360, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW ); B_FOLLOW_LEFT, B_WILL_DRAW );
p_hue_slider->SetValue( config_GetInt( p_intf, "Hue" ) ); fHueSlider->SetValue( config_GetInt( p_intf, "Hue" ) );
rect.OffsetBy( 0, 40 ); rect.OffsetBy( 0, 40 );
p_saturation_slider = new BSlider( rect, "saturation", "Saturation", fSaturationSlider = new BSlider( rect, "saturation", "Saturation",
new BMessage( SLIDER_UPDATE ), new BMessage( SLIDER_UPDATE ),
0, 200, B_TRIANGLE_THUMB, 0, 200, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW ); B_FOLLOW_LEFT, B_WILL_DRAW );
p_saturation_slider->SetValue( 100 * config_GetFloat( p_intf, "Saturation" ) ); fSaturationSlider->SetValue( 100 * config_GetFloat( p_intf, "Saturation" ) );
p_adjust_view->AddChild( p_brightness_slider ); fAdjustView->AddChild( fBrightnessSlider );
p_adjust_view->AddChild( p_contrast_slider ); fAdjustView->AddChild( fContrastSlider );
p_adjust_view->AddChild( p_hue_slider ); fAdjustView->AddChild( fHueSlider );
p_adjust_view->AddChild( p_saturation_slider ); fAdjustView->AddChild( fSaturationSlider );
p_prefs_view->AddChild( p_tabview ); fPrefsView->AddChild( fTabView );
/* restart message */ /* restart message */
rect = p_prefs_view->Bounds(); rect = fPrefsView->Bounds();
rect.bottom -= 43; rect.bottom -= 43;
rect.top = rect.bottom - 10; rect.top = rect.bottom - 10;
p_restart_string = new BStringView( rect, NULL, "" ); fRestartString = new BStringView( rect, NULL, "" );
rgb_color redColor = {255, 0, 0, 255}; rgb_color redColor = {255, 0, 0, 255};
p_restart_string->SetHighColor(redColor); fRestartString->SetHighColor(redColor);
p_restart_string->SetAlignment( B_ALIGN_CENTER ); fRestartString->SetAlignment( B_ALIGN_CENTER );
p_prefs_view->AddChild( p_restart_string ); fPrefsView->AddChild( fRestartString );
/* buttons */ /* buttons */
BButton *p_button; BButton *button;
rect = Bounds(); rect = Bounds();
rect.InsetBy( 10, 10 ); rect.InsetBy( 10, 10 );
rect.top = rect.bottom - 25; rect.top = rect.bottom - 25;
rect.left = rect.right - 80; rect.left = rect.right - 80;
p_button = new BButton( rect, NULL, "OK", new BMessage( PREFS_OK ) ); button = new BButton( rect, NULL, "OK", new BMessage( PREFS_OK ) );
p_prefs_view->AddChild( p_button ); fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 ); rect.OffsetBy( -90, 0 );
p_button = new BButton( rect, NULL, "Cancel", new BMessage( PREFS_CANCEL ) ); button = new BButton( rect, NULL, "Cancel", new BMessage( PREFS_CANCEL ) );
p_prefs_view->AddChild( p_button ); fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 ); rect.OffsetBy( -90, 0 );
p_button = new BButton( rect, NULL, "Defaults", new BMessage( PREFS_DEFAULTS ) ); button = new BButton( rect, NULL, "Defaults", new BMessage( PREFS_DEFAULTS ) );
p_prefs_view->AddChild( p_button ); fPrefsView->AddChild( button );
// start window thread in hidden state // start window thread in hidden state
Hide(); Hide();
...@@ -177,7 +177,7 @@ void PreferencesWindow::MessageReceived( BMessage * p_message ) ...@@ -177,7 +177,7 @@ void PreferencesWindow::MessageReceived( BMessage * p_message )
} }
case PREFS_OK: case PREFS_OK:
{ {
config_PutInt( p_intf, "ffmpeg-pp-q", p_pp_slider->Value() ); config_PutInt( p_intf, "ffmpeg-pp-q", fPpSlider->Value() );
config_PutPsz( p_intf, "filter", "adjust" ); config_PutPsz( p_intf, "filter", "adjust" );
ApplyChanges(); ApplyChanges();
Hide(); Hide();
...@@ -202,13 +202,13 @@ void PreferencesWindow::ReallyQuit() ...@@ -202,13 +202,13 @@ void PreferencesWindow::ReallyQuit()
*****************************************************************************/ *****************************************************************************/
void PreferencesWindow::SetDefaults() void PreferencesWindow::SetDefaults()
{ {
p_pp_slider->SetValue( 0 ); fPpSlider->SetValue( 0 );
p_brightness_slider->SetValue( 100 ); fBrightnessSlider->SetValue( 100 );
p_contrast_slider->SetValue( 100 ); fContrastSlider->SetValue( 100 );
p_hue_slider->SetValue( 0 ); fHueSlider->SetValue( 0 );
p_saturation_slider->SetValue( 100 ); fSaturationSlider->SetValue( 100 );
p_restart_string->SetText( config_GetInt( p_intf, "ffmpeg-pp-q" ) ? fRestartString->SetText( config_GetInt( p_intf, "ffmpeg-pp-q" ) ?
"Changes will take effect after you restart playback" : "" ); "Changes will take effect after you restart playback" : "" );
config_PutPsz( p_intf, "filter", NULL ); config_PutPsz( p_intf, "filter", NULL );
...@@ -226,29 +226,29 @@ void PreferencesWindow::ApplyChanges() ...@@ -226,29 +226,29 @@ void PreferencesWindow::ApplyChanges()
if( ( !config_GetPsz( p_intf, "filter" ) || if( ( !config_GetPsz( p_intf, "filter" ) ||
strncmp( config_GetPsz( p_intf, "filter" ), "adjust", 6 ) ) && strncmp( config_GetPsz( p_intf, "filter" ), "adjust", 6 ) ) &&
( p_brightness_slider->Value() != 100 || ( fBrightnessSlider->Value() != 100 ||
p_contrast_slider->Value() != 100 || fContrastSlider->Value() != 100 ||
p_hue_slider->Value() || fHueSlider->Value() ||
p_saturation_slider->Value() != 100 ) ) fSaturationSlider->Value() != 100 ) )
{ {
b_restart_needed = true; b_restart_needed = true;
} }
if( p_pp_slider->Value() != config_GetInt( p_intf, "ffmpeg-pp-q" ) ) if( fPpSlider->Value() != config_GetInt( p_intf, "ffmpeg-pp-q" ) )
{ {
b_restart_needed = true; b_restart_needed = true;
} }
config_PutFloat( p_intf, "Brightness", config_PutFloat( p_intf, "Brightness",
(float)p_brightness_slider->Value() / 100 ); (float)fBrightnessSlider->Value() / 100 );
config_PutFloat( p_intf, "Contrast", config_PutFloat( p_intf, "Contrast",
(float)p_contrast_slider->Value() / 100 ); (float)fContrastSlider->Value() / 100 );
config_PutInt( p_intf, "Hue", p_hue_slider->Value() ); config_PutInt( p_intf, "Hue", fHueSlider->Value() );
config_PutFloat( p_intf, "Saturation", config_PutFloat( p_intf, "Saturation",
(float)p_saturation_slider->Value() / 100 ); (float)fSaturationSlider->Value() / 100 );
p_restart_string->LockLooper(); fRestartString->LockLooper();
p_restart_string->SetText( b_restart_needed ? fRestartString->SetText( b_restart_needed ?
"Changes will take effect after you restart playback" : "" ); "Changes will take effect after you restart playback" : "" );
p_restart_string->UnlockLooper(); fRestartString->UnlockLooper();
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.h * PreferencesWindow.h
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.2 2002/11/23 15:00:54 titer Exp $ * $Id: PreferencesWindow.h,v 1.3 2002/11/26 01:06:08 titer Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -47,18 +47,18 @@ class PreferencesWindow : public BWindow ...@@ -47,18 +47,18 @@ class PreferencesWindow : public BWindow
private: private:
void SetDefaults(); void SetDefaults();
void ApplyChanges(); void ApplyChanges();
BView * p_prefs_view; BView * fPrefsView;
BTabView * p_tabview; BTabView * fTabView;
BView * p_ffmpeg_view; BView * fFfmpegView;
BView * p_adjust_view; BView * fAdjustView;
BTab * p_ffmpeg_tab; BTab * fFfmpegTab;
BTab * p_adjust_tab; BTab * fAdjustTab;
BSlider * p_pp_slider; BSlider * fPpSlider;
BSlider * p_contrast_slider; BSlider * fContrastSlider;
BSlider * p_brightness_slider; BSlider * fBrightnessSlider;
BSlider * p_hue_slider; BSlider * fHueSlider;
BSlider * p_saturation_slider; BSlider * fSaturationSlider;
BStringView * p_restart_string; BStringView * fRestartString;
intf_thread_t * p_intf; intf_thread_t * p_intf;
}; };
......
...@@ -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.10 2002/10/30 06:12:27 titer Exp $ * $Id: VlcWrapper.cpp,v 1.11 2002/11/26 01:06:08 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>
...@@ -34,20 +34,154 @@ ...@@ -34,20 +34,154 @@
#include "VlcWrapper.h" #include "VlcWrapper.h"
/* constructor */
Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_interface) Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_interface)
{ {
p_intf = p_interface; p_intf = p_interface;
p_input = NULL;
p_aout = NULL;
p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
} }
/* destructor */
Intf_VLCWrapper::~Intf_VLCWrapper() Intf_VLCWrapper::~Intf_VLCWrapper()
{ {
if( p_input )
{
vlc_object_release( p_input );
}
if( p_playlist )
{
vlc_object_release( p_playlist );
}
if( p_aout )
{
vlc_object_release( p_aout );
}
} }
/* UpdateInputAndAOut: updates p_input and p_aout, returns true if the
interface needs to be updated */
bool Intf_VLCWrapper::UpdateInputAndAOut()
{
if( p_input == NULL )
{
p_input = (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
}
if( p_aout == NULL )
{
p_aout = (aout_instance_t*)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
}
if( p_input != NULL )
{
if( p_input->b_dead )
{
vlc_object_release( p_input );
p_input = NULL;
if( p_aout )
{
vlc_object_release( p_aout );
p_aout = NULL;
}
}
return true;
}
return false;
}
int Intf_VLCWrapper::InputStatus()
{
return p_input->stream.control.i_status;
}
int Intf_VLCWrapper::InputRate()
{
return p_input->stream.control.i_rate;
}
int Intf_VLCWrapper::InputTell()
{
return p_input->stream.p_selected_area->i_tell;
}
int Intf_VLCWrapper::InputSize()
{
return p_input->stream.p_selected_area->i_size;
}
int Intf_VLCWrapper::PlaylistSize()
{
return p_playlist->i_size;
}
char *Intf_VLCWrapper::PlaylistItemName( int i )
{
return p_playlist->pp_items[i]->psz_name;
}
int Intf_VLCWrapper::PlaylistCurrent()
{
return p_playlist->i_index;
}
bool Intf_VLCWrapper::HasTitles()
{
return ( p_input->stream.i_area_nb > 1 );
}
void Intf_VLCWrapper::PrevTitle()
{
int i_id;
i_id = p_input->stream.p_selected_area->i_id - 1;
if( i_id > 0 )
{
toggleTitle(i_id);
}
}
void Intf_VLCWrapper::NextTitle()
{
int i_id;
i_id = p_input->stream.p_selected_area->i_id + 1;
if( i_id < p_input->stream.i_area_nb )
{
toggleTitle(i_id);
}
}
bool Intf_VLCWrapper::HasChapters()
{
return ( p_input->stream.p_selected_area->i_part_nb > 1 );
}
void Intf_VLCWrapper::PrevChapter()
{
int i_id;
i_id = p_input->stream.p_selected_area->i_part - 1;
if( i_id >= 0 )
{
toggleChapter(i_id);
}
}
void Intf_VLCWrapper::NextChapter()
{
int i_id;
i_id = p_input->stream.p_selected_area->i_part + 1;
if( i_id >= 0 )
{
toggleChapter(i_id);
}
}
/* playlist control */ /* playlist control */
bool Intf_VLCWrapper::playlistPlay() bool Intf_VLCWrapper::playlistPlay()
{ {
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size ) if( p_playlist->i_size )
{ {
...@@ -58,51 +192,41 @@ bool Intf_VLCWrapper::playlistPlay() ...@@ -58,51 +192,41 @@ bool Intf_VLCWrapper::playlistPlay()
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
} }
return( true ); return( true );
} }
void Intf_VLCWrapper::playlistPause() void Intf_VLCWrapper::playlistPause()
{ {
toggle_mute(); toggle_mute();
if( p_intf->p_sys->p_input ) if( p_input )
{ {
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE ); input_SetStatus( p_input, INPUT_STATUS_PAUSE );
} }
} }
void Intf_VLCWrapper::playlistStop() void Intf_VLCWrapper::playlistStop()
{ {
playlist_t *p_playlist = p_intf->p_sys->p_playlist; volume_mute();
playlist_Stop( p_playlist ); playlist_Stop( p_playlist );
} }
void Intf_VLCWrapper::playlistNext() void Intf_VLCWrapper::playlistNext()
{ {
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Next( p_playlist ); playlist_Next( p_playlist );
} }
void Intf_VLCWrapper::playlistPrev() void Intf_VLCWrapper::playlistPrev()
{ {
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Prev( p_playlist ); playlist_Prev( p_playlist );
} }
void Intf_VLCWrapper::playlistSkip(int i) void Intf_VLCWrapper::playlistSkip(int i)
{ {
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Skip( p_playlist, i ); playlist_Skip( p_playlist, i );
} }
void Intf_VLCWrapper::playlistGoto(int i) void Intf_VLCWrapper::playlistGoto(int i)
{ {
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Goto( p_playlist, i ); playlist_Goto( p_playlist, i );
} }
...@@ -132,7 +256,7 @@ void Intf_VLCWrapper::playlistJumpTo( int pos ) ...@@ -132,7 +256,7 @@ void Intf_VLCWrapper::playlistJumpTo( int pos )
int Intf_VLCWrapper::playlistCurrentPos() int Intf_VLCWrapper::playlistCurrentPos()
{ {
playlistLock(); playlistLock();
int pos = p_intf->p_sys->p_playlist->i_index; int pos = p_playlist->i_index;
playlistUnlock(); playlistUnlock();
return pos; return pos;
} }
...@@ -140,19 +264,19 @@ int Intf_VLCWrapper::playlistCurrentPos() ...@@ -140,19 +264,19 @@ int Intf_VLCWrapper::playlistCurrentPos()
int Intf_VLCWrapper::playlistSize() int Intf_VLCWrapper::playlistSize()
{ {
playlistLock(); playlistLock();
int size = p_intf->p_sys->p_playlist->i_size; int size = p_playlist->i_size;
playlistUnlock(); playlistUnlock();
return size; return size;
} }
void Intf_VLCWrapper::playlistLock() void Intf_VLCWrapper::playlistLock()
{ {
vlc_mutex_lock( &p_intf->p_sys->p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
} }
void Intf_VLCWrapper::playlistUnlock() void Intf_VLCWrapper::playlistUnlock()
{ {
vlc_mutex_unlock( &p_intf->p_sys->p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
} }
void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev, void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
...@@ -165,35 +289,34 @@ void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev, ...@@ -165,35 +289,34 @@ void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
*canSkipNext = false; *canSkipNext = false;
// get playlist info // get playlist info
playlistLock(); playlistLock();
int pos = p_intf->p_sys->p_playlist->i_index; int pos = p_playlist->i_index;
int size = p_intf->p_sys->p_playlist->i_size; int size = p_playlist->i_size;
playlistUnlock(); playlistUnlock();
/* 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 ( p_input )
{ {
vlc_mutex_lock( &input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
bool hasTitles = input->stream.i_area_nb > 1; bool hasTitles = p_input->stream.i_area_nb > 1;
int numChapters = input->stream.p_selected_area->i_part_nb; int numChapters = p_input->stream.p_selected_area->i_part_nb;
bool hasChapters = numChapters > 1; bool hasChapters = numChapters > 1;
// first, look for chapters // first, look for chapters
if ( hasChapters ) if ( hasChapters )
{ {
*canSkipPrev = input->stream.p_selected_area->i_part > 0; *canSkipPrev = p_input->stream.p_selected_area->i_part > 0;
*canSkipNext = input->stream.p_selected_area->i_part < *canSkipNext = p_input->stream.p_selected_area->i_part <
input->stream.p_selected_area->i_part_nb - 1; p_input->stream.p_selected_area->i_part_nb - 1;
} }
// if one of the skip capabilities is false, // if one of the skip capabilities is false,
// make it depend on titles instead // make it depend on titles instead
if ( !*canSkipPrev && hasTitles ) if ( !*canSkipPrev && hasTitles )
*canSkipPrev = input->stream.p_selected_area->i_id > 1; *canSkipPrev = p_input->stream.p_selected_area->i_id > 1;
if ( !*canSkipNext && hasTitles ) if ( !*canSkipNext && hasTitles )
*canSkipNext = input->stream.p_selected_area->i_id < input->stream.i_area_nb - 1; *canSkipNext = p_input->stream.p_selected_area->i_id <
p_input->stream.i_area_nb - 1;
vlc_mutex_unlock( &input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
// last but not least, make capabilities depend on playlist // last but not least, make capabilities depend on playlist
if ( !*canSkipPrev ) if ( !*canSkipPrev )
...@@ -349,12 +472,11 @@ void Intf_VLCWrapper::loop() ...@@ -349,12 +472,11 @@ void Intf_VLCWrapper::loop()
{ {
if ( p_intf->p_sys->b_loop ) if ( p_intf->p_sys->b_loop )
{ {
playlist_Delete( p_intf->p_sys->p_playlist, playlist_Delete( p_playlist, p_playlist->i_size - 1 );
p_intf->p_sys->p_playlist->i_size - 1 );
} }
else else
{ {
playlist_Add( p_intf->p_sys->p_playlist, "vlc:loop", playlist_Add( p_playlist, "vlc:loop",
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_APPEND | PLAYLIST_GO,
PLAYLIST_END ); PLAYLIST_END );
} }
...@@ -365,11 +487,11 @@ void Intf_VLCWrapper::loop() ...@@ -365,11 +487,11 @@ void Intf_VLCWrapper::loop()
/* playback control */ /* playback control */
void Intf_VLCWrapper::playSlower() void Intf_VLCWrapper::playSlower()
{ {
if( p_intf->p_sys->p_input != NULL ) if( p_input != NULL )
{ {
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER ); input_SetStatus( p_input, INPUT_STATUS_SLOWER );
} }
if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE) if( p_input->stream.control.i_rate == DEFAULT_RATE)
{ {
toggle_mute( ); toggle_mute( );
} }
...@@ -381,11 +503,11 @@ void Intf_VLCWrapper::playSlower() ...@@ -381,11 +503,11 @@ void Intf_VLCWrapper::playSlower()
void Intf_VLCWrapper::playFaster() void Intf_VLCWrapper::playFaster()
{ {
if( p_intf->p_sys->p_input != NULL ) if( p_input != NULL )
{ {
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER ); input_SetStatus( p_input, INPUT_STATUS_FASTER );
} }
if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE) if( p_input->stream.control.i_rate == DEFAULT_RATE)
{ {
toggle_mute( ); toggle_mute( );
} }
...@@ -397,12 +519,12 @@ void Intf_VLCWrapper::playFaster() ...@@ -397,12 +519,12 @@ void Intf_VLCWrapper::playFaster()
void Intf_VLCWrapper::volume_mute() void Intf_VLCWrapper::volume_mute()
{ {
if( p_intf->p_sys->p_aout != NULL ) if( p_aout != NULL )
{ {
if( !p_intf->p_sys->b_mute ) if( !p_intf->p_sys->b_mute )
{ {
p_intf->p_sys->i_saved_volume = p_intf->p_sys->p_aout->output.i_volume; p_intf->p_sys->i_saved_volume = p_aout->output.i_volume;
p_intf->p_sys->p_aout->output.i_volume = 0; p_aout->output.i_volume = 0;
p_intf->p_sys->b_mute = 1; p_intf->p_sys->b_mute = 1;
} }
} }
...@@ -411,9 +533,9 @@ void Intf_VLCWrapper::volume_mute() ...@@ -411,9 +533,9 @@ void Intf_VLCWrapper::volume_mute()
void Intf_VLCWrapper::volume_restore() void Intf_VLCWrapper::volume_restore()
{ {
if( p_intf->p_sys->p_aout != NULL ) if( p_aout != NULL )
{ {
p_intf->p_sys->p_aout->output.i_volume = p_intf->p_sys->i_saved_volume; p_aout->output.i_volume = p_intf->p_sys->i_saved_volume;
p_intf->p_sys->i_saved_volume = 0; p_intf->p_sys->i_saved_volume = 0;
p_intf->p_sys->b_mute = 0; p_intf->p_sys->b_mute = 0;
} }
...@@ -422,27 +544,27 @@ void Intf_VLCWrapper::volume_restore() ...@@ -422,27 +544,27 @@ void Intf_VLCWrapper::volume_restore()
void Intf_VLCWrapper::set_volume(int value) void Intf_VLCWrapper::set_volume(int value)
{ {
if( p_intf->p_sys->p_aout != NULL ) if( 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_intf->p_sys->p_aout->mixer_lock ); vlc_mutex_lock( &p_aout->mixer_lock );
// unmute volume if muted // unmute volume if muted
if ( p_intf->p_sys->b_mute ) if ( p_intf->p_sys->b_mute )
{ {
p_intf->p_sys->b_mute = 0; p_intf->p_sys->b_mute = 0;
p_intf->p_sys->p_aout->output.i_volume = value; p_aout->output.i_volume = value;
} }
vlc_mutex_unlock( &p_intf->p_sys->p_aout->mixer_lock ); vlc_mutex_unlock( &p_aout->mixer_lock );
} }
} }
void Intf_VLCWrapper::toggle_mute() void Intf_VLCWrapper::toggle_mute()
{ {
if( p_intf->p_sys->p_aout != NULL ) if( p_aout != NULL )
{ {
if ( p_intf->p_sys->b_mute ) if ( p_intf->p_sys->b_mute )
{ {
...@@ -459,14 +581,14 @@ bool Intf_VLCWrapper::is_muted() ...@@ -459,14 +581,14 @@ bool Intf_VLCWrapper::is_muted()
{ {
bool muted = true; bool muted = true;
if( p_intf->p_sys->p_aout != NULL ) if( p_aout != NULL )
{ {
vlc_mutex_lock( &p_intf->p_sys->p_aout->mixer_lock ); vlc_mutex_lock( &p_aout->mixer_lock );
if( p_intf->p_sys->p_aout->output.i_volume > 0 ) if( p_aout->output.i_volume > 0 )
{ {
muted = false; muted = false;
} }
vlc_mutex_unlock( &p_intf->p_sys->p_aout->mixer_lock ); vlc_mutex_unlock( &p_aout->mixer_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;
} }
...@@ -477,9 +599,9 @@ bool Intf_VLCWrapper::is_playing() ...@@ -477,9 +599,9 @@ bool Intf_VLCWrapper::is_playing()
{ {
bool playing = false; bool playing = false;
if ( p_intf->p_sys->p_input ) if ( p_input )
{ {
switch ( p_intf->p_sys->p_input->stream.control.i_status ) switch ( p_input->stream.control.i_status )
{ {
case PLAYING_S: case PLAYING_S:
case FORWARD_S: case FORWARD_S:
...@@ -500,7 +622,7 @@ bool Intf_VLCWrapper::is_playing() ...@@ -500,7 +622,7 @@ bool Intf_VLCWrapper::is_playing()
void Intf_VLCWrapper::maxvolume() void Intf_VLCWrapper::maxvolume()
{ {
if( p_intf->p_sys->p_aout != NULL ) if( p_aout != NULL )
{ {
if( p_intf->p_sys->b_mute ) if( p_intf->p_sys->b_mute )
{ {
...@@ -508,14 +630,14 @@ void Intf_VLCWrapper::maxvolume() ...@@ -508,14 +630,14 @@ void Intf_VLCWrapper::maxvolume()
} }
else else
{ {
p_intf->p_sys->p_aout->output.i_volume = AOUT_VOLUME_MAX; p_aout->output.i_volume = AOUT_VOLUME_MAX;
} }
} }
} }
bool Intf_VLCWrapper::has_audio() bool Intf_VLCWrapper::has_audio()
{ {
return( p_intf->p_sys->p_aout != NULL ); return( p_aout != NULL );
} }
/* playback info */ /* playback info */
...@@ -524,14 +646,14 @@ const char* Intf_VLCWrapper::getTimeAsString() ...@@ -524,14 +646,14 @@ const char* Intf_VLCWrapper::getTimeAsString()
{ {
static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ]; static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
if( p_intf->p_sys->p_input == NULL ) if( p_input == NULL )
{ {
return ("-:--:--"); return ("-:--:--");
} }
input_OffsetToTime( p_intf->p_sys->p_input, input_OffsetToTime( p_input,
psz_currenttime, psz_currenttime,
p_intf->p_sys->p_input->stream.p_selected_area->i_tell ); p_input->stream.p_selected_area->i_tell );
return(psz_currenttime); return(psz_currenttime);
} }
...@@ -540,10 +662,10 @@ float Intf_VLCWrapper::getTimeAsFloat() ...@@ -540,10 +662,10 @@ float Intf_VLCWrapper::getTimeAsFloat()
{ {
float f_time = 0.0; float f_time = 0.0;
if( p_intf->p_sys->p_input != NULL ) if( p_input != NULL )
{ {
f_time = (float)p_intf->p_sys->p_input->stream.p_selected_area->i_tell / f_time = (float)p_input->stream.p_selected_area->i_tell /
(float)p_intf->p_sys->p_input->stream.p_selected_area->i_size; (float)p_input->stream.p_selected_area->i_size;
} }
else else
{ {
...@@ -554,10 +676,10 @@ float Intf_VLCWrapper::getTimeAsFloat() ...@@ -554,10 +676,10 @@ float Intf_VLCWrapper::getTimeAsFloat()
void Intf_VLCWrapper::setTimeAsFloat(float f_position) void Intf_VLCWrapper::setTimeAsFloat(float f_position)
{ {
if( p_intf->p_sys->p_input != NULL ) if( p_input != NULL )
{ {
input_Seek( p_intf->p_sys->p_input, input_Seek( p_input,
(long long int)(p_intf->p_sys->p_input->stream.p_selected_area->i_size (long long int)(p_input->stream.p_selected_area->i_size
* f_position / SEEKSLIDER_RANGE ), * f_position / SEEKSLIDER_RANGE ),
INPUT_SEEK_SET); INPUT_SEEK_SET);
} }
...@@ -571,8 +693,6 @@ void Intf_VLCWrapper::setTimeAsFloat(float f_position) ...@@ -571,8 +693,6 @@ void Intf_VLCWrapper::setTimeAsFloat(float f_position)
BList *Intf_VLCWrapper::playlistAsArray() BList *Intf_VLCWrapper::playlistAsArray()
{ {
int i; int i;
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
BList* p_list = new BList(p_playlist->i_size); BList* p_list = new BList(p_playlist->i_size);
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
...@@ -592,11 +712,11 @@ Intf_VLCWrapper::getPlaylistInfo( int32& currentIndex, int32& maxIndex ) ...@@ -592,11 +712,11 @@ Intf_VLCWrapper::getPlaylistInfo( int32& currentIndex, int32& maxIndex )
{ {
currentIndex = -1; currentIndex = -1;
maxIndex = -1; maxIndex = -1;
if ( playlist_t* list = (playlist_t*)p_intf->p_sys->p_playlist ) if ( p_playlist )
{ {
maxIndex = list->i_size; maxIndex = p_playlist->i_size;
if ( maxIndex > 0 ) if ( maxIndex > 0 )
currentIndex = list->i_index + 1; currentIndex = p_playlist->i_index + 1;
else else
maxIndex = -1; maxIndex = -1;
} }
...@@ -608,17 +728,17 @@ Intf_VLCWrapper::getTitleInfo( int32& currentIndex, int32& maxIndex ) ...@@ -608,17 +728,17 @@ Intf_VLCWrapper::getTitleInfo( int32& currentIndex, int32& maxIndex )
{ {
currentIndex = -1; currentIndex = -1;
maxIndex = -1; maxIndex = -1;
if ( input_thread_t* input = p_intf->p_sys->p_input ) if ( p_input )
{ {
vlc_mutex_lock( &input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
maxIndex = input->stream.i_area_nb - 1; maxIndex = p_input->stream.i_area_nb - 1;
if ( maxIndex > 0) if ( maxIndex > 0)
currentIndex = input->stream.p_selected_area->i_id; currentIndex = p_input->stream.p_selected_area->i_id;
else else
maxIndex = -1; maxIndex = -1;
vlc_mutex_unlock( &input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
} }
...@@ -628,17 +748,17 @@ Intf_VLCWrapper::getChapterInfo( int32& currentIndex, int32& maxIndex ) ...@@ -628,17 +748,17 @@ Intf_VLCWrapper::getChapterInfo( int32& currentIndex, int32& maxIndex )
{ {
currentIndex = -1; currentIndex = -1;
maxIndex = -1; maxIndex = -1;
if ( input_thread_t* input = p_intf->p_sys->p_input ) if ( p_input )
{ {
vlc_mutex_lock( &input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
maxIndex = input->stream.p_selected_area->i_part_nb - 1; maxIndex = p_input->stream.p_selected_area->i_part_nb - 1;
if ( maxIndex > 0) if ( maxIndex > 0)
currentIndex = input->stream.p_selected_area->i_part; currentIndex = p_input->stream.p_selected_area->i_part;
else else
maxIndex = -1; maxIndex = -1;
vlc_mutex_unlock( &input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
} }
...@@ -646,7 +766,6 @@ Intf_VLCWrapper::getChapterInfo( int32& currentIndex, int32& maxIndex ) ...@@ -646,7 +766,6 @@ Intf_VLCWrapper::getChapterInfo( int32& currentIndex, int32& maxIndex )
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 = p_intf->p_sys->p_playlist;
while( ( o_file = (BString *)o_files->LastItem() ) ) while( ( o_file = (BString *)o_files->LastItem() ) )
{ {
...@@ -662,7 +781,6 @@ void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, in ...@@ -662,7 +781,6 @@ void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, in
BString o_source(""); BString o_source("");
o_source << o_type << ":" << o_device ; o_source << o_type << ":" << o_device ;
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Add( p_playlist, o_source.String(), playlist_Add( p_playlist, o_source.String(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
} }
...@@ -685,27 +803,27 @@ void Intf_VLCWrapper::toggleProgram(int i_program){} ...@@ -685,27 +803,27 @@ void Intf_VLCWrapper::toggleProgram(int i_program){}
void Intf_VLCWrapper::toggleTitle(int i_title) void Intf_VLCWrapper::toggleTitle(int i_title)
{ {
if( p_intf->p_sys->p_input != NULL ) if( p_input != NULL )
{ {
input_ChangeArea( p_intf->p_sys->p_input, input_ChangeArea( p_input,
p_intf->p_sys->p_input->stream.pp_areas[i_title] ); p_input->stream.pp_areas[i_title] );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
} }
void Intf_VLCWrapper::toggleChapter(int i_chapter) void Intf_VLCWrapper::toggleChapter(int i_chapter)
{ {
if( p_intf->p_sys->p_input != NULL ) if( p_input != NULL )
{ {
p_intf->p_sys->p_input->stream.p_selected_area->i_part = i_chapter; p_input->stream.p_selected_area->i_part = i_chapter;
input_ChangeArea( p_intf->p_sys->p_input, input_ChangeArea( p_input,
p_intf->p_sys->p_input->stream.p_selected_area ); p_input->stream.p_selected_area );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
} }
...@@ -715,29 +833,29 @@ void Intf_VLCWrapper::toggleLanguage(int i_language) ...@@ -715,29 +833,29 @@ void Intf_VLCWrapper::toggleLanguage(int i_language)
int32 i_old = -1; int32 i_old = -1;
int i_cat = AUDIO_ES; int i_cat = AUDIO_ES;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ ) for( int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
{ {
if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat ) if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
{ {
i_old = i; i_old = i;
break; break;
} }
} }
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Info( p_intf, "Old: %d, New: %d", i_old, i_language); msg_Info( p_intf, "Old: %d, New: %d", i_old, i_language);
if( i_language != -1 ) if( i_language != -1 )
{ {
input_ToggleES( p_intf->p_sys->p_input, input_ToggleES( p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_language], p_input->stream.pp_selected_es[i_language],
VLC_TRUE ); VLC_TRUE );
} }
if( (i_old != -1) && (i_old != i_language) ) if( (i_old != -1) && (i_old != i_language) )
{ {
input_ToggleES( p_intf->p_sys->p_input, input_ToggleES( p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_old], p_input->stream.pp_selected_es[i_old],
VLC_FALSE ); VLC_FALSE );
} }
} }
...@@ -747,34 +865,34 @@ void Intf_VLCWrapper::toggleSubtitle(int i_subtitle) ...@@ -747,34 +865,34 @@ void Intf_VLCWrapper::toggleSubtitle(int i_subtitle)
int32 i_old = -1; int32 i_old = -1;
int i_cat = SPU_ES; int i_cat = SPU_ES;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ ) for( int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
{ {
if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat ) if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
{ {
i_old = i; i_old = i;
break; break;
} }
} }
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Info( p_intf, "Old: %d, New: %d", i_old, i_subtitle); msg_Info( p_intf, "Old: %d, New: %d", i_old, i_subtitle);
if( i_subtitle != -1 ) if( i_subtitle != -1 )
{ {
input_ToggleES( p_intf->p_sys->p_input, input_ToggleES( p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_subtitle], p_input->stream.pp_selected_es[i_subtitle],
VLC_TRUE ); VLC_TRUE );
} }
if( (i_old != -1) && (i_old != i_subtitle) ) if( (i_old != -1) && (i_old != i_subtitle) )
{ {
input_ToggleES( p_intf->p_sys->p_input, input_ToggleES( p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_old], p_input->stream.pp_selected_es[i_old],
VLC_FALSE ); VLC_FALSE );
} }
} }
int Intf_VLCWrapper::inputGetStatus() int Intf_VLCWrapper::inputGetStatus()
{ {
return p_intf->p_sys->p_playlist->i_status; return p_playlist->i_status;
} }
...@@ -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.6 2002/10/30 00:59:22 titer Exp $ * $Id: VlcWrapper.h,v 1.7 2002/11/26 01:06:08 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>
...@@ -37,10 +37,6 @@ struct intf_sys_t ...@@ -37,10 +37,6 @@ struct intf_sys_t
{ {
InterfaceWindow * p_window; InterfaceWindow * p_window;
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;
vlc_bool_t b_loop; vlc_bool_t b_loop;
...@@ -49,7 +45,7 @@ struct intf_sys_t ...@@ -49,7 +45,7 @@ struct intf_sys_t
int i_saved_volume; int i_saved_volume;
int i_channel; int i_channel;
Intf_VLCWrapper * p_vlc_wrapper; Intf_VLCWrapper * p_wrapper;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -57,7 +53,7 @@ struct intf_sys_t ...@@ -57,7 +53,7 @@ struct intf_sys_t
***************************************************************************** *****************************************************************************
* This class makes the link between the BeOS interface and the vlc core. * This class makes the link between the BeOS interface and the vlc core.
* There is only one Intf_VLCWrapper instance at any time, which is stored * There is only one Intf_VLCWrapper instance at any time, which is stored
* in p_intf->p_sys->p_vlc_wrapper * in p_intf->p_sys->p_wrapper
*****************************************************************************/ *****************************************************************************/
class Intf_VLCWrapper class Intf_VLCWrapper
{ {
...@@ -65,10 +61,20 @@ public: ...@@ -65,10 +61,20 @@ public:
Intf_VLCWrapper( intf_thread_t *p_intf ); Intf_VLCWrapper( intf_thread_t *p_intf );
~Intf_VLCWrapper(); ~Intf_VLCWrapper();
bool UpdateInputAndAOut();
int inputGetStatus(); int inputGetStatus();
int InputStatus();
int InputRate();
int InputTell();
int InputSize();
void inputSeek(); void inputSeek();
/* playlist control */ /* playlist control */
int PlaylistSize();
char *PlaylistItemName( int );
int PlaylistCurrent();
bool playlistPlay(); bool playlistPlay();
void playlistPause(); void playlistPause();
void playlistStop(); void playlistStop();
...@@ -96,6 +102,14 @@ public: ...@@ -96,6 +102,14 @@ public:
void navigatePrev(); void navigatePrev();
void navigateNext(); void navigateNext();
/* DVD */
bool HasTitles();
void PrevTitle();
void NextTitle();
bool HasChapters();
void PrevChapter();
void NextChapter();
/* Stream Control */ /* Stream Control */
void playSlower(); void playSlower();
void playFaster(); void playFaster();
...@@ -133,6 +147,9 @@ public: ...@@ -133,6 +147,9 @@ public:
void channelPrev(); void channelPrev();
private: private:
intf_thread_t *p_intf; intf_thread_t * p_intf;
input_thread_t * p_input;
playlist_t * p_playlist;
aout_instance_t * p_aout;
}; };
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