Commit 3b078b7b authored by Eric Petit's avatar Eric Petit

* AudioOutput.cpp: fixed a segfault

 * ALL: cleaned the VlcWrapper class, removed unused code
parent c19c673b
/***************************************************************************** /*****************************************************************************
* aout.cpp: BeOS audio output * AudioOutput.cpp: BeOS audio output
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: AudioOutput.cpp,v 1.16 2002/11/22 19:37:25 titer Exp $ * $Id: AudioOutput.cpp,v 1.17 2002/11/27 05:36:41 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>
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
#include <vlc/aout.h> #include <vlc/aout.h>
#include <aout_internal.h> #include <aout_internal.h>
#define FRAME_SIZE 2048 #define FRAME_SIZE 2048
#define BUFFER_SIZE 16384
/***************************************************************************** /*****************************************************************************
* aout_sys_t: BeOS audio output method descriptor * aout_sys_t: BeOS audio output method descriptor
...@@ -94,12 +95,12 @@ int E_(OpenAudio) ( vlc_object_t * p_this ) ...@@ -94,12 +95,12 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
#endif #endif
p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2'); p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2');
p_format->buffer_size = 16384; p_format->buffer_size = BUFFER_SIZE;
p_aout->output.i_nb_samples = FRAME_SIZE; p_aout->output.i_nb_samples = FRAME_SIZE;
p_aout->output.pf_play = DoNothing; p_aout->output.pf_play = DoNothing;
p_sys->p_player = new BSoundPlayer( p_format, "player", p_sys->p_player = new BSoundPlayer( p_format, "player",
Play, NULL, p_this ); Play, NULL, p_aout );
p_sys->p_player->Start(); p_sys->p_player->Start();
p_sys->p_player->SetHasData( true ); p_sys->p_player->SetHasData( true );
...@@ -122,22 +123,25 @@ void E_(CloseAudio) ( vlc_object_t *p_this ) ...@@ -122,22 +123,25 @@ void E_(CloseAudio) ( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* Play * Play
*****************************************************************************/ *****************************************************************************/
static void Play( void *aout, void *buffer, size_t size, static void Play( void *aout, void *p_buffer, size_t i_size,
const media_raw_audio_format &format ) const media_raw_audio_format &format )
{ {
aout_buffer_t * p_aout_buffer; aout_buffer_t * p_aout_buffer;
aout_instance_t *p_aout = (aout_instance_t*) aout; aout_instance_t *p_aout = (aout_instance_t*) aout;
float *p_buffer = (float*) buffer;
p_aout_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); p_aout_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo );
if( p_aout_buffer != NULL ) if( p_aout_buffer != NULL )
{ {
memcpy( p_buffer, /* sometimes p_aout_buffer is not NULL but still isn't valid.
p_aout_buffer->p_buffer, we check i_nb_bytes so we are sure it is */
MIN( size, p_aout_buffer->i_nb_bytes ) ); if( p_aout_buffer->i_nb_bytes == BUFFER_SIZE )
aout_BufferFree( p_aout_buffer ); {
memcpy( (float*)p_buffer,
p_aout_buffer->p_buffer,
BUFFER_SIZE );
aout_BufferFree( p_aout_buffer );
}
} }
} }
......
...@@ -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.5 2002/11/26 01:06:08 titer Exp $ * $Id: Interface.cpp,v 1.6 2002/11/27 05:36:41 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,7 +72,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -72,7 +72,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
return( 1 ); return( 1 );
} }
p_intf->p_sys->p_wrapper = new Intf_VLCWrapper( p_intf ); p_intf->p_sys->p_wrapper = new VlcWrapper( p_intf );
p_intf->pf_run = Run; p_intf->pf_run = Run;
......
...@@ -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.9 2002/11/26 01:06:08 titer Exp $ * $Id: InterfaceWindow.cpp,v 1.10 2002/11/27 05:36:41 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>
...@@ -212,7 +212,7 @@ InterfaceWindow::FrameResized(float width, float height) ...@@ -212,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_wrapper->inputGetStatus(); playback_status = p_wrapper->InputStatus();
switch( p_message->what ) switch( p_message->what )
{ {
...@@ -266,7 +266,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -266,7 +266,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{ {
p_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_wrapper->playlistStop(); p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
} }
break; break;
...@@ -283,18 +283,18 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -283,18 +283,18 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{ {
p_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_wrapper->playlistPause(); p_wrapper->PlaylistPause();
} }
else else
{ {
p_wrapper->volume_restore(); p_wrapper->volume_restore();
p_wrapper->playlistPlay(); p_wrapper->PlaylistPlay();
} }
} }
else else
{ {
/* Play a new file */ /* Play a new file */
p_wrapper->playlistPlay(); p_wrapper->PlaylistPlay();
} }
break; break;
...@@ -304,7 +304,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -304,7 +304,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{ {
p_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_wrapper->playFaster(); p_wrapper->InputFaster();
} }
break; break;
...@@ -314,7 +314,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -314,7 +314,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{ {
p_wrapper->volume_mute(); p_wrapper->volume_mute();
snooze( 400000 ); snooze( 400000 );
p_wrapper->playSlower(); p_wrapper->InputSlower();
} }
break; break;
...@@ -323,7 +323,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -323,7 +323,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
p_wrapper->volume_restore(); p_wrapper->volume_restore();
p_wrapper->playlistPlay(); p_wrapper->PlaylistPlay();
} }
break; break;
...@@ -411,10 +411,10 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -411,10 +411,10 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
} }
break; break;
case PREV_FILE: case PREV_FILE:
p_wrapper->playlistPrev(); p_wrapper->PlaylistPrev();
break; break;
case NEXT_FILE: case NEXT_FILE:
p_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:
...@@ -471,7 +471,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -471,7 +471,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
*****************************************************************************/ *****************************************************************************/
bool InterfaceWindow::QuitRequested() bool InterfaceWindow::QuitRequested()
{ {
p_wrapper->playlistStop(); p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
p_intf->b_die = 1; p_intf->b_die = 1;
......
...@@ -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.5 2002/11/26 01:06:08 titer Exp $ * $Id: InterfaceWindow.h,v 1.6 2002/11/27 05:36:41 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>
...@@ -152,7 +152,7 @@ class InterfaceWindow : public BWindow ...@@ -152,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_wrapper; 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.7 2002/11/26 01:06:08 titer Exp $ * $Id: MediaControlView.cpp,v 1.8 2002/11/27 05:36:41 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>
...@@ -1309,9 +1309,9 @@ PositionInfoView::Pulse() ...@@ -1309,9 +1309,9 @@ PositionInfoView::Pulse()
int32 index, size; int32 index, size;
p_intf->p_sys->p_wrapper->getPlaylistInfo( index, size ); p_intf->p_sys->p_wrapper->getPlaylistInfo( index, size );
SetFile( index, size ); SetFile( index, size );
p_intf->p_sys->p_wrapper->getTitleInfo( index, size ); p_intf->p_sys->p_wrapper->TitleInfo( index, size );
SetTitle( index, size ); SetTitle( index, size );
p_intf->p_sys->p_wrapper->getChapterInfo( index, size ); p_intf->p_sys->p_wrapper->ChapterInfo( index, size );
SetChapter( index, size ); SetChapter( index, size );
SetTime( p_intf->p_sys->p_wrapper->getTimeAsString() ); SetTime( p_intf->p_sys->p_wrapper->getTimeAsString() );
fLastPulseUpdate = now; fLastPulseUpdate = now;
......
...@@ -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.4 2002/11/26 01:06:08 titer Exp $ * $Id: PlayListWindow.h,v 1.5 2002/11/27 05:36:41 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>
...@@ -59,7 +59,7 @@ class PlayListWindow : public BWindow ...@@ -59,7 +59,7 @@ class PlayListWindow : public BWindow
InterfaceWindow * fMainWindow; InterfaceWindow * fMainWindow;
intf_thread_t * p_intf; intf_thread_t * p_intf;
Intf_VLCWrapper * p_wrapper; VlcWrapper * p_wrapper;
}; };
#endif // BEOS_PLAY_LIST_WINDOW_H #endif // BEOS_PLAY_LIST_WINDOW_H
......
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port ) * VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.h,v 1.7 2002/11/26 01:06:08 titer Exp $ * $Id: VlcWrapper.h,v 1.8 2002/11/27 05:36:41 titer Exp $
* *
* Authors: Florian G. Pflug <fgp@phlo.org> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define SEEKSLIDER_RANGE 2048 #define SEEKSLIDER_RANGE 2048
class InterfaceWindow; class InterfaceWindow;
class Intf_VLCWrapper; class VlcWrapper;
/***************************************************************************** /*****************************************************************************
* intf_sys_t: internal variables of the BeOS interface * intf_sys_t: internal variables of the BeOS interface
...@@ -37,7 +37,6 @@ struct intf_sys_t ...@@ -37,7 +37,6 @@ struct intf_sys_t
{ {
InterfaceWindow * p_window; InterfaceWindow * p_window;
/* DVD mode */
vlc_bool_t b_disabled_menus; vlc_bool_t b_disabled_menus;
vlc_bool_t b_loop; vlc_bool_t b_loop;
vlc_bool_t b_mute; vlc_bool_t b_mute;
...@@ -45,76 +44,65 @@ struct intf_sys_t ...@@ -45,76 +44,65 @@ struct intf_sys_t
int i_saved_volume; int i_saved_volume;
int i_channel; int i_channel;
Intf_VLCWrapper * p_wrapper; VlcWrapper * p_wrapper;
}; };
/***************************************************************************** /*****************************************************************************
* Intf_VLCWrapper * VlcWrapper
***************************************************************************** *****************************************************************************
* 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 VlcWrapper instance at any time, which is stored
* in p_intf->p_sys->p_wrapper * in p_intf->p_sys->p_wrapper
*****************************************************************************/ *****************************************************************************/
class Intf_VLCWrapper class VlcWrapper
{ {
public: public:
Intf_VLCWrapper( intf_thread_t *p_intf ); VlcWrapper( intf_thread_t *p_intf );
~Intf_VLCWrapper(); ~VlcWrapper();
bool UpdateInputAndAOut(); bool UpdateInputAndAOut();
int inputGetStatus(); /* input */
int InputStatus(); int InputStatus();
int InputRate(); int InputRate();
int InputTell(); int InputTell();
int InputSize(); int InputSize();
void inputSeek(); void InputSlower();
void InputFaster();
/* playlist control */ void openFiles( BList *o_files, bool replace = true );
void openDisc( BString o_type, BString o_device,
int i_title, int i_chapter );
void toggleLanguage( int i_language );
void toggleSubtitle( int i_subtitle );
const char* getTimeAsString();
float getTimeAsFloat();
void setTimeAsFloat( float i_offset );
/* Playlist */
int PlaylistSize(); int PlaylistSize();
char *PlaylistItemName( int ); char *PlaylistItemName( int );
int PlaylistCurrent(); int PlaylistCurrent();
int PlaylistStatus();
bool playlistPlay(); bool PlaylistPlay();
void playlistPause(); void PlaylistPause();
void playlistStop(); void PlaylistStop();
void playlistNext(); void PlaylistNext();
void playlistPrev(); void PlaylistPrev();
void playlistJumpTo( int ); void PlaylistSkip(int i);
int playlistSize(); void PlaylistGoto(int i);
int playlistCurrentPos(); void PlaylistLoop();
void playlistLock(); BList* PlaylistAsArray();
void playlistUnlock(); bool PlaylistPlaying();
void playlistSkip(int i); void getPlaylistInfo( int32& currentIndex,
void playlistGoto(int i);
void loop();
bool playlistPlaying();
BList* playlistAsArray();
void getPlaylistInfo( int32& currentIndex,
int32& maxIndex ); int32& maxIndex );
void getTitleInfo( int32& currentIndex, void PlaylistJumpTo( int );
int32& maxIndex );
void getChapterInfo( int32& currentIndex,
int32& maxIndex );
void getNavCapabilities( bool* canSkipPrev, void getNavCapabilities( bool* canSkipPrev,
bool* canSkipNext ); bool* canSkipNext );
void navigatePrev(); void navigatePrev();
void navigateNext(); void navigateNext();
/* DVD */ /* audio */
bool HasTitles();
void PrevTitle();
void NextTitle();
bool HasChapters();
void PrevChapter();
void NextChapter();
/* Stream Control */
void playSlower();
void playFaster();
/* playback control */
void volume_mute(); void volume_mute();
void volume_restore(); void volume_restore();
void set_volume(int value); void set_volume(int value);
...@@ -123,29 +111,19 @@ public: ...@@ -123,29 +111,19 @@ public:
bool is_playing(); bool is_playing();
void maxvolume(); void maxvolume();
bool has_audio(); bool has_audio();
/* playback info */
const char* getTimeAsString();
float getTimeAsFloat();
void setTimeAsFloat( float i_offset );
/* open file/disc/network */ /* DVD */
void openFiles( BList *o_files, bool replace = true ); bool HasTitles();
void openDisc( BString o_type, BString o_device, void PrevTitle();
int i_title, int i_chapter ); void NextTitle();
void openNet( BString o_addr, int i_port ); bool HasChapters();
void openNetChannel( BString o_addr, int i_port ); void PrevChapter();
void openNetHTTP( BString o_addr ); void NextChapter();
void TitleInfo( int32& currentIndex, int32& maxIndex );
/* menus management */ void ChapterInfo( int32& currentIndex, int32& maxIndex );
void toggleProgram( int i_program );
void toggleTitle( int i_title ); void toggleTitle( int i_title );
void toggleChapter( int i_chapter ); void toggleChapter( int i_chapter );
void toggleLanguage( int i_language );
void toggleSubtitle( int i_subtitle );
void channelNext();
void channelPrev();
private: private:
intf_thread_t * p_intf; intf_thread_t * p_intf;
input_thread_t * p_input; input_thread_t * p_input;
......
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