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 @@
* intf_beos.cpp: beos interface
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -72,12 +72,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
return( 1 );
}
p_intf->p_sys->p_input = NULL;
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->p_sys->p_wrapper = new Intf_VLCWrapper( p_intf );
p_intf->pf_run = Run;
......@@ -110,26 +105,12 @@ void E_(CloseIntf) ( vlc_object_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 */
p_intf->p_sys->p_window->Lock();
p_intf->p_sys->p_window->Quit();
/* Destroy structure */
delete p_intf->p_sys->p_wrapper;
free( p_intf->p_sys );
}
......@@ -141,33 +122,8 @@ static void Run( intf_thread_t *p_intf )
{
while( !p_intf->b_die )
{
if( p_intf->p_sys->p_input == NULL )
{
p_intf->p_sys->p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
}
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_wrapper->UpdateInputAndAOut() )
{
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 */
p_intf->p_sys->p_window->updateInterface();
}
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -43,11 +43,11 @@
#include <vlc/intf.h>
/* BeOS interface headers */
#include "VlcWrapper.h"
#include "MsgVals.h"
#include "MediaControlView.h"
#include "PlayListWindow.h"
#include "PreferencesWindow.h"
#include "VlcWrapper.h"
#include "InterfaceWindow.h"
#define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps
......@@ -62,19 +62,17 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
: BWindow( frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
p_intf( p_interface ),
fInputThread( NULL ),
fFilePanel( NULL ),
fLastUpdateTime( system_time() ),
fSettings( new BMessage( 'sett' ) )
{
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 ),
"Playlist",
p_playlist,
this,
p_intf );
BScreen *p_screen = new BScreen();
......@@ -214,7 +212,7 @@ InterfaceWindow::FrameResized(float width, float height)
void InterfaceWindow::MessageReceived( BMessage * p_message )
{
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 )
{
......@@ -256,7 +254,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
if( p_message->FindString( "device", &psz_device ) == B_OK )
{
BString device( psz_device );
p_intf->p_sys->p_vlc_wrapper->openDisc( type, device, 0, 0 );
p_wrapper->openDisc( type, device, 0, 0 );
}
_UpdatePlaylist();
}
......@@ -266,9 +264,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
// this currently stops playback not nicely
if (playback_status > UNDEF_S)
{
p_intf->p_sys->p_vlc_wrapper->volume_mute();
p_wrapper->volume_mute();
snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playlistStop();
p_wrapper->playlistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
}
break;
......@@ -283,20 +281,20 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
/* pause if currently playing */
if ( playback_status == PLAYING_S )
{
p_intf->p_sys->p_vlc_wrapper->volume_mute();
p_wrapper->volume_mute();
snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playlistPause();
p_wrapper->playlistPause();
}
else
{
p_intf->p_sys->p_vlc_wrapper->volume_restore();
p_intf->p_sys->p_vlc_wrapper->playlistPlay();
p_wrapper->volume_restore();
p_wrapper->playlistPlay();
}
}
else
{
/* Play a new file */
p_intf->p_sys->p_vlc_wrapper->playlistPlay();
p_wrapper->playlistPlay();
}
break;
......@@ -304,9 +302,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
/* cycle the fast playback modes */
if (playback_status > UNDEF_S)
{
p_intf->p_sys->p_vlc_wrapper->volume_mute();
p_wrapper->volume_mute();
snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playFaster();
p_wrapper->playFaster();
}
break;
......@@ -314,9 +312,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
/* cycle the slow playback modes */
if (playback_status > UNDEF_S)
{
p_intf->p_sys->p_vlc_wrapper->volume_mute();
p_wrapper->volume_mute();
snooze( 400000 );
p_intf->p_sys->p_vlc_wrapper->playSlower();
p_wrapper->playSlower();
}
break;
......@@ -324,8 +322,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
/* restore speed to normal if already playing */
if (playback_status > UNDEF_S)
{
p_intf->p_sys->p_vlc_wrapper->volume_restore();
p_intf->p_sys->p_vlc_wrapper->playlistPlay();
p_wrapper->volume_restore();
p_wrapper->playlistPlay();
}
break;
......@@ -337,15 +335,15 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
/* adjust the volume */
if (playback_status > UNDEF_S)
{
p_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() );
p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() );
p_wrapper->set_volume( p_mediaControl->GetVolume() );
p_mediaControl->SetMuted( p_wrapper->is_muted() );
}
break;
case VOLUME_MUTE:
// toggle muting
p_intf->p_sys->p_vlc_wrapper->toggle_mute();
p_mediaControl->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() );
p_wrapper->toggle_mute();
p_mediaControl->SetMuted( p_wrapper->is_muted() );
break;
case SELECT_CHANNEL:
......@@ -354,14 +352,14 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
int32 channel;
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,
// but I would assume that to be somewhat annoying to the user
// the next call will also unmute the volume, which is probably
// desired as well, because if the user selects another language,
// he probably wants to hear the change as well
snooze( 400000 ); // we have to wait a bit, or the change will be reverted
p_intf->p_sys->p_vlc_wrapper->set_volume( p_mediaControl->GetVolume() );
p_wrapper->set_volume( p_mediaControl->GetVolume() );
}
}
break;
......@@ -371,33 +369,19 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
int32 subtitle;
if ( p_message->FindInt32( "subtitle", &subtitle ) == B_OK )
p_intf->p_sys->p_vlc_wrapper->toggleSubtitle( subtitle );
p_wrapper->toggleSubtitle( subtitle );
}
break;
// specific navigation messages
case PREV_TITLE:
{
int i_id;
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);
}
p_wrapper->PrevTitle();
break;
}
case NEXT_TITLE:
{
int i_id;
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);
}
p_wrapper->NextTitle();
break;
}
case TOGGLE_TITLE:
......@@ -405,31 +389,17 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
int32 index;
if ( p_message->FindInt32( "index", &index ) == B_OK )
p_intf->p_sys->p_vlc_wrapper->toggleTitle( index );
p_wrapper->toggleTitle( index );
}
break;
case PREV_CHAPTER:
{
int i_id;
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);
}
p_wrapper->PrevChapter();
break;
}
case NEXT_CHAPTER:
{
int i_id;
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);
}
p_wrapper->NextChapter();
break;
}
case TOGGLE_CHAPTER:
......@@ -437,21 +407,21 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
int32 index;
if ( p_message->FindInt32( "index", &index ) == B_OK )
p_intf->p_sys->p_vlc_wrapper->toggleChapter( index );
p_wrapper->toggleChapter( index );
}
break;
case PREV_FILE:
p_intf->p_sys->p_vlc_wrapper->playlistPrev();
p_wrapper->playlistPrev();
break;
case NEXT_FILE:
p_intf->p_sys->p_vlc_wrapper->playlistNext();
p_wrapper->playlistNext();
break;
// general next/prev functionality (skips to whatever makes most sense)
case NAVIGATE_PREV:
p_intf->p_sys->p_vlc_wrapper->navigatePrev();
p_wrapper->navigatePrev();
break;
case NAVIGATE_NEXT:
p_intf->p_sys->p_vlc_wrapper->navigateNext();
p_wrapper->navigateNext();
break;
// drag'n'drop and system messages
case B_REFS_RECEIVED:
......@@ -473,7 +443,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
files.AddItem( new BString( (char*)path.Path() ) );
}
// give the list to VLC
p_intf->p_sys->p_vlc_wrapper->openFiles(&files, replace);
p_wrapper->openFiles(&files, replace);
_UpdatePlaylist();
}
break;
......@@ -501,13 +471,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
*****************************************************************************/
bool InterfaceWindow::QuitRequested()
{
if (p_intf->p_sys->p_input)
{
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_wrapper->playlistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
p_intf->b_die = 1;
......@@ -521,44 +486,37 @@ bool InterfaceWindow::QuitRequested()
*****************************************************************************/
void InterfaceWindow::updateInterface()
{
input_thread_t* input = p_intf->p_sys->p_input;
if ( input )
{
if( /* has_input */ true )
{
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() )
{
bool hasTitles = input->stream.i_area_nb > 1;
bool hasChapters = input->stream.p_selected_area->i_part_nb > 1;
p_mediaControl->SetStatus( input->stream.control.i_status,
input->stream.control.i_rate );
p_mediaControl->SetProgress( input->stream.p_selected_area->i_tell,
input->stream.p_selected_area->i_size );
bool hasTitles = p_wrapper->HasTitles();
bool hasChapters = p_wrapper->HasChapters();
p_mediaControl->SetStatus( p_wrapper->InputStatus(),
p_wrapper->InputRate() );
p_mediaControl->SetProgress( p_wrapper->InputTell(),
p_wrapper->InputSize() );
_SetMenusEnabled( true, hasChapters, hasTitles );
_UpdateSpeedMenu( input->stream.control.i_rate );
_UpdateSpeedMenu( p_wrapper->InputRate() );
// enable/disable skip buttons
bool canSkipPrev;
bool canSkipNext;
p_intf->p_sys->p_vlc_wrapper->getNavCapabilities( &canSkipPrev, &canSkipNext );
p_wrapper->getNavCapabilities( &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->SetMuted( p_intf->p_sys->p_vlc_wrapper->is_muted() );
p_mediaControl->SetMuted( p_wrapper->is_muted() );
} else
p_mediaControl->SetAudioEnabled( false );
if ( input != fInputThread )
{
fInputThread = input;
_InputStreamChanged();
}
Unlock();
}
// update playlist as well
......@@ -568,22 +526,15 @@ void InterfaceWindow::updateInterface()
fPlaylistWindow->Unlock();
}
}
else
_SetMenusEnabled(false);
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
if ( fPlaylistIsEmpty != ( p_playlist->i_size < 0) )
else
_SetMenusEnabled(false);
if ( Lock() )
{
if ( Lock() )
{
fPlaylistIsEmpty = !fPlaylistIsEmpty;
p_mediaControl->SetEnabled( !fPlaylistIsEmpty );
Unlock();
}
p_mediaControl->SetEnabled( p_wrapper->PlaylistSize() );
Unlock();
}
if ( input != fInputThread )
fInputThread = input;
fLastUpdateTime = system_time();
}
......@@ -607,9 +558,7 @@ InterfaceWindow::_UpdatePlaylist()
{
fPlaylistWindow->UpdatePlaylist( true );
fPlaylistWindow->Unlock();
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
fPlaylistIsEmpty = p_playlist->i_size < 1;
p_mediaControl->SetEnabled( !fPlaylistIsEmpty );
p_mediaControl->SetEnabled( p_wrapper->PlaylistSize() );
}
}
......@@ -684,7 +633,7 @@ InterfaceWindow::_InputStreamChanged()
//printf("InterfaceWindow::_InputStreamChanged()\n");
// TODO: move more stuff from updateInterface() here!
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()
menu_item->SetMarked( true );
}
#if 0
input_thread_t* input = p_intf->p_sys->p_input;
if ( input )
{
......@@ -1060,6 +1010,7 @@ void LanguageMenu::_GetChannels()
if ( ( emptyItemAdded || kind != AUDIO_ES ) && addedItems > 1 )
AddItem( new BSeparatorItem(), 1 );
}
#endif
}
......@@ -1089,6 +1040,7 @@ void TitleMenu::AttachedToWindow()
while ( BMenuItem* item = RemoveItem( 0L ) )
delete item;
#if 0
input_thread_t* input = p_intf->p_sys->p_input;
if ( input )
{
......@@ -1113,6 +1065,7 @@ void TitleMenu::AttachedToWindow()
// done messing with stream
vlc_mutex_unlock( &input->stream.stream_lock );
}
#endif
BMenu::AttachedToWindow();
}
......@@ -1142,6 +1095,7 @@ void ChapterMenu::AttachedToWindow()
while ( BMenuItem* item = RemoveItem( 0L ) )
delete item;
#if 0
input_thread_t* input = p_intf->p_sys->p_input;
if ( input )
{
......@@ -1166,5 +1120,6 @@ void ChapterMenu::AttachedToWindow()
vlc_mutex_unlock( &input->stream.stream_lock );
}
BMenu::AttachedToWindow();
#endif
}
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* 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>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -125,7 +125,6 @@ class InterfaceWindow : public BWindow
intf_thread_t* p_intf;
es_descriptor_t* p_spu_es;
input_thread_t* fInputThread;
bool fPlaylistIsEmpty;
BFilePanel* fFilePanel;
......@@ -153,7 +152,7 @@ class InterfaceWindow : public BWindow
BMessage* fSettings; // we keep the message arround
// for forward compatibility
Intf_VLCWrapper * p_vlc_wrapper;
Intf_VLCWrapper * p_wrapper;
};
#endif // BEOS_INTERFACE_WINDOW_H
......@@ -2,7 +2,7 @@
* MediaControlView.cpp: beos interface
*****************************************************************************
* 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>
* Stephan Aßmus <stippi@yellowbites.com>
......@@ -1307,13 +1307,13 @@ PositionInfoView::Pulse()
if ( now - fLastPulseUpdate > 900000 )
{
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 );
p_intf->p_sys->p_vlc_wrapper->getTitleInfo( index, size );
p_intf->p_sys->p_wrapper->getTitleInfo( 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 );
SetTime( p_intf->p_sys->p_vlc_wrapper->getTimeAsString() );
SetTime( p_intf->p_sys->p_wrapper->getTimeAsString() );
fLastPulseUpdate = now;
}
}
......
......@@ -2,7 +2,7 @@
* PlayListWindow.cpp: beos interface
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -57,15 +57,15 @@ enum
* PlayListWindow::PlayListWindow
*****************************************************************************/
PlayListWindow::PlayListWindow( BRect frame, const char* name,
playlist_t *playlist,
InterfaceWindow* mainWindow,
intf_thread_t *p_interface )
: BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
fPlaylist( playlist ),
fMainWindow( mainWindow )
{
this->p_intf = p_interface;
p_intf = p_interface;
p_wrapper = p_intf->p_sys->p_wrapper;
SetName( "playlist" );
// set up the main menu bar
......@@ -242,9 +242,9 @@ PlayListWindow::UpdatePlaylist( bool rebuild )
delete item;
// rebuild listview from VLC's playlist
for ( int i = 0; i < fPlaylist->i_size; i++ )
fListView->AddItem( new PlaylistItem( fPlaylist->pp_items[i]->psz_name ) );
for ( int i = 0; i < p_wrapper->PlaylistSize(); i++ )
fListView->AddItem( new PlaylistItem( p_wrapper->PlaylistItemName( i ) ) );
}
fListView->SetCurrent( fPlaylist->i_index );
fListView->SetPlaying( p_intf->p_sys->p_vlc_wrapper->is_playing() );
fListView->SetCurrent( p_wrapper->PlaylistCurrent() );
fListView->SetPlaying( p_wrapper->is_playing() );
}
......@@ -2,7 +2,7 @@
* PlayListWindow.h: BeOS interface window class prototype
*****************************************************************************
* 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>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -39,7 +39,6 @@ class PlayListWindow : public BWindow
public:
PlayListWindow(BRect frame,
const char* name,
playlist_t* playlist,
InterfaceWindow* mainWindow,
intf_thread_t *p_interface );
virtual ~PlayListWindow();
......@@ -54,14 +53,13 @@ class PlayListWindow : public BWindow
void UpdatePlaylist( bool rebuild = false );
private:
playlist_t * fPlaylist;
PlaylistView * fListView;
BView * fBackgroundView;
BMenuBar * fMenuBar;
InterfaceWindow * fMainWindow;
intf_thread_t * p_intf;
Intf_VLCWrapper * p_wrapper;
};
#endif // BEOS_PLAY_LIST_WINDOW_H
......
......@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface
*****************************************************************************
* 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>
*
......@@ -46,105 +46,105 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
BRect rect;
/* "background" view */
p_prefs_view = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
p_prefs_view->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
AddChild( p_prefs_view );
fPrefsView = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fPrefsView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
AddChild( fPrefsView );
/* add the tabs */
rect = Bounds();
rect.top += 10;
rect.bottom -= 65;
p_tabview = new BTabView( rect, "preferences view" );
p_tabview->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
fTabView = new BTabView( rect, "preferences view" );
fTabView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
p_ffmpeg_view = new BView( p_tabview->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
p_ffmpeg_view->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
p_adjust_view = new BView( p_tabview->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
p_adjust_view->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
fFfmpegView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fFfmpegView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
fAdjustView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fAdjustView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
p_ffmpeg_tab = new BTab();
p_tabview->AddTab( p_ffmpeg_view, p_ffmpeg_tab );
p_ffmpeg_tab->SetLabel( "Ffmpeg" );
fFfmpegTab = new BTab();
fTabView->AddTab( fFfmpegView, fFfmpegTab );
fFfmpegTab->SetLabel( "Ffmpeg" );
p_adjust_tab = new BTab();
p_tabview->AddTab( p_adjust_view, p_adjust_tab );
p_adjust_tab->SetLabel( "Adjust" );
fAdjustTab = new BTab();
fTabView->AddTab( fAdjustView, fAdjustTab );
fAdjustTab->SetLabel( "Adjust" );
/* fills the tabs */
/* ffmpeg tab */
rect = p_ffmpeg_view->Bounds();
rect = fFfmpegView->Bounds();
rect.InsetBy( 10, 10 );
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 ),
0, 6, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW );
p_pp_slider->SetHashMarks(B_HASH_MARKS_BOTTOM);
p_pp_slider->SetHashMarkCount( 7 );
p_pp_slider->SetLimitLabels( "None", "Maximum" );
p_ffmpeg_view->AddChild( p_pp_slider );
fPpSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fPpSlider->SetHashMarkCount( 7 );
fPpSlider->SetLimitLabels( "None", "Maximum" );
fFfmpegView->AddChild( fPpSlider );
/* adjust tab */
rect = p_adjust_view->Bounds();
rect = fAdjustView->Bounds();
rect.InsetBy( 10, 10 );
rect.bottom = rect.top + 30;
p_brightness_slider = new BSlider( rect, "brightness", "Brightness",
fBrightnessSlider = new BSlider( rect, "brightness", "Brightness",
new BMessage( SLIDER_UPDATE ),
0, 200, B_TRIANGLE_THUMB,
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 );
p_contrast_slider = new BSlider( rect, "contrast", "Contrast",
fContrastSlider = new BSlider( rect, "contrast", "Contrast",
new BMessage( SLIDER_UPDATE ),
0, 200, B_TRIANGLE_THUMB,
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 );
p_hue_slider = new BSlider( rect, "hue", "Hue",
fHueSlider = new BSlider( rect, "hue", "Hue",
new BMessage( SLIDER_UPDATE ),
0, 360, B_TRIANGLE_THUMB,
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 );
p_saturation_slider = new BSlider( rect, "saturation", "Saturation",
fSaturationSlider = new BSlider( rect, "saturation", "Saturation",
new BMessage( SLIDER_UPDATE ),
0, 200, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW );
p_saturation_slider->SetValue( 100 * config_GetFloat( p_intf, "Saturation" ) );
p_adjust_view->AddChild( p_brightness_slider );
p_adjust_view->AddChild( p_contrast_slider );
p_adjust_view->AddChild( p_hue_slider );
p_adjust_view->AddChild( p_saturation_slider );
fSaturationSlider->SetValue( 100 * config_GetFloat( p_intf, "Saturation" ) );
fAdjustView->AddChild( fBrightnessSlider );
fAdjustView->AddChild( fContrastSlider );
fAdjustView->AddChild( fHueSlider );
fAdjustView->AddChild( fSaturationSlider );
p_prefs_view->AddChild( p_tabview );
fPrefsView->AddChild( fTabView );
/* restart message */
rect = p_prefs_view->Bounds();
rect = fPrefsView->Bounds();
rect.bottom -= 43;
rect.top = rect.bottom - 10;
p_restart_string = new BStringView( rect, NULL, "" );
fRestartString = new BStringView( rect, NULL, "" );
rgb_color redColor = {255, 0, 0, 255};
p_restart_string->SetHighColor(redColor);
p_restart_string->SetAlignment( B_ALIGN_CENTER );
p_prefs_view->AddChild( p_restart_string );
fRestartString->SetHighColor(redColor);
fRestartString->SetAlignment( B_ALIGN_CENTER );
fPrefsView->AddChild( fRestartString );
/* buttons */
BButton *p_button;
BButton *button;
rect = Bounds();
rect.InsetBy( 10, 10 );
rect.top = rect.bottom - 25;
rect.left = rect.right - 80;
p_button = new BButton( rect, NULL, "OK", new BMessage( PREFS_OK ) );
p_prefs_view->AddChild( p_button );
button = new BButton( rect, NULL, "OK", new BMessage( PREFS_OK ) );
fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 );
p_button = new BButton( rect, NULL, "Cancel", new BMessage( PREFS_CANCEL ) );
p_prefs_view->AddChild( p_button );
button = new BButton( rect, NULL, "Cancel", new BMessage( PREFS_CANCEL ) );
fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 );
p_button = new BButton( rect, NULL, "Defaults", new BMessage( PREFS_DEFAULTS ) );
p_prefs_view->AddChild( p_button );
button = new BButton( rect, NULL, "Defaults", new BMessage( PREFS_DEFAULTS ) );
fPrefsView->AddChild( button );
// start window thread in hidden state
Hide();
......@@ -177,7 +177,7 @@ void PreferencesWindow::MessageReceived( BMessage * p_message )
}
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" );
ApplyChanges();
Hide();
......@@ -202,13 +202,13 @@ void PreferencesWindow::ReallyQuit()
*****************************************************************************/
void PreferencesWindow::SetDefaults()
{
p_pp_slider->SetValue( 0 );
p_brightness_slider->SetValue( 100 );
p_contrast_slider->SetValue( 100 );
p_hue_slider->SetValue( 0 );
p_saturation_slider->SetValue( 100 );
fPpSlider->SetValue( 0 );
fBrightnessSlider->SetValue( 100 );
fContrastSlider->SetValue( 100 );
fHueSlider->SetValue( 0 );
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" : "" );
config_PutPsz( p_intf, "filter", NULL );
......@@ -226,29 +226,29 @@ void PreferencesWindow::ApplyChanges()
if( ( !config_GetPsz( p_intf, "filter" ) ||
strncmp( config_GetPsz( p_intf, "filter" ), "adjust", 6 ) ) &&
( p_brightness_slider->Value() != 100 ||
p_contrast_slider->Value() != 100 ||
p_hue_slider->Value() ||
p_saturation_slider->Value() != 100 ) )
( fBrightnessSlider->Value() != 100 ||
fContrastSlider->Value() != 100 ||
fHueSlider->Value() ||
fSaturationSlider->Value() != 100 ) )
{
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;
}
config_PutFloat( p_intf, "Brightness",
(float)p_brightness_slider->Value() / 100 );
(float)fBrightnessSlider->Value() / 100 );
config_PutFloat( p_intf, "Contrast",
(float)p_contrast_slider->Value() / 100 );
config_PutInt( p_intf, "Hue", p_hue_slider->Value() );
(float)fContrastSlider->Value() / 100 );
config_PutInt( p_intf, "Hue", fHueSlider->Value() );
config_PutFloat( p_intf, "Saturation",
(float)p_saturation_slider->Value() / 100 );
(float)fSaturationSlider->Value() / 100 );
p_restart_string->LockLooper();
p_restart_string->SetText( b_restart_needed ?
fRestartString->LockLooper();
fRestartString->SetText( b_restart_needed ?
"Changes will take effect after you restart playback" : "" );
p_restart_string->UnlockLooper();
fRestartString->UnlockLooper();
}
......@@ -2,7 +2,7 @@
* PreferencesWindow.h
*****************************************************************************
* 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>
*
......@@ -47,18 +47,18 @@ class PreferencesWindow : public BWindow
private:
void SetDefaults();
void ApplyChanges();
BView * p_prefs_view;
BTabView * p_tabview;
BView * p_ffmpeg_view;
BView * p_adjust_view;
BTab * p_ffmpeg_tab;
BTab * p_adjust_tab;
BSlider * p_pp_slider;
BSlider * p_contrast_slider;
BSlider * p_brightness_slider;
BSlider * p_hue_slider;
BSlider * p_saturation_slider;
BStringView * p_restart_string;
BView * fPrefsView;
BTabView * fTabView;
BView * fFfmpegView;
BView * fAdjustView;
BTab * fFfmpegTab;
BTab * fAdjustTab;
BSlider * fPpSlider;
BSlider * fContrastSlider;
BSlider * fBrightnessSlider;
BSlider * fHueSlider;
BSlider * fSaturationSlider;
BStringView * fRestartString;
intf_thread_t * p_intf;
};
......
......@@ -2,7 +2,7 @@
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.cpp,v 1.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>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -34,20 +34,154 @@
#include "VlcWrapper.h"
/* constructor */
Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *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()
{
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 */
bool Intf_VLCWrapper::playlistPlay()
{
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
......@@ -58,51 +192,41 @@ bool Intf_VLCWrapper::playlistPlay()
{
vlc_mutex_unlock( &p_playlist->object_lock );
}
return( true );
}
void Intf_VLCWrapper::playlistPause()
{
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()
{
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
volume_mute();
playlist_Stop( p_playlist );
}
void Intf_VLCWrapper::playlistNext()
{
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Next( p_playlist );
}
void Intf_VLCWrapper::playlistPrev()
{
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Prev( p_playlist );
}
void Intf_VLCWrapper::playlistSkip(int i)
{
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Skip( p_playlist, i );
}
void Intf_VLCWrapper::playlistGoto(int i)
{
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Goto( p_playlist, i );
}
......@@ -132,7 +256,7 @@ void Intf_VLCWrapper::playlistJumpTo( int pos )
int Intf_VLCWrapper::playlistCurrentPos()
{
playlistLock();
int pos = p_intf->p_sys->p_playlist->i_index;
int pos = p_playlist->i_index;
playlistUnlock();
return pos;
}
......@@ -140,19 +264,19 @@ int Intf_VLCWrapper::playlistCurrentPos()
int Intf_VLCWrapper::playlistSize()
{
playlistLock();
int size = p_intf->p_sys->p_playlist->i_size;
int size = p_playlist->i_size;
playlistUnlock();
return size;
}
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()
{
vlc_mutex_unlock( &p_intf->p_sys->p_playlist->object_lock );
vlc_mutex_unlock( &p_playlist->object_lock );
}
void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
......@@ -165,35 +289,34 @@ void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
*canSkipNext = false;
// get playlist info
playlistLock();
int pos = p_intf->p_sys->p_playlist->i_index;
int size = p_intf->p_sys->p_playlist->i_size;
int pos = p_playlist->i_index;
int size = p_playlist->i_size;
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
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;
int numChapters = input->stream.p_selected_area->i_part_nb;
bool hasTitles = p_input->stream.i_area_nb > 1;
int numChapters = p_input->stream.p_selected_area->i_part_nb;
bool hasChapters = numChapters > 1;
// first, look for chapters
if ( hasChapters )
{
*canSkipPrev = input->stream.p_selected_area->i_part > 0;
*canSkipNext = input->stream.p_selected_area->i_part <
input->stream.p_selected_area->i_part_nb - 1;
*canSkipPrev = p_input->stream.p_selected_area->i_part > 0;
*canSkipNext = p_input->stream.p_selected_area->i_part <
p_input->stream.p_selected_area->i_part_nb - 1;
}
// if one of the skip capabilities is false,
// make it depend on titles instead
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 )
*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
if ( !*canSkipPrev )
......@@ -349,12 +472,11 @@ void Intf_VLCWrapper::loop()
{
if ( p_intf->p_sys->b_loop )
{
playlist_Delete( p_intf->p_sys->p_playlist,
p_intf->p_sys->p_playlist->i_size - 1 );
playlist_Delete( p_playlist, p_playlist->i_size - 1 );
}
else
{
playlist_Add( p_intf->p_sys->p_playlist, "vlc:loop",
playlist_Add( p_playlist, "vlc:loop",
PLAYLIST_APPEND | PLAYLIST_GO,
PLAYLIST_END );
}
......@@ -365,11 +487,11 @@ void Intf_VLCWrapper::loop()
/* playback control */
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( );
}
......@@ -381,11 +503,11 @@ void Intf_VLCWrapper::playSlower()
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( );
}
......@@ -397,12 +519,12 @@ void Intf_VLCWrapper::playFaster()
void Intf_VLCWrapper::volume_mute()
{
if( p_intf->p_sys->p_aout != NULL )
if( p_aout != NULL )
{
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->p_aout->output.i_volume = 0;
p_intf->p_sys->i_saved_volume = p_aout->output.i_volume;
p_aout->output.i_volume = 0;
p_intf->p_sys->b_mute = 1;
}
}
......@@ -411,9 +533,9 @@ void Intf_VLCWrapper::volume_mute()
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->b_mute = 0;
}
......@@ -422,27 +544,27 @@ void Intf_VLCWrapper::volume_restore()
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
if (value < 0)
value = 0;
if (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
if ( p_intf->p_sys->b_mute )
{
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()
{
if( p_intf->p_sys->p_aout != NULL )
if( p_aout != NULL )
{
if ( p_intf->p_sys->b_mute )
{
......@@ -459,14 +581,14 @@ bool Intf_VLCWrapper::is_muted()
{
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 );
if( p_intf->p_sys->p_aout->output.i_volume > 0 )
vlc_mutex_lock( &p_aout->mixer_lock );
if( p_aout->output.i_volume > 0 )
{
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!
// return p_main->p_intf->p_sys->b_mute;
}
......@@ -477,9 +599,9 @@ bool Intf_VLCWrapper::is_playing()
{
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 FORWARD_S:
......@@ -500,7 +622,7 @@ bool Intf_VLCWrapper::is_playing()
void Intf_VLCWrapper::maxvolume()
{
if( p_intf->p_sys->p_aout != NULL )
if( p_aout != NULL )
{
if( p_intf->p_sys->b_mute )
{
......@@ -508,14 +630,14 @@ void Intf_VLCWrapper::maxvolume()
}
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()
{
return( p_intf->p_sys->p_aout != NULL );
return( p_aout != NULL );
}
/* playback info */
......@@ -524,14 +646,14 @@ const char* Intf_VLCWrapper::getTimeAsString()
{
static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
if( p_intf->p_sys->p_input == NULL )
if( p_input == NULL )
{
return ("-:--:--");
}
input_OffsetToTime( p_intf->p_sys->p_input,
input_OffsetToTime( p_input,
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);
}
......@@ -540,10 +662,10 @@ float Intf_VLCWrapper::getTimeAsFloat()
{
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 /
(float)p_intf->p_sys->p_input->stream.p_selected_area->i_size;
f_time = (float)p_input->stream.p_selected_area->i_tell /
(float)p_input->stream.p_selected_area->i_size;
}
else
{
......@@ -554,10 +676,10 @@ float Intf_VLCWrapper::getTimeAsFloat()
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,
(long long int)(p_intf->p_sys->p_input->stream.p_selected_area->i_size
input_Seek( p_input,
(long long int)(p_input->stream.p_selected_area->i_size
* f_position / SEEKSLIDER_RANGE ),
INPUT_SEEK_SET);
}
......@@ -571,8 +693,6 @@ void Intf_VLCWrapper::setTimeAsFloat(float f_position)
BList *Intf_VLCWrapper::playlistAsArray()
{
int i;
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
BList* p_list = new BList(p_playlist->i_size);
vlc_mutex_lock( &p_playlist->object_lock );
......@@ -592,11 +712,11 @@ Intf_VLCWrapper::getPlaylistInfo( int32& currentIndex, int32& maxIndex )
{
currentIndex = -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 )
currentIndex = list->i_index + 1;
currentIndex = p_playlist->i_index + 1;
else
maxIndex = -1;
}
......@@ -608,17 +728,17 @@ Intf_VLCWrapper::getTitleInfo( int32& currentIndex, int32& maxIndex )
{
currentIndex = -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)
currentIndex = input->stream.p_selected_area->i_id;
currentIndex = p_input->stream.p_selected_area->i_id;
else
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 )
{
currentIndex = -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)
currentIndex = input->stream.p_selected_area->i_part;
currentIndex = p_input->stream.p_selected_area->i_part;
else
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 )
void Intf_VLCWrapper::openFiles( BList* o_files, bool replace )
{
BString *o_file;
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
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
BString o_source("");
o_source << o_type << ":" << o_device ;
playlist_t *p_playlist = p_intf->p_sys->p_playlist;
playlist_Add( p_playlist, o_source.String(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
......@@ -685,27 +803,27 @@ void Intf_VLCWrapper::toggleProgram(int i_program){}
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,
p_intf->p_sys->p_input->stream.pp_areas[i_title] );
input_ChangeArea( p_input,
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)
{
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;
input_ChangeArea( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.p_selected_area );
p_input->stream.p_selected_area->i_part = i_chapter;
input_ChangeArea( p_input,
p_input->stream.p_selected_area );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
vlc_mutex_lock( &p_input->stream.stream_lock );
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
}
......@@ -715,29 +833,29 @@ void Intf_VLCWrapper::toggleLanguage(int i_language)
int32 i_old = -1;
int i_cat = AUDIO_ES;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
vlc_mutex_lock( &p_input->stream.stream_lock );
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;
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);
if( i_language != -1 )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_language],
input_ToggleES( p_input,
p_input->stream.pp_selected_es[i_language],
VLC_TRUE );
}
if( (i_old != -1) && (i_old != i_language) )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
input_ToggleES( p_input,
p_input->stream.pp_selected_es[i_old],
VLC_FALSE );
}
}
......@@ -747,34 +865,34 @@ void Intf_VLCWrapper::toggleSubtitle(int i_subtitle)
int32 i_old = -1;
int i_cat = SPU_ES;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
vlc_mutex_lock( &p_input->stream.stream_lock );
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;
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);
if( i_subtitle != -1 )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_subtitle],
input_ToggleES( p_input,
p_input->stream.pp_selected_es[i_subtitle],
VLC_TRUE );
}
if( (i_old != -1) && (i_old != i_subtitle) )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
input_ToggleES( p_input,
p_input->stream.pp_selected_es[i_old],
VLC_FALSE );
}
}
int Intf_VLCWrapper::inputGetStatus()
{
return p_intf->p_sys->p_playlist->i_status;
return p_playlist->i_status;
}
......@@ -2,7 +2,7 @@
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.h,v 1.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>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -37,10 +37,6 @@ struct intf_sys_t
{
InterfaceWindow * p_window;
input_thread_t * p_input;
playlist_t * p_playlist;
aout_instance_t * p_aout;
/* DVD mode */
vlc_bool_t b_disabled_menus;
vlc_bool_t b_loop;
......@@ -49,7 +45,7 @@ struct intf_sys_t
int i_saved_volume;
int i_channel;
Intf_VLCWrapper * p_vlc_wrapper;
Intf_VLCWrapper * p_wrapper;
};
/*****************************************************************************
......@@ -57,7 +53,7 @@ struct intf_sys_t
*****************************************************************************
* 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
* in p_intf->p_sys->p_vlc_wrapper
* in p_intf->p_sys->p_wrapper
*****************************************************************************/
class Intf_VLCWrapper
{
......@@ -65,10 +61,20 @@ public:
Intf_VLCWrapper( intf_thread_t *p_intf );
~Intf_VLCWrapper();
bool UpdateInputAndAOut();
int inputGetStatus();
int InputStatus();
int InputRate();
int InputTell();
int InputSize();
void inputSeek();
/* playlist control */
int PlaylistSize();
char *PlaylistItemName( int );
int PlaylistCurrent();
bool playlistPlay();
void playlistPause();
void playlistStop();
......@@ -96,6 +102,14 @@ public:
void navigatePrev();
void navigateNext();
/* DVD */
bool HasTitles();
void PrevTitle();
void NextTitle();
bool HasChapters();
void PrevChapter();
void NextChapter();
/* Stream Control */
void playSlower();
void playFaster();
......@@ -133,6 +147,9 @@ public:
void channelPrev();
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