Commit 49173f5e authored by Stephan Assmus's avatar Stephan Assmus

Changes done since Feb 28 2003:

parent 46e7a04e
......@@ -2,7 +2,7 @@
* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: Interface.cpp,v 1.8 2003/01/25 20:15:41 titer Exp $
* $Id: Interface.cpp,v 1.9 2003/02/01 12:01:10 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -70,14 +70,12 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
p_intf->pf_run = Run;
/* Create the interface window */
BScreen *screen;
screen = new BScreen();
BRect rect = screen->Frame();
BScreen screen(B_MAIN_SCREEN_ID);
BRect rect = screen.Frame();
rect.top = rect.bottom-100;
rect.bottom -= 50;
rect.left += 50;
rect.right = rect.left + 350;
delete screen;
p_intf->p_sys->p_window =
new InterfaceWindow( rect,
VOUT_TITLE " (BeOS interface)", p_intf );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.10 2003/01/25 20:15:41 titer Exp $
* $Id: InterfaceWindow.h,v 1.11 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -36,6 +36,7 @@ class PlayListWindow;
class BFilePanel;
class PreferencesWindow;
class MessagesWindow;
class VlcWrapper;
class CDMenu : public BMenu
{
......@@ -60,8 +61,6 @@ class LanguageMenu : public BMenu
virtual void AttachedToWindow();
private:
void _GetChannels();
VlcWrapper * p_wrapper;
int kind;
};
......@@ -115,13 +114,16 @@ class InterfaceWindow : public BWindow
bool hasTitles = false );
void _UpdateSpeedMenu( int rate );
void _InputStreamChanged();
void _ShowFilePanel( uint32 command,
const char* windowTitle );
void _RestoreSettings();
void _StoreSettings();
intf_thread_t* p_intf;
es_descriptor_t* p_spu_es;
bool fPlaylistIsEmpty;
BFilePanel* fFilePanel;
BFilePanel* fSubtitlesPanel;
PlayListWindow* fPlaylistWindow;
PreferencesWindow* fPreferencesWindow;
MessagesWindow* fMessagesWindow;
......@@ -143,8 +145,20 @@ class InterfaceWindow : public BWindow
BMenu* fSpeedMenu;
BMenu* fShowMenu;
bigtime_t fLastUpdateTime;
VlcWrapper * p_wrapper;
BMessage* fSettings; // we keep the message arround
// for forward compatibility
VlcWrapper* p_wrapper;
};
// some global support functions
status_t load_settings( BMessage* message,
const char* fileName,
const char* folder = NULL );
status_t save_settings( BMessage* message,
const char* fileName,
const char* folder = NULL );
#endif // BEOS_INTERFACE_WINDOW_H
This diff is collapsed.
......@@ -2,7 +2,7 @@
* ListViews.h: BeOS interface list view class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: ListViews.h,v 1.2 2003/01/22 01:13:22 titer Exp $
* $Id: ListViews.h,v 1.3 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Stephan Aßmus <stippi@yellowbites.com>
*
......@@ -73,13 +73,28 @@ class DragSortableListView : public BListView
bool complete = false);
// DragSortableListView
virtual void ModifiersChanged(); // called by window
virtual void MoveItems( BList& items, int32 toIndex );
virtual void CopyItems( BList& items, int32 toIndex );
virtual void RemoveItemList( BList& indices );
void RemoveSelected(); // uses RemoveItemList()
virtual BListItem* CloneItem( int32 atIndex ) const = 0;
virtual void DrawListItem( BView* owner, int32 index,
BRect itemFrame ) const = 0;
virtual void MakeDragMessage( BMessage* message ) const = 0;
private:
int32 fDropIndex;
void _SetDropAnticipationRect( BRect r );
void _SetDropIndex( int32 index );
void _RemoveDropAnticipationRect();
BRect fDropRect;
BMessage fDragMessageCopy;
protected:
int32 fDropIndex;
};
// PlaylistView
......@@ -88,16 +103,23 @@ class PlaylistView : public DragSortableListView
public:
PlaylistView( BRect frame,
InterfaceWindow* mainWindow,
VlcWrapper * p_wrapper );
VlcWrapper* wrapper,
BMessage* selectionChangeMessage = NULL );
~PlaylistView();
// BListView
virtual void AttachedToWindow();
virtual void MessageReceived( BMessage* message );
virtual void MouseDown( BPoint where );
virtual void KeyDown( const char* bytes, int32 numBytes );
virtual void Pulse();
virtual void SelectionChanged();
// DragSortableListView
virtual void MoveItems( BList& items, int32 toIndex );
virtual void CopyItems( BList& items, int32 toIndex );
virtual void RemoveItemList( BList& indices );
virtual BListItem* CloneItem( int32 atIndex ) const;
virtual void DrawListItem( BView* owner, int32 index,
BRect itemFrame ) const;
......@@ -106,13 +128,15 @@ class PlaylistView : public DragSortableListView
// PlaylistView
void SetCurrent( int32 index );
void SetPlaying( bool playing );
void RebuildList();
private:
int32 fCurrentIndex;
bool fPlaying;
InterfaceWindow* fMainWindow;
BMessage* fSelectionChangeMessage;
VlcWrapper * p_wrapper;
VlcWrapper* fVlcWrapper;
};
#endif // LIST_VIEWS_H
......@@ -2,7 +2,7 @@
* MediaControlView.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MediaControlView.cpp,v 1.13 2003/01/25 01:03:44 titer Exp $
* $Id: MediaControlView.cpp,v 1.14 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com>
......@@ -773,9 +773,11 @@ SeekSlider::ResizeToPreferred()
void
SeekSlider::SetPosition(float position)
{
LockLooper();
SetValue(fMinValue + (int32)floorf((fMaxValue - fMinValue) * position + 0.5));
UnlockLooper();
if ( LockLooper() )
{
SetValue(fMinValue + (int32)floorf((fMaxValue - fMinValue) * position + 0.5));
UnlockLooper();
}
}
/*****************************************************************************
......@@ -1321,7 +1323,7 @@ PositionInfoView::Pulse()
{
int32 index, size;
p_intf->p_sys->p_wrapper->GetPlaylistInfo( index, size );
SetFile( index, size );
SetFile( index + 1, size );
p_intf->p_sys->p_wrapper->TitleInfo( index, size );
SetTitle( index, size );
p_intf->p_sys->p_wrapper->ChapterInfo( index, size );
......
......@@ -2,7 +2,7 @@
* MessagesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MessagesWindow.cpp,v 1.5 2003/01/31 06:45:00 titer Exp $
* $Id: MessagesWindow.cpp,v 1.6 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -147,17 +147,19 @@ void MessagesWindow::UpdateMessages()
case VLC_OBJECT_SOUT: psz_module_type = "stream output"; break;
}
fMessagesView->LockLooper();
oldLength = fMessagesView->TextLength();
BString string;
string << p_sub->p_msg[i_start].psz_module << " " << psz_module_type << " : " <<
p_sub->p_msg[i_start].psz_msg << "\n";
fMessagesView->Insert( string.String() );
fMessagesView->SetFontAndColor( oldLength,
fMessagesView->TextLength(),
NULL, 0, &color );
fMessagesView->Draw( fMessagesView->Bounds() );
fMessagesView->UnlockLooper();
if ( fMessagesView->LockLooper() )
{
oldLength = fMessagesView->TextLength();
BString string;
string << p_sub->p_msg[i_start].psz_module << " " << psz_module_type << " : " <<
p_sub->p_msg[i_start].psz_msg << "\n";
fMessagesView->Insert( string.String() );
fMessagesView->SetFontAndColor( oldLength,
fMessagesView->TextLength(),
NULL, 0, &color );
fMessagesView->Draw( fMessagesView->Bounds() );
fMessagesView->UnlockLooper();
}
/* Scroll at the end */
if( fScrollBar->LockLooper() )
......
......@@ -2,7 +2,7 @@
* PlayListWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PlayListWindow.cpp,v 1.6 2003/01/22 01:13:22 titer Exp $
* $Id: PlayListWindow.cpp,v 1.7 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -43,13 +43,15 @@
enum
{
MSG_SELECT_ALL = 'sall',
MSG_SELECT_NONE = 'none',
MSG_RANDOMIZE = 'rndm',
MSG_SORT_NAME = 'srtn',
MSG_SORT_PATH = 'srtp',
MSG_REMOVE = 'rmov',
MSG_REMOVE_ALL = 'rmal',
MSG_SELECT_ALL = 'sall',
MSG_SELECT_NONE = 'none',
MSG_RANDOMIZE = 'rndm',
MSG_SORT_NAME = 'srtn',
MSG_SORT_PATH = 'srtp',
MSG_REMOVE = 'rmov',
MSG_REMOVE_ALL = 'rmal',
MSG_SELECTION_CHANGED = 'slch',
};
......@@ -93,32 +95,33 @@ PlayListWindow::PlayListWindow( BRect frame, const char* name,
// Add the Edit menu
BMenu *editMenu = new BMenu( "Edit" );
fMenuBar->AddItem( editMenu );
item = new BMenuItem( "Select All",
new BMessage( MSG_SELECT_ALL ), 'A' );
editMenu->AddItem( item );
item = new BMenuItem( "Select None",
new BMessage( MSG_SELECT_NONE ), 'A', B_SHIFT_KEY );
editMenu->AddItem( item );
fSelectAllMI = new BMenuItem( "Select All",
new BMessage( MSG_SELECT_ALL ), 'A' );
editMenu->AddItem( fSelectAllMI );
fSelectNoneMI = new BMenuItem( "Select None",
new BMessage( MSG_SELECT_NONE ), 'A', B_SHIFT_KEY );
editMenu->AddItem( fSelectNoneMI );
editMenu->AddSeparatorItem();
item = new BMenuItem( "Sort by Name",
new BMessage( MSG_SORT_NAME ), 'N' );
editMenu->AddItem( item );
item = new BMenuItem( "Sort by Path",
new BMessage( MSG_SORT_PATH ), 'P' );
editMenu->AddItem( item );
item = new BMenuItem( "Randomize",
new BMessage( MSG_RANDOMIZE ), 'R' );
editMenu->AddItem( item );
fSortNameMI = new BMenuItem( "Sort by Name",
new BMessage( MSG_SORT_NAME ), 'N' );
fSortNameMI->SetEnabled( false );
editMenu->AddItem( fSortNameMI );
fSortPathMI = new BMenuItem( "Sort by Path",
new BMessage( MSG_SORT_PATH ), 'P' );
fSortPathMI->SetEnabled( false );
editMenu->AddItem( fSortPathMI );
fRandomizeMI = new BMenuItem( "Randomize",
new BMessage( MSG_RANDOMIZE ), 'R' );
fRandomizeMI->SetEnabled( false );
editMenu->AddItem( fRandomizeMI );
editMenu->AddSeparatorItem();
item = new BMenuItem( "Remove",
fRemoveMI = new BMenuItem( "Remove",
new BMessage( MSG_REMOVE ) );
editMenu->AddItem( item );
item = new BMenuItem( "Remove All",
new BMessage( MSG_REMOVE_ALL ) );
editMenu->AddItem( item );
editMenu->SetEnabled( false );
editMenu->AddItem( fRemoveMI );
fRemoveAllMI = new BMenuItem( "Remove All",
new BMessage( MSG_REMOVE_ALL ) );
editMenu->AddItem( fRemoveAllMI );
// make menu bar resize to correct height
float menuWidth, menuHeight;
......@@ -130,7 +133,8 @@ editMenu->SetEnabled( false );
frame.top += fMenuBar->Bounds().IntegerHeight() + 1;
frame.right -= B_V_SCROLL_BAR_WIDTH;
fListView = new PlaylistView( frame, fMainWindow, p_wrapper );
fListView = new PlaylistView( frame, fMainWindow, p_wrapper,
new BMessage( MSG_SELECTION_CHANGED ) );
fBackgroundView = new BScrollView( "playlist scrollview",
fListView, B_FOLLOW_ALL_SIDES,
0, false, true,
......@@ -182,8 +186,10 @@ PlayListWindow::MessageReceived( BMessage * p_message )
fMainWindow->PostMessage( p_message );
break;
case MSG_SELECT_ALL:
fListView->Select( 0, fListView->CountItems() - 1 );
break;
case MSG_SELECT_NONE:
fListView->DeselectAll();
break;
case MSG_RANDOMIZE:
break;
......@@ -192,8 +198,17 @@ PlayListWindow::MessageReceived( BMessage * p_message )
case MSG_SORT_PATH:
break;
case MSG_REMOVE:
fListView->RemoveSelected();
break;
case MSG_REMOVE_ALL:
fListView->Select( 0, fListView->CountItems() - 1 );
fListView->RemoveSelected();
break;
case MSG_SELECTION_CHANGED:
_CheckItemsEnableState();
break;
case B_MODIFIERS_CHANGED:
fListView->ModifiersChanged();
break;
default:
BWindow::MessageReceived( p_message );
......@@ -235,16 +250,42 @@ void
PlayListWindow::UpdatePlaylist( bool rebuild )
{
if ( rebuild )
{
// remove all items
int32 count = fListView->CountItems();
while ( BListItem* item = fListView->RemoveItem( --count ) )
delete item;
// rebuild listview from VLC's playlist
for ( int i = 0; i < p_wrapper->PlaylistSize(); i++ )
fListView->AddItem( new PlaylistItem( p_wrapper->PlaylistItemName( i ) ) );
}
fListView->RebuildList();
fListView->SetCurrent( p_wrapper->PlaylistCurrent() );
fListView->SetPlaying( p_wrapper->IsPlaying() );
_CheckItemsEnableState();
}
/*****************************************************************************
* PlayListWindow::_CheckItemsEnableState
*****************************************************************************/
void
PlayListWindow::_CheckItemsEnableState() const
{
// check if one item selected
int32 test = fListView->CurrentSelection( 0 );
bool enable1 = test >= 0;
// check if at least two items selected
// test = fListView->CurrentSelection( 1 );
// bool enable2 = test >= 0;
bool notEmpty = fListView->CountItems() > 0;
_SetMenuItemEnabled( fSelectAllMI, notEmpty );
_SetMenuItemEnabled( fSelectNoneMI, enable1 );
// _SetMenuItemEnabled( fSortNameMI, enable2 );
// _SetMenuItemEnabled( fSortPathMI, enable2 );
// _SetMenuItemEnabled( fRandomizeMI, enable2 );
_SetMenuItemEnabled( fRemoveMI, enable1 );
_SetMenuItemEnabled( fRemoveAllMI, notEmpty );
}
/*****************************************************************************
* PlayListWindow::_SetMenuItemEnabled
*****************************************************************************/
void
PlayListWindow::_SetMenuItemEnabled( BMenuItem* item, bool enabled ) const
{
// this check should actally be done in BMenuItem::SetEnabled(), but it is not...
if ( item->IsEnabled() != enabled )
item->SetEnabled( enabled );
}
......@@ -2,7 +2,7 @@
* PlayListWindow.h: BeOS interface window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PlayListWindow.h,v 1.5 2002/11/27 05:36:41 titer Exp $
* $Id: PlayListWindow.h,v 1.6 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -29,8 +29,7 @@
#include <Window.h>
class BListView;
class CDMenu;
class BMenuItem;
class InterfaceWindow;
class PlaylistView;
......@@ -53,13 +52,25 @@ class PlayListWindow : public BWindow
void UpdatePlaylist( bool rebuild = false );
private:
void _CheckItemsEnableState() const;
void _SetMenuItemEnabled( BMenuItem* item,
bool enabled ) const;
PlaylistView * fListView;
BView * fBackgroundView;
BMenuBar * fMenuBar;
InterfaceWindow * fMainWindow;
BMenuItem* fSelectAllMI;
BMenuItem* fSelectNoneMI;
BMenuItem* fSortNameMI;
BMenuItem* fSortPathMI;
BMenuItem* fRandomizeMI;
BMenuItem* fRemoveMI;
BMenuItem* fRemoveAllMI;
intf_thread_t * p_intf;
VlcWrapper * p_wrapper;
VlcWrapper * p_wrapper;
};
#endif // BEOS_PLAY_LIST_WINDOW_H
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* VideoWindow.h: BeOS video window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: VideoWindow.h,v 1.5 2002/12/07 22:00:36 titer Exp $
* $Id: VideoWindow.h,v 1.6 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -55,6 +55,54 @@ colorcombo colspace[]=
#define COLOR_COUNT 5
#define DEFAULT_COL 3
class VideoSettings
{
public:
VideoSettings( const VideoSettings& clone );
virtual ~VideoSettings();
static VideoSettings* DefaultSettings();
enum
{
SIZE_OTHER = 0,
SIZE_50 = 1,
SIZE_100 = 2,
SIZE_200 = 3,
};
void SetVideoSize( uint32 mode );
inline uint32 VideoSize() const
{ return fVideoSize; }
enum
{
FLAG_CORRECT_RATIO = 0x0001,
FLAG_SYNC_RETRACE = 0x0002,
FLAG_ON_TOP_ALL = 0x0004,
FLAG_FULL_SCREEN = 0x0008,
};
inline void SetFlags( uint32 flags )
{ fFlags = flags; }
inline void AddFlags( uint32 flags )
{ fFlags |= flags; }
inline void ClearFlags( uint32 flags )
{ fFlags &= ~flags; }
inline bool HasFlags( uint32 flags ) const
{ return fFlags & flags; }
inline uint32 Flags() const
{ return fFlags; }
private:
VideoSettings(); // reserved for default settings
static VideoSettings fDefaultSettings;
uint32 fVideoSize;
uint32 fFlags;
BMessage* fSettings;
};
class VLCView : public BView
{
......@@ -107,8 +155,14 @@ public:
void SetInterfaceShowing(bool showIt);
void SetCorrectAspectRatio(bool doIt);
inline bool CorrectAspectRatio() const
{ return fCorrectAspect; }
bool CorrectAspectRatio() const;
void ToggleFullScreen();
void SetFullScreen(bool doIt);
bool IsFullScreen() const;
void SetOnTop(bool doIt);
bool IsOnTop() const;
void SetSyncToRetrace(bool doIt);
bool IsSyncedToRetrace() const;
inline status_t InitCheck() const
{ return fInitStatus; }
......@@ -117,9 +171,8 @@ public:
int32 i_width; // aspect corrected bitmap size
int32 i_height;
BRect winSize; // current window size
bool is_zoomed, vsync;
BBitmap *bitmap[3];
BBitmap *overlaybitmap;
// BBitmap *overlaybitmap;
VLCView *view;
int i_buffer;
volatile bool teardownwindow;
......@@ -134,6 +187,7 @@ private:
void _FreeBuffers();
void _BlankBitmap(BBitmap* bitmap) const;
void _SetVideoSize(uint32 mode);
void _SetToSettings();
void _SaveScreenShot( BBitmap* bitmap,
char* path,
......@@ -153,10 +207,10 @@ private:
int32 fTrueWidth; // incomming bitmap size
int32 fTrueHeight;
bool fCorrectAspect;
window_feel fCachedFeel;
bool fInterfaceShowing;
status_t fInitStatus;
VideoSettings* fSettings;
};
#endif // BEOS_VIDEO_WINDOW_H
......
......@@ -2,7 +2,7 @@
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.cpp,v 1.23 2003/01/29 00:02:09 titer Exp $
* $Id: VlcWrapper.cpp,v 1.24 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -358,35 +358,47 @@ bool VlcWrapper::IsPlaying()
* playlist *
************/
void VlcWrapper::OpenFiles( BList* o_files, bool replace )
void VlcWrapper::OpenFiles( BList* o_files, bool replace, int32 index )
{
BString *o_file;
int size = PlaylistSize();
bool wasEmpty = ( size < 1 );
/* delete current playlist */
if( replace )
{
for( int i = 0; i < size; i++ )
{
playlist_Delete( p_playlist, 0 );
}
}
/* append files */
while( ( o_file = (BString *)o_files->LastItem() ) )
{
playlist_Add( p_playlist, o_file->String(),
PLAYLIST_APPEND, PLAYLIST_END );
o_files->RemoveItem(o_files->CountItems() - 1);
}
/* eventually restart playing */
if( replace || wasEmpty )
{
playlist_Stop( p_playlist );
playlist_Play( p_playlist );
}
if ( o_files && o_files->CountItems() > 0)
{
int size = PlaylistSize();
bool wasEmpty = ( size < 1 );
if ( index == -1 )
index = PLAYLIST_END;
int mode = index == PLAYLIST_END ? PLAYLIST_APPEND : PLAYLIST_INSERT;
/* delete current playlist */
if( replace )
{
for( int i = 0; i < size; i++ )
{
playlist_Delete( p_playlist, 0 );
}
}
/* insert files */
int32 count = o_files->CountItems();
for ( int32 i = count - 1; i >= 0; i-- )
{
if ( BString* o_file = (BString *)o_files->RemoveItem( i ) )
{
playlist_Add( p_playlist, o_file->String(),
mode, index );
if ( mode == PLAYLIST_INSERT )
index++;
delete o_file;
}
}
// TODO: implement a user setting
// if to start automatically
/* eventually restart playing */
if( replace || wasEmpty )
{
playlist_Stop( p_playlist );
playlist_Play( p_playlist );
}
}
}
void VlcWrapper::OpenDisc(BString o_type, BString o_device, int i_title, int i_chapter)
......@@ -455,11 +467,15 @@ void VlcWrapper::GetPlaylistInfo( int32& currentIndex, int32& maxIndex )
maxIndex = -1;
if ( p_playlist )
{
vlc_mutex_lock( &p_playlist->object_lock );
maxIndex = p_playlist->i_size;
if ( maxIndex > 0 )
currentIndex = p_playlist->i_index + 1;
currentIndex = p_playlist->i_index/* + 1 -> why?!?*/;
else
maxIndex = -1;
vlc_mutex_unlock( &p_playlist->object_lock );
}
}
......@@ -611,6 +627,131 @@ void VlcWrapper::NavigateNext()
PlaylistNext();
}
/*************************
* Playlist manipulation *
*************************/
// PlaylistLock
bool
VlcWrapper::PlaylistLock() const
{
// TODO: search and destroy -> deadlock!
return true;
if ( p_playlist )
{
vlc_mutex_lock( &p_playlist->object_lock );
return true;
}
return false;
}
// PlaylistUnlock
void
VlcWrapper::PlaylistUnlock() const
{
// TODO: search and destroy -> deadlock!
return;
vlc_mutex_unlock( &p_playlist->object_lock );
}
// PlaylistItemAt
void*
VlcWrapper::PlaylistItemAt( int index ) const
{
playlist_item_t* item = NULL;
if ( index >= 0 && index < p_playlist->i_size )
item = p_playlist->pp_items[index];
return (void*)item;
}
// PlaylistRemoveItem
void*
VlcWrapper::PlaylistRemoveItem( int index ) const
{
playlist_item_t* copy = NULL;
// check if item exists at the provided index
if ( index >= 0 && index < p_playlist->i_size )
{
playlist_item_t* item = p_playlist->pp_items[index];
if ( item )
{
// make a copy of the removed item
copy = (playlist_item_t*)PlaylistCloneItem( (void*)item );
// remove item from playlist (unfortunately, this frees it)
playlist_Delete( p_playlist, index );
}
}
return (void*)copy;
}
// PlaylistRemoveItem
void*
VlcWrapper::PlaylistRemoveItem( void* item ) const
{
playlist_item_t* copy = NULL;
for ( int32 i = 0; i < p_playlist->i_size; i++ )
{
if ( p_playlist->pp_items[i] == item )
{
copy = (playlist_item_t*)PlaylistRemoveItem( i );
break;
}
}
return (void*)copy;
}
// PlaylistAddItem
bool
VlcWrapper::PlaylistAddItem( void* item, int index ) const
{
if ( item )
{
playlist_AddItem( p_playlist, (playlist_item_t*)item,
PLAYLIST_INSERT, index );
}
// TODO: once playlist is returning useful info, return that instead
return true;
}
// PlaylistCloneItem
void*
VlcWrapper::PlaylistCloneItem( void* castToItem ) const
{
playlist_item_t* copy = NULL;
playlist_item_t* item = (playlist_item_t*)castToItem;
if ( item )
{
copy = (playlist_item_t*)malloc( sizeof( playlist_item_t ) );
if ( copy )
{
// make a copy of the item at index
copy->psz_name = strdup( item->psz_name );
copy->psz_uri = strdup( item->psz_uri );
copy->i_type = item->i_type;
copy->i_status = item->i_status;
copy->b_autodeletion = item->b_autodeletion;
}
}
return (void*)copy;
}
// Careful! You need to know what you're doing here!
// The reason for having it, is to be able to deal with
// the rather lame list implementation of the playlist.
// It is meant to help manipulate the playlist with the above
// methods while keeping it valid.
//
// PlaylistSetPlaying
void
VlcWrapper::PlaylistSetPlaying( int index ) const
{
if ( index < 0 )
index = 0;
if ( index >= p_playlist->i_size )
index = p_playlist->i_size - 1;
p_playlist->i_index = index;
}
/*********
* audio *
......@@ -853,7 +994,7 @@ void VlcWrapper::ChapterInfo( int32 &currentIndex, int32 &maxIndex )
* Miscellanous *
****************/
void VlcWrapper::LoadSubFile( char * psz_file )
void VlcWrapper::LoadSubFile( const char * psz_file )
{
config_PutPsz( p_intf, "sub-file", strdup( psz_file ) );
}
......
......@@ -2,7 +2,7 @@
* VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.h,v 1.18 2003/01/29 00:02:09 titer Exp $
* $Id: VlcWrapper.h,v 1.19 2003/02/01 12:01:11 stippi Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -79,7 +79,8 @@ public:
bool IsPlaying();
/* Playlist */
void OpenFiles( BList *o_files, bool replace = true );
void OpenFiles( BList *o_files, bool replace = true,
int32 index = -1 );
void OpenDisc( BString o_type, BString o_device,
int i_title, int i_chapter );
int PlaylistSize();
......@@ -99,6 +100,21 @@ public:
void NavigatePrev();
void NavigateNext();
/* Playlist manipulation */
bool PlaylistLock() const;
void PlaylistUnlock() const;
// playlist must be locked prior to calling all of these!
void* PlaylistItemAt( int index ) const;
// both functions return a copy of the removed item
// so that it can be added at another index
void* PlaylistRemoveItem( int index ) const;
void* PlaylistRemoveItem( void* item ) const;
// uses playlist_AddItem()
bool PlaylistAddItem( void* item, int index ) const;
void* PlaylistCloneItem( void* item ) const;
// only modifies playlist, doesn't effect playback
void PlaylistSetPlaying( int index ) const;
/* Audio */
bool HasAudio();
unsigned short GetVolume();
......@@ -123,7 +139,7 @@ public:
void ChapterInfo( int32& currentIndex, int32& maxIndex );
/* Miscellanous */
void LoadSubFile( char * psz_file );
void LoadSubFile( const char * psz_file );
void FilterChange();
private:
......
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