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
* $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>
* Samuel Hocevar <sam@zoy.org>
......@@ -38,7 +38,8 @@
#include <vlc/aout.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
......@@ -94,12 +95,12 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
#endif
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.pf_play = DoNothing;
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->SetHasData( true );
......@@ -122,22 +123,25 @@ void E_(CloseAudio) ( vlc_object_t *p_this )
/*****************************************************************************
* 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 )
{
aout_buffer_t * p_aout_buffer;
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 );
if( p_aout_buffer != NULL )
{
memcpy( p_buffer,
p_aout_buffer->p_buffer,
MIN( size, p_aout_buffer->i_nb_bytes ) );
aout_BufferFree( p_aout_buffer );
/* sometimes p_aout_buffer is not NULL but still isn't valid.
we check i_nb_bytes so we are sure it is */
if( p_aout_buffer->i_nb_bytes == BUFFER_SIZE )
{
memcpy( (float*)p_buffer,
p_aout_buffer->p_buffer,
BUFFER_SIZE );
aout_BufferFree( p_aout_buffer );
}
}
}
......
......@@ -2,7 +2,7 @@
* intf_beos.cpp: beos interface
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -72,7 +72,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
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;
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -212,7 +212,7 @@ InterfaceWindow::FrameResized(float width, float height)
void InterfaceWindow::MessageReceived( BMessage * p_message )
{
int playback_status; // remember playback state
playback_status = p_wrapper->inputGetStatus();
playback_status = p_wrapper->InputStatus();
switch( p_message->what )
{
......@@ -266,7 +266,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
p_wrapper->volume_mute();
snooze( 400000 );
p_wrapper->playlistStop();
p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
}
break;
......@@ -283,18 +283,18 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
p_wrapper->volume_mute();
snooze( 400000 );
p_wrapper->playlistPause();
p_wrapper->PlaylistPause();
}
else
{
p_wrapper->volume_restore();
p_wrapper->playlistPlay();
p_wrapper->PlaylistPlay();
}
}
else
{
/* Play a new file */
p_wrapper->playlistPlay();
p_wrapper->PlaylistPlay();
}
break;
......@@ -304,7 +304,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
p_wrapper->volume_mute();
snooze( 400000 );
p_wrapper->playFaster();
p_wrapper->InputFaster();
}
break;
......@@ -314,7 +314,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
p_wrapper->volume_mute();
snooze( 400000 );
p_wrapper->playSlower();
p_wrapper->InputSlower();
}
break;
......@@ -323,7 +323,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
if (playback_status > UNDEF_S)
{
p_wrapper->volume_restore();
p_wrapper->playlistPlay();
p_wrapper->PlaylistPlay();
}
break;
......@@ -411,10 +411,10 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
}
break;
case PREV_FILE:
p_wrapper->playlistPrev();
p_wrapper->PlaylistPrev();
break;
case NEXT_FILE:
p_wrapper->playlistNext();
p_wrapper->PlaylistNext();
break;
// general next/prev functionality (skips to whatever makes most sense)
case NAVIGATE_PREV:
......@@ -471,7 +471,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
*****************************************************************************/
bool InterfaceWindow::QuitRequested()
{
p_wrapper->playlistStop();
p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
p_intf->b_die = 1;
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* 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>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -152,7 +152,7 @@ class InterfaceWindow : public BWindow
BMessage* fSettings; // we keep the message arround
// for forward compatibility
Intf_VLCWrapper * p_wrapper;
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.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>
* Stephan Aßmus <stippi@yellowbites.com>
......@@ -1309,9 +1309,9 @@ PositionInfoView::Pulse()
int32 index, size;
p_intf->p_sys->p_wrapper->getPlaylistInfo( 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 );
p_intf->p_sys->p_wrapper->getChapterInfo( index, size );
p_intf->p_sys->p_wrapper->ChapterInfo( index, size );
SetChapter( index, size );
SetTime( p_intf->p_sys->p_wrapper->getTimeAsString() );
fLastPulseUpdate = now;
......
......@@ -2,7 +2,7 @@
* PlayListWindow.h: BeOS interface window class prototype
*****************************************************************************
* 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>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -59,7 +59,7 @@ class PlayListWindow : public BWindow
InterfaceWindow * fMainWindow;
intf_thread_t * p_intf;
Intf_VLCWrapper * p_wrapper;
VlcWrapper * p_wrapper;
};
#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
* $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>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -28,7 +28,7 @@
#define SEEKSLIDER_RANGE 2048
class InterfaceWindow;
class Intf_VLCWrapper;
class VlcWrapper;
/*****************************************************************************
* intf_sys_t: internal variables of the BeOS interface
......@@ -37,7 +37,6 @@ struct intf_sys_t
{
InterfaceWindow * p_window;
/* DVD mode */
vlc_bool_t b_disabled_menus;
vlc_bool_t b_loop;
vlc_bool_t b_mute;
......@@ -45,76 +44,65 @@ struct intf_sys_t
int i_saved_volume;
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.
* 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
*****************************************************************************/
class Intf_VLCWrapper
class VlcWrapper
{
public:
Intf_VLCWrapper( intf_thread_t *p_intf );
~Intf_VLCWrapper();
VlcWrapper( intf_thread_t *p_intf );
~VlcWrapper();
bool UpdateInputAndAOut();
int inputGetStatus();
/* input */
int InputStatus();
int InputRate();
int InputTell();
int InputSize();
void inputSeek();
/* playlist control */
void InputSlower();
void InputFaster();
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();
char *PlaylistItemName( int );
int PlaylistCurrent();
bool playlistPlay();
void playlistPause();
void playlistStop();
void playlistNext();
void playlistPrev();
void playlistJumpTo( int );
int playlistSize();
int playlistCurrentPos();
void playlistLock();
void playlistUnlock();
void playlistSkip(int i);
void playlistGoto(int i);
void loop();
bool playlistPlaying();
BList* playlistAsArray();
void getPlaylistInfo( int32& currentIndex,
int PlaylistStatus();
bool PlaylistPlay();
void PlaylistPause();
void PlaylistStop();
void PlaylistNext();
void PlaylistPrev();
void PlaylistSkip(int i);
void PlaylistGoto(int i);
void PlaylistLoop();
BList* PlaylistAsArray();
bool PlaylistPlaying();
void getPlaylistInfo( int32& currentIndex,
int32& maxIndex );
void getTitleInfo( int32& currentIndex,
int32& maxIndex );
void getChapterInfo( int32& currentIndex,
int32& maxIndex );
void PlaylistJumpTo( int );
void getNavCapabilities( bool* canSkipPrev,
bool* canSkipNext );
void navigatePrev();
void navigateNext();
/* DVD */
bool HasTitles();
void PrevTitle();
void NextTitle();
bool HasChapters();
void PrevChapter();
void NextChapter();
/* Stream Control */
void playSlower();
void playFaster();
/* playback control */
/* audio */
void volume_mute();
void volume_restore();
void set_volume(int value);
......@@ -123,29 +111,19 @@ public:
bool is_playing();
void maxvolume();
bool has_audio();
/* playback info */
const char* getTimeAsString();
float getTimeAsFloat();
void setTimeAsFloat( float i_offset );
/* open file/disc/network */
void openFiles( BList *o_files, bool replace = true );
void openDisc( BString o_type, BString o_device,
int i_title, int i_chapter );
void openNet( BString o_addr, int i_port );
void openNetChannel( BString o_addr, int i_port );
void openNetHTTP( BString o_addr );
/* menus management */
void toggleProgram( int i_program );
/* DVD */
bool HasTitles();
void PrevTitle();
void NextTitle();
bool HasChapters();
void PrevChapter();
void NextChapter();
void TitleInfo( int32& currentIndex, int32& maxIndex );
void ChapterInfo( int32& currentIndex, int32& maxIndex );
void toggleTitle( int i_title );
void toggleChapter( int i_chapter );
void toggleLanguage( int i_language );
void toggleSubtitle( int i_subtitle );
void channelNext();
void channelPrev();
private:
intf_thread_t * p_intf;
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