Commit 372bb66a authored by Eric Petit's avatar Eric Petit

- Fixes. Most of the interface features now work again.

parent 2ea2975b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout.cpp: BeOS audio output * aout.cpp: BeOS audio output
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: AudioOutput.cpp,v 1.13 2002/10/21 20:00:09 massiot Exp $ * $Id: AudioOutput.cpp,v 1.14 2002/10/30 06:12:27 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>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/aout.h> #include <vlc/aout.h>
#include "aout_internal.h" #include <aout_internal.h>
#define FRAME_SIZE 2048 #define FRAME_SIZE 2048
...@@ -79,7 +79,7 @@ int E_(OpenAudio) ( vlc_object_t * p_this ) ...@@ -79,7 +79,7 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
i_nb_channels = aout_FormatNbChannels( &p_aout->output.output ); i_nb_channels = aout_FormatNbChannels( &p_aout->output.output );
if ( i_nb_channels > 2 ) if ( i_nb_channels > 2 )
{ {
/* I don't know if BeOS supports more than two channels. --Meuuh */ /* BSoundPlayer does not support more than 2 channels AFAIK */
i_nb_channels = 2; i_nb_channels = 2;
p_aout->output.output.i_channels = AOUT_CHAN_STEREO; p_aout->output.output.i_channels = AOUT_CHAN_STEREO;
} }
......
...@@ -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.3 2002/10/10 23:11:52 titer Exp $ * $Id: Interface.cpp,v 1.4 2002/10/30 06:12:27 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>
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include <vlc/aout.h>
#include <aout_internal.h>
#include "VlcWrapper.h" #include "VlcWrapper.h"
#include "InterfaceWindow.h" #include "InterfaceWindow.h"
...@@ -71,10 +73,11 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -71,10 +73,11 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
} }
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
p_intf->p_sys->p_vlc_wrapper = new Intf_VLCWrapper( p_intf ); p_intf->p_sys->p_aout = NULL;
p_intf->p_sys->p_playlist = p_intf->p_sys->p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
p_intf->p_sys->p_vlc_wrapper = new Intf_VLCWrapper( p_intf );
p_intf->pf_run = Run; p_intf->pf_run = Run;
...@@ -112,6 +115,16 @@ void E_(CloseIntf) ( vlc_object_t *p_this ) ...@@ -112,6 +115,16 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
vlc_object_release( 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();
...@@ -132,7 +145,13 @@ static void Run( intf_thread_t *p_intf ) ...@@ -132,7 +145,13 @@ static void Run( intf_thread_t *p_intf )
{ {
p_intf->p_sys->p_input = p_intf->p_sys->p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); 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 */ /* Update the input */
...@@ -142,8 +161,14 @@ static void Run( intf_thread_t *p_intf ) ...@@ -142,8 +161,14 @@ static void Run( intf_thread_t *p_intf )
{ {
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL; 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.6 2002/10/29 17:33:11 titer Exp $ * $Id: InterfaceWindow.cpp,v 1.7 2002/10/30 06:12:27 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>
...@@ -68,8 +68,8 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -68,8 +68,8 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fSettings( new BMessage( 'sett' ) ) fSettings( new BMessage( 'sett' ) )
{ {
p_intf = p_interface; p_intf = p_interface;
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = p_intf->p_sys->p_playlist;
FIND_ANYWHERE );
fPlaylistIsEmpty = (p_playlist->i_size < 0); fPlaylistIsEmpty = (p_playlist->i_size < 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 ),
...@@ -169,15 +169,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -169,15 +169,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fSettingsMenu = new BMenu( "Settings" ); fSettingsMenu = new BMenu( "Settings" );
fSettingsMenu->AddItem( fPreferencesMI = fSettingsMenu->AddItem( fPreferencesMI =
new BMenuItem( "Preferences", new BMessage( OPEN_PREFERENCES ) ) ); new BMenuItem( "Preferences", new BMessage( OPEN_PREFERENCES ) ) );
fMenuBar->AddItem( fSettingsMenu ); fMenuBar->AddItem( fSettingsMenu );
/* Add the Config menu */
// BMenu* configMenu = new BMenu( "Config" );
// menu_bar->AddItem( configMenu );
// fOnTopMI = new BMenuItem( "Always on Top",
// new BMessage( TOGGLE_ON_TOP ) )
// configMenu->AddItem( );
// fOnTopMI->SetMarked(false);
// prepare fow showing // prepare fow showing
_SetMenusEnabled(false); _SetMenusEnabled(false);
...@@ -571,8 +563,8 @@ void InterfaceWindow::updateInterface() ...@@ -571,8 +563,8 @@ void InterfaceWindow::updateInterface()
else else
_SetMenusEnabled(false); _SetMenusEnabled(false);
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = p_intf->p_sys->p_playlist;
FIND_ANYWHERE );
if ( fPlaylistIsEmpty != ( p_playlist->i_size < 0) ) if ( fPlaylistIsEmpty != ( p_playlist->i_size < 0) )
{ {
if ( Lock() ) if ( Lock() )
...@@ -607,8 +599,7 @@ InterfaceWindow::_UpdatePlaylist() ...@@ -607,8 +599,7 @@ InterfaceWindow::_UpdatePlaylist()
{ {
fPlaylistWindow->UpdatePlaylist( true ); fPlaylistWindow->UpdatePlaylist( true );
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = p_intf->p_sys->p_playlist;
FIND_ANYWHERE );
fPlaylistIsEmpty = p_playlist->i_size < 1; fPlaylistIsEmpty = p_playlist->i_size < 1;
p_mediaControl->SetEnabled( !fPlaylistIsEmpty ); p_mediaControl->SetEnabled( !fPlaylistIsEmpty );
} }
......
...@@ -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.9 2002/10/30 00:59:22 titer Exp $ * $Id: VlcWrapper.cpp,v 1.10 2002/10/30 06:12:27 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>
...@@ -46,21 +46,17 @@ Intf_VLCWrapper::~Intf_VLCWrapper() ...@@ -46,21 +46,17 @@ Intf_VLCWrapper::~Intf_VLCWrapper()
/* playlist control */ /* playlist control */
bool Intf_VLCWrapper::playlistPlay() bool Intf_VLCWrapper::playlistPlay()
{ {
playlist_t *p_playlist = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size ) if( p_playlist->i_size )
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist ); playlist_Play( p_playlist );
vlc_object_release( p_playlist );
} }
else else
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
} }
return( true ); return( true );
...@@ -68,61 +64,46 @@ bool Intf_VLCWrapper::playlistPlay() ...@@ -68,61 +64,46 @@ bool Intf_VLCWrapper::playlistPlay()
void Intf_VLCWrapper::playlistPause() void Intf_VLCWrapper::playlistPause()
{ {
toggle_mute( ); toggle_mute();
playlist_t *p_playlist = if( p_intf->p_sys->p_input )
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, {
FIND_ANYWHERE ); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
playlist_Pause( p_playlist ); }
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::playlistStop() void Intf_VLCWrapper::playlistStop()
{ {
playlist_t *p_playlist = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Stop( p_playlist ); playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::playlistNext() void Intf_VLCWrapper::playlistNext()
{ {
playlist_t *p_playlist = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Next( p_playlist ); playlist_Next( p_playlist );
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::playlistPrev() void Intf_VLCWrapper::playlistPrev()
{ {
playlist_t *p_playlist = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Prev( p_playlist ); playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::playlistSkip(int i) void Intf_VLCWrapper::playlistSkip(int i)
{ {
playlist_t *p_playlist = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Skip( p_playlist, i ); playlist_Skip( p_playlist, i );
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::playlistGoto(int i) void Intf_VLCWrapper::playlistGoto(int i)
{ {
playlist_t *p_playlist = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Goto( p_playlist, i ); playlist_Goto( p_playlist, i );
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::playlistJumpTo( int pos ) void Intf_VLCWrapper::playlistJumpTo( int pos )
...@@ -416,9 +397,6 @@ void Intf_VLCWrapper::playFaster() ...@@ -416,9 +397,6 @@ void Intf_VLCWrapper::playFaster()
void Intf_VLCWrapper::volume_mute() void Intf_VLCWrapper::volume_mute()
{ {
p_intf->p_sys->p_aout =
(aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_intf->p_sys->p_aout != NULL ) if( p_intf->p_sys->p_aout != NULL )
{ {
if( !p_intf->p_sys->b_mute ) if( !p_intf->p_sys->b_mute )
...@@ -433,9 +411,6 @@ void Intf_VLCWrapper::volume_mute() ...@@ -433,9 +411,6 @@ void Intf_VLCWrapper::volume_mute()
void Intf_VLCWrapper::volume_restore() void Intf_VLCWrapper::volume_restore()
{ {
p_intf->p_sys->p_aout =
(aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_intf->p_sys->p_aout != NULL ) if( p_intf->p_sys->p_aout != NULL )
{ {
p_intf->p_sys->p_aout->output.i_volume = p_intf->p_sys->i_saved_volume; p_intf->p_sys->p_aout->output.i_volume = p_intf->p_sys->i_saved_volume;
...@@ -447,9 +422,6 @@ void Intf_VLCWrapper::volume_restore() ...@@ -447,9 +422,6 @@ void Intf_VLCWrapper::volume_restore()
void Intf_VLCWrapper::set_volume(int value) void Intf_VLCWrapper::set_volume(int value)
{ {
p_intf->p_sys->p_aout =
(aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_intf->p_sys->p_aout != NULL ) if( p_intf->p_sys->p_aout != NULL )
{ {
// make sure value is within bounds // make sure value is within bounds
...@@ -470,9 +442,6 @@ void Intf_VLCWrapper::set_volume(int value) ...@@ -470,9 +442,6 @@ void Intf_VLCWrapper::set_volume(int value)
void Intf_VLCWrapper::toggle_mute() void Intf_VLCWrapper::toggle_mute()
{ {
p_intf->p_sys->p_aout =
(aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_intf->p_sys->p_aout != NULL ) if( p_intf->p_sys->p_aout != NULL )
{ {
if ( p_intf->p_sys->b_mute ) if ( p_intf->p_sys->b_mute )
...@@ -490,9 +459,6 @@ bool Intf_VLCWrapper::is_muted() ...@@ -490,9 +459,6 @@ bool Intf_VLCWrapper::is_muted()
{ {
bool muted = true; bool muted = true;
p_intf->p_sys->p_aout =
(aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_intf->p_sys->p_aout != NULL ) if( p_intf->p_sys->p_aout != NULL )
{ {
vlc_mutex_lock( &p_intf->p_sys->p_aout->mixer_lock ); vlc_mutex_lock( &p_intf->p_sys->p_aout->mixer_lock );
...@@ -534,9 +500,6 @@ bool Intf_VLCWrapper::is_playing() ...@@ -534,9 +500,6 @@ bool Intf_VLCWrapper::is_playing()
void Intf_VLCWrapper::maxvolume() void Intf_VLCWrapper::maxvolume()
{ {
p_intf->p_sys->p_aout =
(aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_intf->p_sys->p_aout != NULL ) if( p_intf->p_sys->p_aout != NULL )
{ {
if( p_intf->p_sys->b_mute ) if( p_intf->p_sys->b_mute )
...@@ -552,9 +515,6 @@ void Intf_VLCWrapper::maxvolume() ...@@ -552,9 +515,6 @@ void Intf_VLCWrapper::maxvolume()
bool Intf_VLCWrapper::has_audio() bool Intf_VLCWrapper::has_audio()
{ {
p_intf->p_sys->p_aout =
(aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
return( p_intf->p_sys->p_aout != NULL ); return( p_intf->p_sys->p_aout != NULL );
} }
...@@ -611,9 +571,7 @@ void Intf_VLCWrapper::setTimeAsFloat(float f_position) ...@@ -611,9 +571,7 @@ void Intf_VLCWrapper::setTimeAsFloat(float f_position)
BList *Intf_VLCWrapper::playlistAsArray() BList *Intf_VLCWrapper::playlistAsArray()
{ {
int i; int i;
playlist_t *p_playlist = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
BList* p_list = new BList(p_playlist->i_size); BList* p_list = new BList(p_playlist->i_size);
...@@ -625,7 +583,6 @@ BList *Intf_VLCWrapper::playlistAsArray() ...@@ -625,7 +583,6 @@ BList *Intf_VLCWrapper::playlistAsArray()
} }
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
return( p_list ); return( p_list );
} }
...@@ -698,8 +655,6 @@ void Intf_VLCWrapper::openFiles( BList* o_files, bool replace ) ...@@ -698,8 +655,6 @@ void Intf_VLCWrapper::openFiles( BList* o_files, bool replace )
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
delete o_file; delete o_file;
} }
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_chapter) void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_chapter)
...@@ -707,12 +662,9 @@ void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, in ...@@ -707,12 +662,9 @@ 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 = playlist_t *p_playlist = p_intf->p_sys->p_playlist;
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
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 );
vlc_object_release( p_playlist );
} }
void Intf_VLCWrapper::openNet(BString o_addr, int i_port) void Intf_VLCWrapper::openNet(BString o_addr, int i_port)
...@@ -824,5 +776,5 @@ void Intf_VLCWrapper::toggleSubtitle(int i_subtitle) ...@@ -824,5 +776,5 @@ void Intf_VLCWrapper::toggleSubtitle(int i_subtitle)
int Intf_VLCWrapper::inputGetStatus() int Intf_VLCWrapper::inputGetStatus()
{ {
return 0; return p_intf->p_sys->p_playlist->i_status;
} }
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