* Coding style cleanups, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33811 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Controller.h"
|
#include "Controller.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#ifndef __CONTROLLER_H
|
#ifndef __CONTROLLER_H
|
||||||
#define __CONTROLLER_H
|
#define __CONTROLLER_H
|
||||||
|
|
||||||
|
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <MediaDefs.h>
|
#include <MediaDefs.h>
|
||||||
#include <MediaFormats.h>
|
#include <MediaFormats.h>
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
#include "NodeManager.h"
|
#include "NodeManager.h"
|
||||||
#include "PlaylistItem.h"
|
#include "PlaylistItem.h"
|
||||||
|
|
||||||
|
|
||||||
class AudioTrackSupplier;
|
class AudioTrackSupplier;
|
||||||
class BBitmap;
|
class BBitmap;
|
||||||
class BMediaFile;
|
class BMediaFile;
|
||||||
@@ -44,9 +46,9 @@ class SoundOutput;
|
|||||||
class VideoTrackSupplier;
|
class VideoTrackSupplier;
|
||||||
class VideoView;
|
class VideoView;
|
||||||
|
|
||||||
|
|
||||||
class Controller : public NodeManager {
|
class Controller : public NodeManager {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
class Listener {
|
class Listener {
|
||||||
public:
|
public:
|
||||||
Listener();
|
Listener();
|
||||||
@@ -203,5 +205,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif // __CONTROLLER_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007, Haiku. All rights reserved.
|
* Copyright 2007-2009, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ControllerObserver.h"
|
#include "ControllerObserver.h"
|
||||||
|
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
|
|
||||||
ControllerObserver::ControllerObserver(BHandler* target, uint32 observeFlags)
|
ControllerObserver::ControllerObserver(BHandler* target, uint32 observeFlags)
|
||||||
: Controller::Listener()
|
:
|
||||||
, AbstractLOAdapter(target)
|
AbstractLOAdapter(target),
|
||||||
, fObserveFlags(observeFlags)
|
fObserveFlags(observeFlags)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,5 +149,3 @@ ControllerObserver::MutedChanged(bool muted)
|
|||||||
|
|
||||||
DeliverMessage(message);
|
DeliverMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007, Haiku. All rights reserved.
|
* Copyright 2007-2009, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -8,9 +8,11 @@
|
|||||||
#ifndef CONTROLLER_OBSERVER_H
|
#ifndef CONTROLLER_OBSERVER_H
|
||||||
#define CONTROLLER_OBSERVER_H
|
#define CONTROLLER_OBSERVER_H
|
||||||
|
|
||||||
|
|
||||||
#include "AbstractLOAdapter.h"
|
#include "AbstractLOAdapter.h"
|
||||||
#include "Controller.h"
|
#include "Controller.h"
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_CONTROLLER_FILE_FINISHED = 'cnff',
|
MSG_CONTROLLER_FILE_FINISHED = 'cnff',
|
||||||
MSG_CONTROLLER_FILE_CHANGED = 'cnfc',
|
MSG_CONTROLLER_FILE_CHANGED = 'cnfc',
|
||||||
@@ -38,9 +40,10 @@ enum {
|
|||||||
OBSERVE_ALL_CHANGES = 0xffff
|
OBSERVE_ALL_CHANGES = 0xffff
|
||||||
};
|
};
|
||||||
|
|
||||||
class ControllerObserver : public Controller::Listener,
|
|
||||||
public AbstractLOAdapter {
|
class ControllerObserver
|
||||||
public:
|
: public Controller::Listener, public AbstractLOAdapter {
|
||||||
|
public:
|
||||||
ControllerObserver(BHandler* target,
|
ControllerObserver(BHandler* target,
|
||||||
uint32 observeFlags = OBSERVE_ALL_CHANGES);
|
uint32 observeFlags = OBSERVE_ALL_CHANGES);
|
||||||
virtual ~ControllerObserver();
|
virtual ~ControllerObserver();
|
||||||
@@ -60,7 +63,7 @@ class ControllerObserver : public Controller::Listener,
|
|||||||
virtual void VolumeChanged(float volume);
|
virtual void VolumeChanged(float volume);
|
||||||
virtual void MutedChanged(bool muted);
|
virtual void MutedChanged(bool muted);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 fObserveFlags;
|
uint32 fObserveFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ControllerView.h"
|
#include "ControllerView.h"
|
||||||
|
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
@@ -30,12 +32,14 @@
|
|||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
#include "PlaylistObserver.h"
|
#include "PlaylistObserver.h"
|
||||||
|
|
||||||
|
|
||||||
ControllerView::ControllerView(BRect frame, Controller* controller,
|
ControllerView::ControllerView(BRect frame, Controller* controller,
|
||||||
Playlist* playlist)
|
Playlist* playlist)
|
||||||
: TransportControlGroup(frame, true, true, false)
|
:
|
||||||
, fController(controller)
|
TransportControlGroup(frame, true, true, false),
|
||||||
, fPlaylist(playlist)
|
fController(controller),
|
||||||
, fPlaylistObserver(new PlaylistObserver(this))
|
fPlaylist(playlist),
|
||||||
|
fPlaylistObserver(new PlaylistObserver(this))
|
||||||
{
|
{
|
||||||
fPlaylist->AddListener(fPlaylistObserver);
|
fPlaylist->AddListener(fPlaylistObserver);
|
||||||
}
|
}
|
||||||
@@ -78,6 +82,7 @@ ControllerView::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONTROLLER_VIEW_H
|
#ifndef __CONTROLLER_VIEW_H
|
||||||
#define __CONTROLLER_VIEW_H
|
#define __CONTROLLER_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include "TransportControlGroup.h"
|
#include "TransportControlGroup.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -30,8 +30,8 @@ class Controller;
|
|||||||
class Playlist;
|
class Playlist;
|
||||||
class PlaylistObserver;
|
class PlaylistObserver;
|
||||||
|
|
||||||
class ControllerView : public TransportControlGroup
|
|
||||||
{
|
class ControllerView : public TransportControlGroup {
|
||||||
public:
|
public:
|
||||||
ControllerView(BRect frame, Controller* controller,
|
ControllerView(BRect frame, Controller* controller,
|
||||||
Playlist* playlist);
|
Playlist* playlist);
|
||||||
@@ -63,4 +63,4 @@ private:
|
|||||||
PlaylistObserver* fPlaylistObserver;
|
PlaylistObserver* fPlaylistObserver;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // __CONTROLLER_VIEW_H
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "InfoWin.h"
|
#include "InfoWin.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -155,11 +157,12 @@ InfoView::SetGenericIcon()
|
|||||||
|
|
||||||
|
|
||||||
InfoWin::InfoWin(BPoint leftTop, Controller* controller)
|
InfoWin::InfoWin(BPoint leftTop, Controller* controller)
|
||||||
: BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1,
|
:
|
||||||
|
BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1,
|
||||||
leftTop.y + 300), NAME, B_TITLED_WINDOW,
|
leftTop.y + 300), NAME, B_TITLED_WINDOW,
|
||||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
|
B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
|
||||||
, fController(controller)
|
fController(controller),
|
||||||
, fControllerObserver(new ControllerObserver(this,
|
fControllerObserver(new ControllerObserver(this,
|
||||||
OBSERVE_FILE_CHANGES | OBSERVE_TRACK_CHANGES | OBSERVE_STAT_CHANGES))
|
OBSERVE_FILE_CHANGES | OBSERVE_TRACK_CHANGES | OBSERVE_STAT_CHANGES))
|
||||||
{
|
{
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
@@ -175,10 +178,9 @@ InfoWin::InfoWin(BPoint leftTop, Controller* controller)
|
|||||||
bigFont.SetSize(bigFont.Size() + 6);
|
bigFont.SetSize(bigFont.Size() + 6);
|
||||||
font_height fh;
|
font_height fh;
|
||||||
bigFont.GetHeight(&fh);
|
bigFont.GetHeight(&fh);
|
||||||
fFilenameView = new BStringView(BRect(div + 10, 20,
|
fFilenameView = new BStringView(
|
||||||
rect.right - 10,
|
BRect(div + 10, 20, rect.right - 10, 20 + fh.ascent + 5),
|
||||||
20 + fh.ascent + 5),
|
"filename", "");
|
||||||
"filename", "");
|
|
||||||
AddChild(fFilenameView);
|
AddChild(fFilenameView);
|
||||||
fFilenameView->SetFont(&bigFont);
|
fFilenameView->SetFont(&bigFont);
|
||||||
fFilenameView->SetViewColor(fInfoView->ViewColor());
|
fFilenameView->SetViewColor(fInfoView->ViewColor());
|
||||||
@@ -219,9 +221,6 @@ InfoWin::~InfoWin()
|
|||||||
{
|
{
|
||||||
fController->RemoveListener(fControllerObserver);
|
fController->RemoveListener(fControllerObserver);
|
||||||
delete fControllerObserver;
|
delete fControllerObserver;
|
||||||
|
|
||||||
//fInfoListView->MakeEmpty();
|
|
||||||
//delete [] fInfoItems;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -229,13 +228,13 @@ InfoWin::~InfoWin()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InfoWin::FrameResized(float new_width, float new_height)
|
InfoWin::FrameResized(float newWidth, float newHeight)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InfoWin::MessageReceived(BMessage *msg)
|
InfoWin::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case MSG_CONTROLLER_FILE_FINISHED:
|
case MSG_CONTROLLER_FILE_FINISHED:
|
||||||
@@ -283,13 +282,6 @@ InfoWin::Pulse()
|
|||||||
void
|
void
|
||||||
InfoWin::ResizeToPreferred()
|
InfoWin::ResizeToPreferred()
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
float height = BASE_HEIGHT;
|
|
||||||
for (int i = 0; BListItem *li = fInfoListView->ItemAt(i); i++) {
|
|
||||||
height += li->Height();
|
|
||||||
}
|
|
||||||
ResizeTo(Bounds().Width(), height);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -469,7 +461,6 @@ printf("InfoWin::Update(0x%08lx)\n", which);
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((which & INFO_COPYRIGHT) && fController->HasFile()) {
|
if ((which & INFO_COPYRIGHT) && fController->HasFile()) {
|
||||||
|
|
||||||
BString s;
|
BString s;
|
||||||
if (fController->GetCopyright(&s) == B_OK && s.Length() > 0) {
|
if (fController->GetCopyright(&s) == B_OK && s.Length() > 0) {
|
||||||
fLabelsView->Insert("Copyright\n\n");
|
fLabelsView->Insert("Copyright\n\n");
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#ifndef __FILE_INFO_WIN_H
|
#ifndef __FILE_INFO_WIN_H
|
||||||
#define __FILE_INFO_WIN_H
|
#define __FILE_INFO_WIN_H
|
||||||
|
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ class BTextView;
|
|||||||
class Controller;
|
class Controller;
|
||||||
class ControllerObserver;
|
class ControllerObserver;
|
||||||
class InfoView;
|
class InfoView;
|
||||||
|
|
||||||
|
|
||||||
#define INFO_STATS 0x00000001
|
#define INFO_STATS 0x00000001
|
||||||
#define INFO_TRANSPORT 0x00000002
|
#define INFO_TRANSPORT 0x00000002
|
||||||
@@ -45,7 +46,7 @@ public:
|
|||||||
InfoWin(BPoint leftTop,
|
InfoWin(BPoint leftTop,
|
||||||
Controller* controller);
|
Controller* controller);
|
||||||
virtual ~InfoWin();
|
virtual ~InfoWin();
|
||||||
|
|
||||||
virtual void FrameResized(float newWidth, float newHeight);
|
virtual void FrameResized(float newWidth, float newHeight);
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
@@ -54,10 +55,10 @@ public:
|
|||||||
void ResizeToPreferred();
|
void ResizeToPreferred();
|
||||||
void Update(uint32 which = INFO_ALL);
|
void Update(uint32 which = INFO_ALL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Controller* fController;
|
Controller* fController;
|
||||||
ControllerObserver* fControllerObserver;
|
ControllerObserver* fControllerObserver;
|
||||||
|
|
||||||
InfoView* fInfoView;
|
InfoView* fInfoView;
|
||||||
BStringView* fFilenameView;
|
BStringView* fFilenameView;
|
||||||
BTextView* fLabelsView;
|
BTextView* fLabelsView;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "MainApp.h"
|
#include "MainApp.h"
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
@@ -46,17 +48,18 @@ static const char* kMediaServerAddOnSig = "application/x-vnd.Be.addon-host";
|
|||||||
|
|
||||||
|
|
||||||
MainApp::MainApp()
|
MainApp::MainApp()
|
||||||
: BApplication(kAppSig),
|
:
|
||||||
fPlayerCount(0),
|
BApplication(kAppSig),
|
||||||
fFirstWindow(NULL),
|
fPlayerCount(0),
|
||||||
fSettingsWindow(NULL),
|
fFirstWindow(NULL),
|
||||||
|
fSettingsWindow(NULL),
|
||||||
|
|
||||||
fOpenFilePanel(NULL),
|
fOpenFilePanel(NULL),
|
||||||
fSaveFilePanel(NULL),
|
fSaveFilePanel(NULL),
|
||||||
fLastFilePanelFolder(),
|
fLastFilePanelFolder(),
|
||||||
|
|
||||||
fMediaServerRunning(false),
|
fMediaServerRunning(false),
|
||||||
fMediaAddOnServerRunning(false)
|
fMediaAddOnServerRunning(false)
|
||||||
{
|
{
|
||||||
mpSettings settings = Settings::CurrentSettings();
|
mpSettings settings = Settings::CurrentSettings();
|
||||||
fLastFilePanelFolder = settings.filePanelFolder;
|
fLastFilePanelFolder = settings.filePanelFolder;
|
||||||
@@ -136,7 +139,7 @@ MainApp::ReadyToRun()
|
|||||||
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
|
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
|
||||||
|
|
||||||
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
|
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
|
||||||
BAlert* alert = new BAlert("start_media_server",
|
BAlert* alert = new BAlert("start_media_server",
|
||||||
"It appears the Media Server is not running.\n"
|
"It appears the Media Server is not running.\n"
|
||||||
"Would you like to start it ?", "Quit", "Start Media Server", NULL,
|
"Would you like to start it ?", "Quit", "Start Media Server", NULL,
|
||||||
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
@@ -181,12 +184,12 @@ MainApp::RefsReceived(BMessage* message)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainApp::ArgvReceived(int32 argc, char **argv)
|
MainApp::ArgvReceived(int32 argc, char** argv)
|
||||||
{
|
{
|
||||||
char cwd[B_PATH_NAME_LENGTH];
|
char cwd[B_PATH_NAME_LENGTH];
|
||||||
getcwd(cwd, sizeof(cwd));
|
getcwd(cwd, sizeof(cwd));
|
||||||
|
|
||||||
BMessage m(B_REFS_RECEIVED);
|
BMessage message(B_REFS_RECEIVED);
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
printf("MainApp::ArgvReceived %s\n", argv[i]);
|
printf("MainApp::ArgvReceived %s\n", argv[i]);
|
||||||
@@ -200,13 +203,13 @@ MainApp::ArgvReceived(int32 argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (B_OK == entry.GetRef(&ref))
|
if (entry.GetRef(&ref) == B_OK)
|
||||||
m.AddRef("refs", &ref);
|
message.AddRef("refs", &ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m.HasRef("refs")) {
|
if (message.HasRef("refs")) {
|
||||||
printf("MainApp::ArgvReceived calling RefsReceived\n");
|
printf("MainApp::ArgvReceived calling RefsReceived\n");
|
||||||
RefsReceived(&m);
|
RefsReceived(&message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +394,7 @@ MainApp::_ShowFilePanel(BFilePanel* panel, uint32 command,
|
|||||||
BMessage targetMessage;
|
BMessage targetMessage;
|
||||||
if (message->FindMessage("message", &targetMessage) == B_OK)
|
if (message->FindMessage("message", &targetMessage) == B_OK)
|
||||||
panelMessage.AddMessage("message", &targetMessage);
|
panelMessage.AddMessage("message", &targetMessage);
|
||||||
|
|
||||||
BMessenger target;
|
BMessenger target;
|
||||||
if (message->FindMessenger("target", &target) == B_OK)
|
if (message->FindMessenger("target", &target) == B_OK)
|
||||||
panelMessage.AddMessenger("target", target);
|
panelMessage.AddMessenger("target", target);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#ifndef __MAIN_APP_H
|
#ifndef __MAIN_APP_H
|
||||||
#define __MAIN_APP_H
|
#define __MAIN_APP_H
|
||||||
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
|
|
||||||
@@ -100,4 +101,4 @@ private:
|
|||||||
extern MainApp* gMainApp;
|
extern MainApp* gMainApp;
|
||||||
extern const char* kAppSig;
|
extern const char* kAppSig;
|
||||||
|
|
||||||
#endif
|
#endif // __MAIN_APP_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007, Haiku. All rights reserved.
|
* Copyright 2007-2009, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -8,10 +8,12 @@
|
|||||||
#ifndef PLAYBACK_STATE_H
|
#ifndef PLAYBACK_STATE_H
|
||||||
#define PLAYBACK_STATE_H
|
#define PLAYBACK_STATE_H
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PLAYBACK_STATE_STOPPED = 0,
|
PLAYBACK_STATE_STOPPED = 0,
|
||||||
PLAYBACK_STATE_PLAYING = 1,
|
PLAYBACK_STATE_PLAYING = 1,
|
||||||
PLAYBACK_STATE_PAUSED = 2,
|
PLAYBACK_STATE_PAUSED = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // PLAYBACK_STATE_H
|
#endif // PLAYBACK_STATE_H
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ enum {
|
|||||||
#define kVolumeFactor 1000
|
#define kVolumeFactor 1000
|
||||||
#define kPositionFactor 3000
|
#define kPositionFactor 3000
|
||||||
|
|
||||||
// constructor
|
|
||||||
TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
||||||
bool usePeakView, bool useWindButtons)
|
bool usePeakView, bool useWindButtons)
|
||||||
: BView(frame, "transport control group",
|
:
|
||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
BView(frame, "transport control group", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS)
|
B_WILL_DRAW | B_FRAME_EVENTS),
|
||||||
, fBottomControlHeight(0.0)
|
fBottomControlHeight(0.0),
|
||||||
, fPeakViewMinWidth(0.0)
|
fPeakViewMinWidth(0.0)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
|||||||
|
|
||||||
// Volume Slider
|
// Volume Slider
|
||||||
fVolumeSlider = new VolumeSlider(BRect(0.0, 0.0, VOLUME_MIN_WIDTH,
|
fVolumeSlider = new VolumeSlider(BRect(0.0, 0.0, VOLUME_MIN_WIDTH,
|
||||||
kVolumeSliderBitmapHeight - 1.0), "volume slider",
|
kVolumeSliderBitmapHeight - 1.0), "volume slider",
|
||||||
_DbToGain(_ExponentialToLinear(kVolumeDbMin)) * kVolumeFactor,
|
_DbToGain(_ExponentialToLinear(kVolumeDbMin)) * kVolumeFactor,
|
||||||
_DbToGain(_ExponentialToLinear(kVolumeDbMax)) * kVolumeFactor,
|
_DbToGain(_ExponentialToLinear(kVolumeDbMax)) * kVolumeFactor,
|
||||||
new BMessage(MSG_SET_VOLUME));
|
new BMessage(MSG_SET_VOLUME));
|
||||||
@@ -159,12 +159,12 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
TransportControlGroup::~TransportControlGroup()
|
TransportControlGroup::~TransportControlGroup()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// AttachedToWindow
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::AttachedToWindow()
|
TransportControlGroup::AttachedToWindow()
|
||||||
{
|
{
|
||||||
@@ -188,7 +188,7 @@ TransportControlGroup::AttachedToWindow()
|
|||||||
FrameResized(Bounds().Width(), Bounds().Height());
|
FrameResized(Bounds().Width(), Bounds().Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FrameResized
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::FrameResized(float width, float height)
|
TransportControlGroup::FrameResized(float width, float height)
|
||||||
{
|
{
|
||||||
@@ -198,7 +198,7 @@ TransportControlGroup::FrameResized(float width, float height)
|
|||||||
_LayoutControls(r);
|
_LayoutControls(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreferredSize
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::GetPreferredSize(float* width, float* height)
|
TransportControlGroup::GetPreferredSize(float* width, float* height)
|
||||||
{
|
{
|
||||||
@@ -210,7 +210,7 @@ TransportControlGroup::GetPreferredSize(float* width, float* height)
|
|||||||
*height = r.Height();
|
*height = r.Height();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageReceived
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::MessageReceived(BMessage* message)
|
TransportControlGroup::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -253,55 +253,67 @@ TransportControlGroup::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
|
||||||
|
|
||||||
// default implementation for the virtuals
|
// #pragma mark - default implementation for the virtuals
|
||||||
uint32 TransportControlGroup::EnabledButtons() { return 0; }
|
|
||||||
void TransportControlGroup::TogglePlaying() {}
|
|
||||||
void TransportControlGroup::Stop() {}
|
uint32
|
||||||
void TransportControlGroup::Rewind() {}
|
TransportControlGroup::EnabledButtons()
|
||||||
void TransportControlGroup::Forward() {}
|
{
|
||||||
void TransportControlGroup::SkipBackward() {}
|
return 0;
|
||||||
void TransportControlGroup::SkipForward() {}
|
}
|
||||||
void TransportControlGroup::VolumeChanged(float value) {}
|
|
||||||
void TransportControlGroup::ToggleMute() {}
|
|
||||||
void TransportControlGroup::PositionChanged(float value){}
|
void TransportControlGroup::TogglePlaying() {}
|
||||||
|
void TransportControlGroup::Stop() {}
|
||||||
|
void TransportControlGroup::Rewind() {}
|
||||||
|
void TransportControlGroup::Forward() {}
|
||||||
|
void TransportControlGroup::SkipBackward() {}
|
||||||
|
void TransportControlGroup::SkipForward() {}
|
||||||
|
void TransportControlGroup::VolumeChanged(float value) {}
|
||||||
|
void TransportControlGroup::ToggleMute() {}
|
||||||
|
void TransportControlGroup::PositionChanged(float value) {}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
TransportControlGroup::_LinearToExponential(float db_in)
|
TransportControlGroup::_LinearToExponential(float dbIn)
|
||||||
{
|
{
|
||||||
float db = db_in;
|
float db = dbIn;
|
||||||
if (db >= 0) {
|
if (db >= 0) {
|
||||||
db = db * (pow(fabs(kVolumeDbMax), (1.0 / kVolumeDbExpPositive)) / fabs(kVolumeDbMax));
|
db = db * (pow(fabs(kVolumeDbMax), (1.0 / kVolumeDbExpPositive))
|
||||||
|
/ fabs(kVolumeDbMax));
|
||||||
db = pow(db, kVolumeDbExpPositive);
|
db = pow(db, kVolumeDbExpPositive);
|
||||||
} else {
|
} else {
|
||||||
db = -db;
|
db = -db;
|
||||||
db = db * (pow(fabs(kVolumeDbMin), (1.0 / kVolumeDbExpNegative)) / fabs(kVolumeDbMin));
|
db = db * (pow(fabs(kVolumeDbMin), (1.0 / kVolumeDbExpNegative))
|
||||||
|
/ fabs(kVolumeDbMin));
|
||||||
db = pow(db, kVolumeDbExpNegative);
|
db = pow(db, kVolumeDbExpNegative);
|
||||||
db = -db;
|
db = -db;
|
||||||
}
|
}
|
||||||
printf("_LinearToExponential %.4f => %.4f\n", db_in, db);
|
printf("_LinearToExponential %.4f => %.4f\n", dbIn, db);
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
TransportControlGroup::_ExponentialToLinear(float db_in)
|
TransportControlGroup::_ExponentialToLinear(float dbIn)
|
||||||
{
|
{
|
||||||
float db = db_in;
|
float db = dbIn;
|
||||||
if (db >= 0) {
|
if (db >= 0) {
|
||||||
db = pow(db, (1.0 / kVolumeDbExpPositive));
|
db = pow(db, (1.0 / kVolumeDbExpPositive));
|
||||||
db = db * (fabs(kVolumeDbMax) / pow(fabs(kVolumeDbMax), (1.0 / kVolumeDbExpPositive)));
|
db = db * (fabs(kVolumeDbMax) / pow(fabs(kVolumeDbMax),
|
||||||
|
(1.0 / kVolumeDbExpPositive)));
|
||||||
} else {
|
} else {
|
||||||
db = -db;
|
db = -db;
|
||||||
db = pow(db, (1.0 / kVolumeDbExpNegative));
|
db = pow(db, (1.0 / kVolumeDbExpNegative));
|
||||||
db = db * (fabs(kVolumeDbMin) / pow(fabs(kVolumeDbMin), (1.0 / kVolumeDbExpNegative)));
|
db = db * (fabs(kVolumeDbMin) / pow(fabs(kVolumeDbMin),
|
||||||
|
(1.0 / kVolumeDbExpNegative)));
|
||||||
db = -db;
|
db = -db;
|
||||||
}
|
}
|
||||||
//printf("_ExponentialToLinear %.4f => %.4f\n", db_in, db);
|
//printf("_ExponentialToLinear %.4f => %.4f\n", dbIn, db);
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +334,7 @@ TransportControlGroup::_GainToDb(float gain)
|
|||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// SetEnabled
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::SetEnabled(uint32 buttons)
|
TransportControlGroup::SetEnabled(uint32 buttons)
|
||||||
{
|
{
|
||||||
@@ -349,9 +361,10 @@ TransportControlGroup::SetEnabled(uint32 buttons)
|
|||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// SetPlaybackState
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::SetPlaybackState(uint32 state)
|
TransportControlGroup::SetPlaybackState(uint32 state)
|
||||||
{
|
{
|
||||||
@@ -373,7 +386,7 @@ TransportControlGroup::SetPlaybackState(uint32 state)
|
|||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSkippable
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::SetSkippable(bool backward, bool forward)
|
TransportControlGroup::SetSkippable(bool backward, bool forward)
|
||||||
{
|
{
|
||||||
@@ -388,9 +401,10 @@ TransportControlGroup::SetSkippable(bool backward, bool forward)
|
|||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// SetAudioEnabled
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::SetAudioEnabled(bool enabled)
|
TransportControlGroup::SetAudioEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
@@ -403,7 +417,7 @@ TransportControlGroup::SetAudioEnabled(bool enabled)
|
|||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMuted
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::SetMuted(bool mute)
|
TransportControlGroup::SetMuted(bool mute)
|
||||||
{
|
{
|
||||||
@@ -440,7 +454,7 @@ TransportControlGroup::SetPosition(float value)
|
|||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// _LayoutControls
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_LayoutControls(BRect frame) const
|
TransportControlGroup::_LayoutControls(BRect frame) const
|
||||||
{
|
{
|
||||||
@@ -535,8 +549,8 @@ TransportControlGroup::_LayoutControls(BRect frame) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _MinFrame
|
|
||||||
BRect
|
BRect
|
||||||
TransportControlGroup::_MinFrame() const
|
TransportControlGroup::_MinFrame() const
|
||||||
{
|
{
|
||||||
// add up width of controls along bottom (seek slider will likely adopt)
|
// add up width of controls along bottom (seek slider will likely adopt)
|
||||||
@@ -563,7 +577,7 @@ TransportControlGroup::_MinFrame() const
|
|||||||
return BRect(0.0, 0.0, minWidth - 1.0, minHeight - 1.0);
|
return BRect(0.0, 0.0, minWidth - 1.0, minHeight - 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _LayoutControl
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_LayoutControl(BView* view, BRect frame,
|
TransportControlGroup::_LayoutControl(BView* view, BRect frame,
|
||||||
bool resizeWidth, bool resizeHeight) const
|
bool resizeWidth, bool resizeHeight) const
|
||||||
@@ -581,14 +595,14 @@ TransportControlGroup::_LayoutControl(BView* view, BRect frame,
|
|||||||
view->ResizeTo(width, height);
|
view->ResizeTo(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _TogglePlaying
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_TogglePlaying()
|
TransportControlGroup::_TogglePlaying()
|
||||||
{
|
{
|
||||||
TogglePlaying();
|
TogglePlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
// _Stop
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_Stop()
|
TransportControlGroup::_Stop()
|
||||||
{
|
{
|
||||||
@@ -596,34 +610,35 @@ TransportControlGroup::_Stop()
|
|||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// _Rewind
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_Rewind()
|
TransportControlGroup::_Rewind()
|
||||||
{
|
{
|
||||||
Rewind();
|
Rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
// _Forward
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_Forward()
|
TransportControlGroup::_Forward()
|
||||||
{
|
{
|
||||||
Forward();
|
Forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
// _SkipBackward
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_SkipBackward()
|
TransportControlGroup::_SkipBackward()
|
||||||
{
|
{
|
||||||
SkipBackward();
|
SkipBackward();
|
||||||
}
|
}
|
||||||
|
|
||||||
// _SkipForward
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_SkipForward()
|
TransportControlGroup::_SkipForward()
|
||||||
{
|
{
|
||||||
SkipForward();
|
SkipForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_UpdateVolume()
|
TransportControlGroup::_UpdateVolume()
|
||||||
{
|
{
|
||||||
@@ -634,7 +649,7 @@ TransportControlGroup::_UpdateVolume()
|
|||||||
VolumeChanged(gain);
|
VolumeChanged(gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _ToggleMute
|
|
||||||
void
|
void
|
||||||
TransportControlGroup::_ToggleMute()
|
TransportControlGroup::_ToggleMute()
|
||||||
{
|
{
|
||||||
@@ -648,5 +663,3 @@ TransportControlGroup::_UpdatePosition()
|
|||||||
{
|
{
|
||||||
PositionChanged(fSeekSlider->Value() / (float)kPositionFactor);
|
PositionChanged(fSeekSlider->Value() / (float)kPositionFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2006-2008 Stephan Aßmus <superstippi@gmx.de>
|
* Copyright 2006-2008 Stephan Aßmus <superstippi@gmx.de>
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef TRANSPORT_CONTROL_GROUP_H
|
||||||
|
#define TRANSPORT_CONTROL_GROUP_H
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Based on my code in the BeOS interface for the VLC media player
|
// NOTE: Based on my code in the BeOS interface for the VLC media player
|
||||||
// that I did during the VLC 0.4.3 - 0.4.6 times. Code not written by me
|
// that I did during the VLC 0.4.3 - 0.4.6 times. Code not written by me
|
||||||
// removed. -Stephan Aßmus
|
// removed. -Stephan Aßmus
|
||||||
|
|
||||||
#ifndef TRANSPORT_CONTROL_GROUP_H
|
|
||||||
#define TRANSPORT_CONTROL_GROUP_H
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
class PeakView;
|
class PeakView;
|
||||||
class PlayPauseButton;
|
class PlayPauseButton;
|
||||||
class TransportButton;
|
class TransportButton;
|
||||||
@@ -28,11 +30,11 @@ enum {
|
|||||||
SEEK_ENABLED = 1 << 6,
|
SEEK_ENABLED = 1 << 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TransportControlGroup : public BView {
|
class TransportControlGroup : public BView {
|
||||||
public:
|
public:
|
||||||
TransportControlGroup(BRect frame,
|
TransportControlGroup(BRect frame,
|
||||||
bool useSkipButtons,
|
bool useSkipButtons, bool usePeakView,
|
||||||
bool usePeakView,
|
|
||||||
bool useWindButtons);
|
bool useWindButtons);
|
||||||
virtual ~TransportControlGroup();
|
virtual ~TransportControlGroup();
|
||||||
|
|
||||||
@@ -56,9 +58,8 @@ class TransportControlGroup : public BView {
|
|||||||
|
|
||||||
void SetEnabled(uint32 whichButtons);
|
void SetEnabled(uint32 whichButtons);
|
||||||
|
|
||||||
void SetPlaybackState(uint32 state);
|
void SetPlaybackState(uint32 state);
|
||||||
void SetSkippable(bool backward,
|
void SetSkippable(bool backward, bool forward);
|
||||||
bool forward);
|
|
||||||
|
|
||||||
void SetAudioEnabled(bool enable);
|
void SetAudioEnabled(bool enable);
|
||||||
void SetMuted(bool mute);
|
void SetMuted(bool mute);
|
||||||
@@ -69,13 +70,12 @@ class TransportControlGroup : public BView {
|
|||||||
PeakView* GetPeakView() const
|
PeakView* GetPeakView() const
|
||||||
{ return fPeakView; }
|
{ return fPeakView; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _LayoutControls(BRect frame) const;
|
void _LayoutControls(BRect frame) const;
|
||||||
BRect _MinFrame() const;
|
BRect _MinFrame() const;
|
||||||
void _LayoutControl(BView* view,
|
void _LayoutControl(BView* view, BRect frame,
|
||||||
BRect frame,
|
bool resizeWidth = false,
|
||||||
bool resizeWidth = false,
|
bool resizeHeight = false) const;
|
||||||
bool resizeHeight = false) const;
|
|
||||||
|
|
||||||
void _TogglePlaying();
|
void _TogglePlaying();
|
||||||
void _Stop();
|
void _Stop();
|
||||||
|
|||||||
@@ -1,34 +1,38 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2006 Marcus Overhagen <marcus@overhagen.de>. All rights reserved.
|
* Copyright 2006 Marcus Overhagen <marcus@overhagen.de>. All rights reserved.
|
||||||
*
|
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <TimeSource.h>
|
|
||||||
#include <MediaRoster.h>
|
|
||||||
#include <BufferGroup.h>
|
|
||||||
#include <Buffer.h>
|
|
||||||
#include <Bitmap.h>
|
|
||||||
#include <Locker.h>
|
|
||||||
#include <Debug.h>
|
|
||||||
|
|
||||||
#include "VideoNode.h"
|
#include "VideoNode.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Bitmap.h>
|
||||||
|
#include <Buffer.h>
|
||||||
|
#include <BufferGroup.h>
|
||||||
|
#include <Debug.h>
|
||||||
|
#include <Locker.h>
|
||||||
|
#include <MediaRoster.h>
|
||||||
|
#include <TimeSource.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
#include "VideoView.h"
|
#include "VideoView.h"
|
||||||
|
|
||||||
|
|
||||||
VideoNode::VideoNode(const char *name, VideoView *view)
|
VideoNode::VideoNode(const char *name, VideoView *view)
|
||||||
: BMediaNode(name)
|
:
|
||||||
, BMediaEventLooper()
|
BMediaNode(name),
|
||||||
, BBufferConsumer(B_MEDIA_RAW_VIDEO)
|
BMediaEventLooper(),
|
||||||
, fVideoView(view)
|
BBufferConsumer(B_MEDIA_RAW_VIDEO),
|
||||||
, fInput()
|
fVideoView(view),
|
||||||
, fOverlayEnabled(true)
|
fInput(),
|
||||||
, fOverlayActive(false)
|
fOverlayEnabled(true),
|
||||||
, fDirectOverlayBuffer(false)
|
fOverlayActive(false),
|
||||||
, fBitmap(0)
|
fDirectOverlayBuffer(false),
|
||||||
, fBitmapLocker(new BLocker("Video Node Locker"))
|
fBitmap(0),
|
||||||
|
fBitmapLocker(new BLocker("Video Node Locker"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +133,7 @@ VideoNode::HandleEvent(const media_timed_event *event,
|
|||||||
default:
|
default:
|
||||||
printf("VideoNode::HandleEvent unknown event");
|
printf("VideoNode::HandleEvent unknown event");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -149,7 +153,7 @@ VideoNode::GetLatencyFor(const media_destination &dst,
|
|||||||
{
|
{
|
||||||
if (dst != fInput.destination)
|
if (dst != fInput.destination)
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
|
|
||||||
*out_latency = 10000;
|
*out_latency = 10000;
|
||||||
*out_id = TimeSource()->ID();
|
*out_id = TimeSource()->ID();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -166,18 +170,18 @@ VideoNode::AcceptFormat(const media_destination &dst,
|
|||||||
* BBufferConsumer::Connected
|
* BBufferConsumer::Connected
|
||||||
* BBufferProducer::Connect
|
* BBufferProducer::Connect
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (dst != fInput.destination)
|
if (dst != fInput.destination)
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
|
|
||||||
if (format->type == B_MEDIA_NO_TYPE)
|
if (format->type == B_MEDIA_NO_TYPE)
|
||||||
format->type = B_MEDIA_RAW_VIDEO;
|
format->type = B_MEDIA_RAW_VIDEO;
|
||||||
|
|
||||||
if (format->type != B_MEDIA_RAW_VIDEO)
|
if (format->type != B_MEDIA_RAW_VIDEO)
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -213,12 +217,12 @@ VideoNode::Connected(const media_source &src,
|
|||||||
if (err) {
|
if (err) {
|
||||||
printf("VideoNode::Connected failed, fOverlayEnabled = %d\n", fOverlayEnabled);
|
printf("VideoNode::Connected failed, fOverlayEnabled = %d\n", fOverlayEnabled);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_input = fInput;
|
*out_input = fInput;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -268,12 +272,12 @@ VideoNode::FormatChanged(const media_source &src,
|
|||||||
if (err) {
|
if (err) {
|
||||||
printf("VideoNode::FormatChanged failed (lost buffer group!)\n");
|
printf("VideoNode::FormatChanged failed (lost buffer group!)\n");
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
fInput.format = format;
|
fInput.format = format;
|
||||||
|
|
||||||
//printf("VideoNode::FormatChanged leave\n");
|
//printf("VideoNode::FormatChanged leave\n");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -281,7 +285,7 @@ void
|
|||||||
VideoNode::HandleBuffer(BBuffer *buffer)
|
VideoNode::HandleBuffer(BBuffer *buffer)
|
||||||
{
|
{
|
||||||
// printf("VideoNode::HandleBuffer\n");
|
// printf("VideoNode::HandleBuffer\n");
|
||||||
|
|
||||||
LockBitmap();
|
LockBitmap();
|
||||||
if (fBitmap) {
|
if (fBitmap) {
|
||||||
// bigtime_t start = system_time();
|
// bigtime_t start = system_time();
|
||||||
@@ -341,7 +345,7 @@ VideoNode::IsOverlayActive()
|
|||||||
status_t
|
status_t
|
||||||
VideoNode::CreateBuffers(BRect frame, color_space cspace, bool overlay)
|
VideoNode::CreateBuffers(BRect frame, color_space cspace, bool overlay)
|
||||||
{
|
{
|
||||||
printf("VideoNode::CreateBuffers: frame %d,%d,%d,%d colorspace 0x%08x, overlay %d\n",
|
printf("VideoNode::CreateBuffers: frame %d,%d,%d,%d colorspace 0x%08x, overlay %d\n",
|
||||||
int(frame.left), int(frame.top), int(frame.right), int(frame.bottom), int(cspace), overlay);
|
int(frame.left), int(frame.top), int(frame.right), int(frame.bottom), int(cspace), overlay);
|
||||||
|
|
||||||
LockBitmap();
|
LockBitmap();
|
||||||
|
|||||||
@@ -1,92 +1,81 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2006 Marcus Overhagen <marcus@overhagen.de>. All rights reserved.
|
* Copyright 2006 Marcus Overhagen <marcus@overhagen.de>. All rights reserved.
|
||||||
*
|
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef __VIDEO_NODE_H_
|
#ifndef __VIDEO_NODE_H_
|
||||||
#define __VIDEO_NODE_H_
|
#define __VIDEO_NODE_H_
|
||||||
|
|
||||||
|
|
||||||
#include <BufferConsumer.h>
|
#include <BufferConsumer.h>
|
||||||
#include <MediaEventLooper.h>
|
#include <MediaEventLooper.h>
|
||||||
|
|
||||||
|
|
||||||
class VideoView;
|
class VideoView;
|
||||||
|
|
||||||
class VideoNode : public BMediaEventLooper, public BBufferConsumer
|
|
||||||
{
|
class VideoNode : public BMediaEventLooper, public BBufferConsumer {
|
||||||
public:
|
public:
|
||||||
VideoNode(const char *name, VideoView *view);
|
VideoNode(const char* name, VideoView* view);
|
||||||
~VideoNode();
|
virtual ~VideoNode();
|
||||||
|
|
||||||
void SetOverlayEnabled(bool yesno);
|
void SetOverlayEnabled(bool yesno);
|
||||||
bool IsOverlayActive();
|
bool IsOverlayActive();
|
||||||
|
|
||||||
void LockBitmap();
|
|
||||||
BBitmap * Bitmap();
|
|
||||||
void UnlockBitmap();
|
|
||||||
|
|
||||||
protected:
|
void LockBitmap();
|
||||||
BMediaAddOn * AddOn(int32 *internal_id) const;
|
BBitmap* Bitmap();
|
||||||
|
void UnlockBitmap();
|
||||||
void NodeRegistered();
|
|
||||||
|
|
||||||
void BufferReceived(BBuffer * buffer);
|
|
||||||
|
|
||||||
status_t GetNextInput(int32 *cookie, media_input *out_input);
|
|
||||||
void DisposeInputCookie(int32 cookie);
|
|
||||||
|
|
||||||
status_t HandleMessage(
|
|
||||||
int32 message,
|
|
||||||
const void *data,
|
|
||||||
size_t size);
|
|
||||||
|
|
||||||
void HandleEvent(
|
|
||||||
const media_timed_event *event,
|
|
||||||
bigtime_t lateness,
|
|
||||||
bool realTimeEvent);
|
|
||||||
|
|
||||||
status_t AcceptFormat(
|
|
||||||
const media_destination &dst,
|
|
||||||
media_format *format);
|
|
||||||
|
|
||||||
void ProducerDataStatus(
|
|
||||||
const media_destination &dst,
|
|
||||||
int32 status,
|
|
||||||
bigtime_t at_media_time);
|
|
||||||
|
|
||||||
status_t GetLatencyFor(
|
|
||||||
const media_destination &dst,
|
|
||||||
bigtime_t *out_latency,
|
|
||||||
media_node_id *out_id);
|
|
||||||
|
|
||||||
status_t Connected(
|
|
||||||
const media_source &src,
|
|
||||||
const media_destination &dst,
|
|
||||||
const media_format &format,
|
|
||||||
media_input *out_input);
|
|
||||||
|
|
||||||
void Disconnected(
|
|
||||||
const media_source &src,
|
|
||||||
const media_destination &dst);
|
|
||||||
|
|
||||||
status_t FormatChanged(
|
|
||||||
const media_source &src,
|
|
||||||
const media_destination &dst,
|
|
||||||
int32 from_change_count,
|
|
||||||
const media_format &format);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void HandleBuffer(BBuffer *buffer);
|
virtual BMediaAddOn* AddOn(int32* internalID) const;
|
||||||
status_t CreateBuffers(BRect frame, color_space cspace, bool overlay);
|
|
||||||
void DeleteBuffers();
|
// BMediaEventLooper implementation
|
||||||
|
virtual void NodeRegistered();
|
||||||
|
virtual void HandleEvent(const media_timed_event* event,
|
||||||
|
bigtime_t lateness, bool realTimeEvent);
|
||||||
|
|
||||||
|
// BBuffer implementation
|
||||||
|
virtual status_t HandleMessage(int32 message, const void* data,
|
||||||
|
size_t size);
|
||||||
|
|
||||||
|
virtual status_t AcceptFormat(const media_destination& dest,
|
||||||
|
media_format* format);
|
||||||
|
virtual status_t GetNextInput(int32* cookie,
|
||||||
|
media_input* _input);
|
||||||
|
virtual void DisposeInputCookie(int32 cookie);
|
||||||
|
virtual void BufferReceived(BBuffer* buffer);
|
||||||
|
virtual void ProducerDataStatus(
|
||||||
|
const media_destination& dest, int32 status,
|
||||||
|
bigtime_t atMediaTime);
|
||||||
|
virtual status_t GetLatencyFor(const media_destination& dest,
|
||||||
|
bigtime_t* _latency, media_node_id* _id);
|
||||||
|
|
||||||
|
virtual status_t Connected(const media_source& source,
|
||||||
|
const media_destination& dest,
|
||||||
|
const media_format& format,
|
||||||
|
media_input* _input);
|
||||||
|
virtual void Disconnected(const media_source& source,
|
||||||
|
const media_destination& dest);
|
||||||
|
virtual status_t FormatChanged(const media_source& source,
|
||||||
|
const media_destination& dest,
|
||||||
|
int32 fromChangeCount,
|
||||||
|
const media_format& format);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VideoView * fVideoView;
|
void HandleBuffer(BBuffer* buffer);
|
||||||
media_input fInput;
|
status_t CreateBuffers(BRect frame, color_space space,
|
||||||
bool fOverlayEnabled;
|
bool overlay);
|
||||||
bool fOverlayActive;
|
void DeleteBuffers();
|
||||||
bool fDirectOverlayBuffer; // If the overlay memory is directly written by the producer node.
|
|
||||||
BBitmap * fBitmap;
|
protected:
|
||||||
BLocker * fBitmapLocker;
|
VideoView* fVideoView;
|
||||||
|
media_input fInput;
|
||||||
|
bool fOverlayEnabled;
|
||||||
|
bool fOverlayActive;
|
||||||
|
bool fDirectOverlayBuffer;
|
||||||
|
// If the overlay memory is directly written by the
|
||||||
|
// producer node.
|
||||||
|
BBitmap* fBitmap;
|
||||||
|
BLocker* fBitmapLocker;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // __VIDEO_NODE_H_
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2006-2009 Stephan Aßmus <superstippi@gmx.de>
|
* Copyright 2006-2009 Stephan Aßmus <superstippi@gmx.de>
|
||||||
* All rights reserved. Distributed under the terms of the MIT license.
|
* All rights reserved. Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "VideoView.h"
|
#include "VideoView.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -25,13 +27,14 @@
|
|||||||
|
|
||||||
|
|
||||||
VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
|
VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
|
||||||
: BView(frame, name, resizeMask, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE
|
:
|
||||||
|
BView(frame, name, resizeMask, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE
|
||||||
| B_PULSE_NEEDED),
|
| B_PULSE_NEEDED),
|
||||||
fOverlayMode(false),
|
fOverlayMode(false),
|
||||||
fIsPlaying(false),
|
fIsPlaying(false),
|
||||||
fIsFullscreen(false),
|
fIsFullscreen(false),
|
||||||
fLastMouseMove(system_time()),
|
fLastMouseMove(system_time()),
|
||||||
fGlobalSettingsListener(this)
|
fGlobalSettingsListener(this)
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
// might be reset to overlay key color if overlays are used
|
// might be reset to overlay key color if overlays are used
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2006-2009 Stephan Aßmus <superstippi@gmx.de>
|
* Copyright 2006-2009 Stephan Aßmus <superstippi@gmx.de>
|
||||||
* All rights reserved. Distributed under the terms of the MIT license.
|
* All rights reserved. Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
#ifndef VIDEO_VIEW_H
|
#ifndef VIDEO_VIEW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user