Commit a32ef53e authored by Richard Shepherd's avatar Richard Shepherd

Language & Inteface support for BeOS interface

parent 7cfe1ea9
...@@ -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.8 2001/03/21 13:42:33 sam Exp $ * $Id: InterfaceWindow.h,v 1.9 2001/03/25 17:09:14 richards 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>
...@@ -36,6 +36,18 @@ private: ...@@ -36,6 +36,18 @@ private:
int GetCD(const char *directory); int GetCD(const char *directory);
}; };
class LanguageMenu : public BMenu
{
public:
LanguageMenu(const char *name, int menu_kind, intf_thread_t *p_interface);
~LanguageMenu();
void AttachedToWindow(void);
private:
intf_thread_t *p_intf;
int kind;
int GetChannels();
};
class InterfaceWindow : public BWindow class InterfaceWindow : public BWindow
{ {
public: public:
...@@ -46,14 +58,17 @@ public: ...@@ -46,14 +58,17 @@ public:
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
intf_thread_t *p_intf;
MediaSlider * p_vol;
SeekSlider * p_seek; SeekSlider * p_seek;
BCheckBox * p_mute;
sem_id fScrubSem; sem_id fScrubSem;
bool fSeeking; bool fSeeking;
private:
intf_thread_t *p_intf;
MediaSlider * p_vol;
BCheckBox * p_mute;
BFilePanel *file_panel; BFilePanel *file_panel;
es_descriptor_t * p_audio_es;
es_descriptor_t * p_spu_es;
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* MsgVals.h * MsgVals.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.4 2001/03/21 13:42:33 sam Exp $ * $Id: MsgVals.h,v 1.5 2001/03/25 17:09:14 richards Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* *
...@@ -36,4 +36,5 @@ const uint32 SEEK_PLAYBACK = 'SEEK'; ...@@ -36,4 +36,5 @@ const uint32 SEEK_PLAYBACK = 'SEEK';
const uint32 VOLUME_CHG = 'VOCH'; const uint32 VOLUME_CHG = 'VOCH';
const uint32 VOLUME_MUTE = 'MUTE'; const uint32 VOLUME_MUTE = 'MUTE';
const uint32 SELECT_CHANNEL = 'CHAN'; const uint32 SELECT_CHANNEL = 'CHAN';
const uint32 SELECT_SUBTITLE = 'SUBT';
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
* intf_beos.cpp: beos interface * intf_beos.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: intf_beos.cpp,v 1.21 2001/03/17 19:33:22 richards Exp $ * $Id: intf_beos.cpp,v 1.22 2001/03/25 17:09:14 richards 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>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tony@castley.net>
* Richard Shepherd <richard@rshepherd.demon.co.uk> * Richard Shepherd <richard@rshepherd.demon.co.uk>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -81,7 +81,6 @@ extern "C" ...@@ -81,7 +81,6 @@ extern "C"
#include "audio_output.h" #include "audio_output.h"
#include "MsgVals.h" #include "MsgVals.h"
#include "main.h" #include "main.h"
} }
...@@ -121,17 +120,22 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name , intf_thread_t ...@@ -121,17 +120,22 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name , intf_thread_t
AddChild( menu_bar ); AddChild( menu_bar );
BMenu *m; BMenu *m;
BMenu *am;
CDMenu *cd_menu; CDMenu *cd_menu;
menu_bar->AddItem( m = new BMenu("File") ); menu_bar->AddItem( m = new BMenu("File") );
menu_bar->ResizeToPreferred(); menu_bar->ResizeToPreferred();
m->AddItem( new BMenuItem("Open File...", new BMessage(OPEN_FILE), 'O')); m->AddItem( new BMenuItem("Open File...", new BMessage(OPEN_FILE), 'O'));
cd_menu = new CDMenu("Open Disc"); cd_menu = new CDMenu("Open Disc");
//GetCD("/dev/disk", cd_menu);
m->AddItem(cd_menu); m->AddItem(cd_menu);
m->AddSeparatorItem(); m->AddSeparatorItem();
m->AddItem( new BMenuItem("About...", new BMessage(B_ABOUT_REQUESTED), 'A')); m->AddItem( new BMenuItem("About...", new BMessage(B_ABOUT_REQUESTED), 'A'));
m->AddItem( new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q')); m->AddItem( new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
menu_bar->AddItem (am = new BMenu("Audio") );
menu_bar->ResizeToPreferred();
am->AddItem( new LanguageMenu("Language", 0, p_intf) );
am->AddItem( new LanguageMenu("Subtitles", 1, p_intf) );
rect = Bounds(); rect = Bounds();
...@@ -345,15 +349,6 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -345,15 +349,6 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
break; break;
case SEEK_PLAYBACK: case SEEK_PLAYBACK:
// handled by semaphores; // handled by semaphores;
/* if( p_intf->p_input != NULL )
{
float new_position;
if (p_message->FindFloat("be:value", &new_position) == B_OK)
{
printf("%e\n", new_position);
input_Seek( p_intf->p_input, new_position * 100 );
}
} */
break; break;
case VOLUME_CHG: case VOLUME_CHG:
// adjust the volume // adjust the volume
...@@ -379,6 +374,18 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -379,6 +374,18 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
} }
break; break;
case SELECT_CHANNEL: case SELECT_CHANNEL:
{
int32 i = p_message->FindInt32("channel");
input_ChangeES(p_intf->p_input,
p_intf->p_input->stream.pp_es[i], 1);
}
break;
case SELECT_SUBTITLE:
{
int32 i = p_message->FindInt32("subtitle");
input_ChangeES(p_intf->p_input,
p_intf->p_input->stream.pp_es[i], 2);
}
break; break;
case B_REFS_RECEIVED: case B_REFS_RECEIVED:
case B_SIMPLE_DATA: case B_SIMPLE_DATA:
...@@ -402,7 +409,6 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -402,7 +409,6 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
/***************************************************************************** /*****************************************************************************
* InterfaceWindow::QuitRequested * InterfaceWindow::QuitRequested
*****************************************************************************/ *****************************************************************************/
bool InterfaceWindow::QuitRequested() bool InterfaceWindow::QuitRequested()
{ {
p_intf->b_die = 1; p_intf->b_die = 1;
...@@ -413,38 +419,31 @@ bool InterfaceWindow::QuitRequested() ...@@ -413,38 +419,31 @@ bool InterfaceWindow::QuitRequested()
/***************************************************************************** /*****************************************************************************
* CDMenu::CDMenu * CDMenu::CDMenu
*****************************************************************************/ *****************************************************************************/
CDMenu::CDMenu(const char *name) CDMenu::CDMenu(const char *name)
: BMenu(name) : BMenu(name)
{ {
} }
/***************************************************************************** /*****************************************************************************
* CDMenu::~CDMenu * CDMenu::~CDMenu
*****************************************************************************/ *****************************************************************************/
CDMenu::~CDMenu() CDMenu::~CDMenu()
{ {
} }
/***************************************************************************** /*****************************************************************************
* CDMenu::AttachedToWindow * CDMenu::AttachedToWindow
*****************************************************************************/ *****************************************************************************/
void CDMenu::AttachedToWindow(void) void CDMenu::AttachedToWindow(void)
{ {
int32 items = CountItems(); while (RemoveItem((long int)0) != NULL); // remove all items
for(int32 i = 0; i < items; i++) GetCD("/dev/disk");
RemoveItem(i); BMenu::AttachedToWindow();
GetCD("/dev/disk");
BMenu::AttachedToWindow();
} }
/***************************************************************************** /*****************************************************************************
* CDMenu::GetCD * CDMenu::GetCD
*****************************************************************************/ *****************************************************************************/
int CDMenu::GetCD(const char *directory) int CDMenu::GetCD(const char *directory)
{ {
BDirectory dir; BDirectory dir;
...@@ -510,6 +509,92 @@ int CDMenu::GetCD(const char *directory) ...@@ -510,6 +509,92 @@ int CDMenu::GetCD(const char *directory)
return B_ERROR; return B_ERROR;
} }
/*****************************************************************************
* LanguageMenu::LanguageMenu
*****************************************************************************/
LanguageMenu::LanguageMenu(const char *name, int menu_kind, intf_thread_t *p_interface)
:BMenu(name)
{
kind = menu_kind;
p_intf = p_interface;
}
/*****************************************************************************
* LanguageMenu::~LanguageMenu
*****************************************************************************/
LanguageMenu::~LanguageMenu()
{
}
/*****************************************************************************
* LanguageMenu::AttachedToWindow
*****************************************************************************/
void LanguageMenu::AttachedToWindow(void)
{
while (RemoveItem((long int)0) != NULL); // remove all items
SetRadioMode(true);
GetChannels();
BMenu::AttachedToWindow();
}
/*****************************************************************************
* LanguageMenu::GetChannels
*****************************************************************************/
int LanguageMenu::GetChannels()
{
char* psz_name;
bool b_active;
bool b_found;
int32 i;
es_descriptor_t *p_es;
if (p_intf->p_input == NULL)
return 1;
for (i = 0; i < p_intf->p_input->stream.i_selected_es_number; i++)
{
if ((kind == 0) && p_intf->p_input->stream.pp_selected_es[i]->b_audio)
{
p_es = p_intf->p_input->stream.pp_selected_es[i];
}
else if ((kind == 1) && p_intf->p_input->stream.pp_selected_es[i]->b_spu)
{
p_es = p_intf->p_input->stream.pp_selected_es[i];
}
}
for (i = 0; i < p_intf->p_input->stream.i_es_number; i++)
{
if (kind == 0) //audio
{
b_found = p_intf->p_input->stream.pp_es[i]->b_audio;
}
else
{
b_found = p_intf->p_input->stream.pp_es[i]->b_spu;
}
if (b_found)
{
psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc;
BMessage *msg;
if (kind == 0) //audio
{
msg = new BMessage(SELECT_CHANNEL);
msg->AddInt32("channel", i);
}
else
{
msg = new BMessage(SELECT_SUBTITLE);
msg->AddInt32("subtitle", i);
}
BMenuItem *menu_item;
menu_item = new BMenuItem(psz_name, msg);
AddItem(menu_item);
b_active = (p_es == p_intf->p_input->stream.pp_es[i]);
menu_item->SetMarked(b_active);
}
}
}
/***************************************************************************** /*****************************************************************************
* MediaSlider * MediaSlider
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_beos.cpp: beos video output display method * vout_beos.cpp: beos video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: vout_beos.cpp,v 1.22 2001/03/21 13:42:33 sam Exp $ * $Id: vout_beos.cpp,v 1.23 2001/03/25 17:09:14 richards 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>
...@@ -197,7 +197,6 @@ VideoWindow::VideoWindow(BRect frame, const char *name, vout_thread_t *p_video_o ...@@ -197,7 +197,6 @@ VideoWindow::VideoWindow(BRect frame, const char *name, vout_thread_t *p_video_o
if(fUsingOverlay) if(fUsingOverlay)
{ {
memset(bitmap[0]->Bits(), 0, bitmap[0]->BitsLength());
rgb_color key; rgb_color key;
view->SetViewOverlay(bitmap[0], bitmap[0]->Bounds(), Bounds(), &key, B_FOLLOW_ALL, view->SetViewOverlay(bitmap[0], bitmap[0]->Bounds(), Bounds(), &key, B_FOLLOW_ALL,
B_OVERLAY_FILTER_HORIZONTAL|B_OVERLAY_FILTER_VERTICAL); B_OVERLAY_FILTER_HORIZONTAL|B_OVERLAY_FILTER_VERTICAL);
...@@ -205,6 +204,7 @@ VideoWindow::VideoWindow(BRect frame, const char *name, vout_thread_t *p_video_o ...@@ -205,6 +204,7 @@ VideoWindow::VideoWindow(BRect frame, const char *name, vout_thread_t *p_video_o
SetTitle(VOUT_TITLE " (Overlay output)"); SetTitle(VOUT_TITLE " (Overlay output)");
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
SetSizeLimits((float) Bounds().IntegerWidth(), maxWidth, (float) Bounds().IntegerHeight(), maxHeight); SetSizeLimits((float) Bounds().IntegerWidth(), maxWidth, (float) Bounds().IntegerHeight(), maxHeight);
memset(bitmap[0]->Bits(), 0, bitmap[0]->BitsLength());
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* beos_init.cpp: Initialization for BeOS specific features * beos_init.cpp: Initialization for BeOS specific features
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: beos_specific.cpp,v 1.5 2001/03/21 13:42:34 sam Exp $ * $Id: beos_specific.cpp,v 1.6 2001/03/25 17:09:14 richards Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* *
...@@ -61,13 +61,10 @@ void beos_Create( void ) ...@@ -61,13 +61,10 @@ void beos_Create( void )
BPath path; BPath path;
app_info info; app_info info;
be_app = NULL;
vlc_thread_create( &beos_app_thread, "app thread", (vlc_thread_func_t)beos_AppThread, 0 ); vlc_thread_create( &beos_app_thread, "app thread", (vlc_thread_func_t)beos_AppThread, 0 );
msleep( 100000 ); while( be_app == NULL )
// FIXME: we need to verify that be_app is initialized and the msleep is not enough msleep( 5000 );
// but the following code does not work as it should and I have no good
// solution at the moment.
//while( be_app == NULL )
// msleep( 5000 );
be_app->GetAppInfo(&info); be_app->GetAppInfo(&info);
BEntry entry(&info.ref); BEntry entry(&info.ref);
......
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