* Minor cleanup, no functional changes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36222 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
33fbe25496
commit
bafcab9265
@ -43,12 +43,17 @@
|
|||||||
#include "SettingsWindow.h"
|
#include "SettingsWindow.h"
|
||||||
|
|
||||||
|
|
||||||
MainApp* gMainApp;
|
|
||||||
|
static const char* kCurrentPlaylistFilename = "MediaPlayer Current Playlist";
|
||||||
|
|
||||||
const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer";
|
const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer";
|
||||||
|
|
||||||
|
MainApp* gMainApp;
|
||||||
|
|
||||||
static const char* kMediaServerSig = B_MEDIA_SERVER_SIGNATURE;
|
static const char* kMediaServerSig = B_MEDIA_SERVER_SIGNATURE;
|
||||||
static const char* kMediaServerAddOnSig = "application/x-vnd.Be.addon-host";
|
static const char* kMediaServerAddOnSig = "application/x-vnd.Be.addon-host";
|
||||||
|
|
||||||
|
|
||||||
MainApp::MainApp()
|
MainApp::MainApp()
|
||||||
:
|
:
|
||||||
BApplication(kAppSig),
|
BApplication(kAppSig),
|
||||||
@ -116,7 +121,7 @@ MainApp::QuitRequested()
|
|||||||
|
|
||||||
BMessage quitMessage;
|
BMessage quitMessage;
|
||||||
playerWindow->GetQuitMessage(&quitMessage);
|
playerWindow->GetQuitMessage(&quitMessage);
|
||||||
|
|
||||||
// Store the playlist if there is one. If the user has multiple
|
// Store the playlist if there is one. If the user has multiple
|
||||||
// instances playing audio at the this time, the first instance wins.
|
// instances playing audio at the this time, the first instance wins.
|
||||||
BMessage playlistArchive;
|
BMessage playlistArchive;
|
||||||
@ -569,9 +574,6 @@ MainApp::_HandleFilePanelResult(BFilePanel* panel, const BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char* kCurrentPlaylistFilename = "MediaPlayer Current Playlist";
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainApp::_StoreCurrentPlaylist(const BMessage* message) const
|
MainApp::_StoreCurrentPlaylist(const BMessage* message) const
|
||||||
{
|
{
|
||||||
@ -605,6 +607,7 @@ MainApp::_RestoreCurrentPlaylist(BMessage* message) const
|
|||||||
return message->Unflatten(&file);
|
return message->Unflatten(&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainApp::_InstallPlaylistMimeType()
|
MainApp::_InstallPlaylistMimeType()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
|
* Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
|
||||||
* Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
|
* Copyright (c) 2000-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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//! This class controls our media nodes and general playback
|
||||||
|
|
||||||
|
|
||||||
#include "NodeManager.h"
|
#include "NodeManager.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -18,52 +23,59 @@
|
|||||||
#include "VideoProducer.h"
|
#include "VideoProducer.h"
|
||||||
#include "VideoSupplier.h"
|
#include "VideoSupplier.h"
|
||||||
|
|
||||||
|
|
||||||
// debugging
|
// debugging
|
||||||
//#define TRACE_NODE_MANAGER
|
//#define TRACE_NODE_MANAGER
|
||||||
#ifdef TRACE_NODE_MANAGER
|
#ifdef TRACE_NODE_MANAGER
|
||||||
# define TRACE(x...) printf(x)
|
# define TRACE(x...) printf(x)
|
||||||
# define ERROR(x...) fprintf(stderr, x)
|
# define ERROR(x...) fprintf(stderr, x)
|
||||||
#else
|
#else
|
||||||
# define TRACE(x...)
|
# define TRACE(x...)
|
||||||
# define ERROR(x...) fprintf(stderr, x)
|
# define ERROR(x...) fprintf(stderr, x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define print_error(str, status) printf(str ", error: %s\n", strerror(status))
|
#define print_error(str, status) printf(str ", error: %s\n", strerror(status))
|
||||||
|
|
||||||
|
|
||||||
NodeManager::Connection::Connection()
|
NodeManager::Connection::Connection()
|
||||||
: connected(false)
|
:
|
||||||
|
connected(false)
|
||||||
{
|
{
|
||||||
memset(&format, 0, sizeof(media_format));
|
memset(&format, 0, sizeof(media_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
// constructor
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
NodeManager::NodeManager()
|
NodeManager::NodeManager()
|
||||||
: PlaybackManager(),
|
:
|
||||||
fMediaRoster(NULL),
|
PlaybackManager(),
|
||||||
fAudioProducer(NULL),
|
fMediaRoster(NULL),
|
||||||
fVideoConsumer(NULL),
|
fAudioProducer(NULL),
|
||||||
fVideoProducer(NULL),
|
fVideoConsumer(NULL),
|
||||||
fTimeSource(media_node::null),
|
fVideoProducer(NULL),
|
||||||
fAudioConnection(),
|
fTimeSource(media_node::null),
|
||||||
fVideoConnection(),
|
fAudioConnection(),
|
||||||
fPerformanceTimeBase(0),
|
fVideoConnection(),
|
||||||
fStatus(B_NO_INIT),
|
fPerformanceTimeBase(0),
|
||||||
fVideoTarget(NULL),
|
fStatus(B_NO_INIT),
|
||||||
fAudioSupplier(NULL),
|
fVideoTarget(NULL),
|
||||||
fVideoSupplier(NULL),
|
fAudioSupplier(NULL),
|
||||||
fVideoBounds(0, 0, -1, -1),
|
fVideoSupplier(NULL),
|
||||||
fPeakListener(NULL)
|
fVideoBounds(0, 0, -1, -1),
|
||||||
|
fPeakListener(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
NodeManager::~NodeManager()
|
NodeManager::~NodeManager()
|
||||||
{
|
{
|
||||||
_StopNodes();
|
_StopNodes();
|
||||||
_TearDownNodes();
|
_TearDownNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::Init(BRect videoBounds, float videoFrameRate,
|
NodeManager::Init(BRect videoBounds, float videoFrameRate,
|
||||||
color_space preferredVideoFormat, float audioFrameRate,
|
color_space preferredVideoFormat, float audioFrameRate,
|
||||||
@ -87,14 +99,14 @@ NodeManager::Init(BRect videoBounds, float videoFrameRate,
|
|||||||
audioFrameRate, audioChannels, enabledNodes, useOverlays, true);
|
audioFrameRate, audioChannels, enabledNodes, useOverlays, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitCheck
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::InitCheck()
|
NodeManager::InitCheck()
|
||||||
{
|
{
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPlayMode
|
|
||||||
void
|
void
|
||||||
NodeManager::SetPlayMode(int32 mode, bool continuePlaying)
|
NodeManager::SetPlayMode(int32 mode, bool continuePlaying)
|
||||||
{
|
{
|
||||||
@ -108,7 +120,7 @@ NodeManager::SetPlayMode(int32 mode, bool continuePlaying)
|
|||||||
PlaybackManager::SetPlayMode(mode, continuePlaying);
|
PlaybackManager::SetPlayMode(mode, continuePlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CleanupNodes
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::CleanupNodes()
|
NodeManager::CleanupNodes()
|
||||||
{
|
{
|
||||||
@ -116,7 +128,7 @@ NodeManager::CleanupNodes()
|
|||||||
return _TearDownNodes(false);
|
return _TearDownNodes(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FormatChanged
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::FormatChanged(BRect videoBounds, float videoFrameRate,
|
NodeManager::FormatChanged(BRect videoBounds, float videoFrameRate,
|
||||||
color_space preferredVideoFormat, float audioFrameRate,
|
color_space preferredVideoFormat, float audioFrameRate,
|
||||||
@ -154,7 +166,7 @@ NodeManager::FormatChanged(BRect videoBounds, float videoFrameRate,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RealTimeForTime
|
|
||||||
bigtime_t
|
bigtime_t
|
||||||
NodeManager::RealTimeForTime(bigtime_t time) const
|
NodeManager::RealTimeForTime(bigtime_t time) const
|
||||||
{
|
{
|
||||||
@ -170,7 +182,7 @@ NodeManager::RealTimeForTime(bigtime_t time) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TimeForRealTime
|
|
||||||
bigtime_t
|
bigtime_t
|
||||||
NodeManager::TimeForRealTime(bigtime_t time) const
|
NodeManager::TimeForRealTime(bigtime_t time) const
|
||||||
{
|
{
|
||||||
@ -185,7 +197,7 @@ NodeManager::TimeForRealTime(bigtime_t time) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCurrentAudioTime
|
|
||||||
void
|
void
|
||||||
NodeManager::SetCurrentAudioTime(bigtime_t time)
|
NodeManager::SetCurrentAudioTime(bigtime_t time)
|
||||||
{
|
{
|
||||||
@ -197,7 +209,7 @@ NodeManager::SetCurrentAudioTime(bigtime_t time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVideoBounds
|
|
||||||
void
|
void
|
||||||
NodeManager::SetVideoBounds(BRect bounds)
|
NodeManager::SetVideoBounds(BRect bounds)
|
||||||
{
|
{
|
||||||
@ -207,14 +219,14 @@ NodeManager::SetVideoBounds(BRect bounds)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VideoBounds
|
|
||||||
BRect
|
BRect
|
||||||
NodeManager::VideoBounds() const
|
NodeManager::VideoBounds() const
|
||||||
{
|
{
|
||||||
return fVideoBounds;
|
return fVideoBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVideoTarget
|
|
||||||
void
|
void
|
||||||
NodeManager::SetVideoTarget(VideoTarget* videoTarget)
|
NodeManager::SetVideoTarget(VideoTarget* videoTarget)
|
||||||
{
|
{
|
||||||
@ -225,14 +237,14 @@ NodeManager::SetVideoTarget(VideoTarget* videoTarget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetVideoTarget
|
|
||||||
VideoTarget*
|
VideoTarget*
|
||||||
NodeManager::GetVideoTarget() const
|
NodeManager::GetVideoTarget() const
|
||||||
{
|
{
|
||||||
return fVideoTarget;
|
return fVideoTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVolume
|
|
||||||
void
|
void
|
||||||
NodeManager::SetVolume(float percent)
|
NodeManager::SetVolume(float percent)
|
||||||
{
|
{
|
||||||
@ -240,7 +252,7 @@ NodeManager::SetVolume(float percent)
|
|||||||
// our audio node...
|
// our audio node...
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPeakListener
|
|
||||||
void
|
void
|
||||||
NodeManager::SetPeakListener(BHandler* handler)
|
NodeManager::SetPeakListener(BHandler* handler)
|
||||||
{
|
{
|
||||||
@ -249,9 +261,10 @@ NodeManager::SetPeakListener(BHandler* handler)
|
|||||||
fAudioProducer->SetPeakListener(fPeakListener);
|
fAudioProducer->SetPeakListener(fPeakListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// _SetUpNodes
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::_SetUpNodes(color_space preferredVideoFormat, uint32 enabledNodes,
|
NodeManager::_SetUpNodes(color_space preferredVideoFormat, uint32 enabledNodes,
|
||||||
bool useOverlays, float audioFrameRate, uint32 audioChannels)
|
bool useOverlays, float audioFrameRate, uint32 audioChannels)
|
||||||
@ -287,7 +300,7 @@ NodeManager::_SetUpNodes(color_space preferredVideoFormat, uint32 enabledNodes,
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
printf("running without video node\n");
|
printf("running without video node\n");
|
||||||
|
|
||||||
// setup the audio nodes
|
// setup the audio nodes
|
||||||
if (enabledNodes != VIDEO_ONLY) {
|
if (enabledNodes != VIDEO_ONLY) {
|
||||||
fStatus = _SetUpAudioNodes(audioFrameRate, audioChannels);
|
fStatus = _SetUpAudioNodes(audioFrameRate, audioChannels);
|
||||||
@ -309,7 +322,6 @@ fNoAudio = true;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// _SetUpVideoNodes
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
||||||
bool useOverlays)
|
bool useOverlays)
|
||||||
@ -317,14 +329,14 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
// create the video producer node
|
// create the video producer node
|
||||||
fVideoProducer = new VideoProducer(NULL, "MediaPlayer video out", 0,
|
fVideoProducer = new VideoProducer(NULL, "MediaPlayer video out", 0,
|
||||||
this, fVideoSupplier);
|
this, fVideoSupplier);
|
||||||
|
|
||||||
// register the producer node
|
// register the producer node
|
||||||
fStatus = fMediaRoster->RegisterNode(fVideoProducer);
|
fStatus = fMediaRoster->RegisterNode(fVideoProducer);
|
||||||
if (fStatus != B_OK) {
|
if (fStatus != B_OK) {
|
||||||
print_error("Can't register the video producer", fStatus);
|
print_error("Can't register the video producer", fStatus);
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the Media Roster knows that we're using the node
|
// make sure the Media Roster knows that we're using the node
|
||||||
// fMediaRoster->GetNodeFor(fVideoProducer->Node().node,
|
// fMediaRoster->GetNodeFor(fVideoProducer->Node().node,
|
||||||
// &fVideoConnection.producer);
|
// &fVideoConnection.producer);
|
||||||
@ -333,7 +345,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
// create the video consumer node
|
// create the video consumer node
|
||||||
fVideoConsumer = new VideoConsumer("MediaPlayer video in", NULL, 0, this,
|
fVideoConsumer = new VideoConsumer("MediaPlayer video in", NULL, 0, this,
|
||||||
fVideoTarget);
|
fVideoTarget);
|
||||||
|
|
||||||
// register the consumer node
|
// register the consumer node
|
||||||
fStatus = fMediaRoster->RegisterNode(fVideoConsumer);
|
fStatus = fMediaRoster->RegisterNode(fVideoConsumer);
|
||||||
if (fStatus != B_OK) {
|
if (fStatus != B_OK) {
|
||||||
@ -345,7 +357,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
// fMediaRoster->GetNodeFor(fVideoConsumer->Node().node,
|
// fMediaRoster->GetNodeFor(fVideoConsumer->Node().node,
|
||||||
// &fVideoConnection.consumer);
|
// &fVideoConnection.consumer);
|
||||||
fVideoConnection.consumer = fVideoConsumer->Node();
|
fVideoConnection.consumer = fVideoConsumer->Node();
|
||||||
|
|
||||||
// find free producer output
|
// find free producer output
|
||||||
media_input videoInput;
|
media_input videoInput;
|
||||||
media_output videoOutput;
|
media_output videoOutput;
|
||||||
@ -384,7 +396,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
format.u.raw_video = videoFormat;
|
format.u.raw_video = videoFormat;
|
||||||
|
|
||||||
// connect video producer to consumer (hopefully using overlays)
|
// connect video producer to consumer (hopefully using overlays)
|
||||||
fVideoConsumer->SetTryOverlay(useOverlays);
|
fVideoConsumer->SetTryOverlay(useOverlays);
|
||||||
fStatus = fMediaRoster->Connect(videoOutput.source, videoInput.destination,
|
fStatus = fMediaRoster->Connect(videoOutput.source, videoInput.destination,
|
||||||
@ -406,7 +418,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fVideoConsumer->SetTryOverlay(false);
|
fVideoConsumer->SetTryOverlay(false);
|
||||||
// connect video producer to consumer (not using overlays and using
|
// connect video producer to consumer (not using overlays and using
|
||||||
// a colorspace that BViews support drawing)
|
// a colorspace that BViews support drawing)
|
||||||
fStatus = fMediaRoster->Connect(videoOutput.source,
|
fStatus = fMediaRoster->Connect(videoOutput.source,
|
||||||
videoInput.destination, &format, &videoOutput, &videoInput);
|
videoInput.destination, &format, &videoOutput, &videoInput);
|
||||||
@ -417,7 +429,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
fStatus);
|
fStatus);
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the inputs and outputs might have been reassigned during the
|
// the inputs and outputs might have been reassigned during the
|
||||||
// nodes' negotiation of the Connect(). That's why we wait until
|
// nodes' negotiation of the Connect(). That's why we wait until
|
||||||
// after Connect() finishes to save their contents.
|
// after Connect() finishes to save their contents.
|
||||||
@ -433,7 +445,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
print_error("Can't set the timesource for the video source", fStatus);
|
print_error("Can't set the timesource for the video source", fStatus);
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
fStatus = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(),
|
fStatus = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(),
|
||||||
fTimeSource.node);
|
fTimeSource.node);
|
||||||
if (fStatus != B_OK) {
|
if (fStatus != B_OK) {
|
||||||
@ -444,7 +456,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _SetUpAudioNodes
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::_SetUpAudioNodes(float audioFrameRate, uint32 audioChannels)
|
NodeManager::_SetUpAudioNodes(float audioFrameRate, uint32 audioChannels)
|
||||||
{
|
{
|
||||||
@ -517,7 +529,7 @@ NodeManager::_SetUpAudioNodes(float audioFrameRate, uint32 audioChannels)
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _TearDownNodes
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::_TearDownNodes(bool disconnect)
|
NodeManager::_TearDownNodes(bool disconnect)
|
||||||
{
|
{
|
||||||
@ -600,7 +612,7 @@ TRACE("NodeManager::_TearDownNodes() done\n");
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _StartNodes
|
|
||||||
status_t
|
status_t
|
||||||
NodeManager::_StartNodes()
|
NodeManager::_StartNodes()
|
||||||
{
|
{
|
||||||
@ -619,22 +631,22 @@ NodeManager::_StartNodes()
|
|||||||
&latency);
|
&latency);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
print_error("error getting latency for video producer",
|
print_error("error getting latency for video producer",
|
||||||
status);
|
status);
|
||||||
} else
|
} else
|
||||||
TRACE("video latency: %Ld\n", latency);
|
TRACE("video latency: %Ld\n", latency);
|
||||||
status = fMediaRoster->SetProducerRunModeDelay(
|
status = fMediaRoster->SetProducerRunModeDelay(
|
||||||
fVideoConnection.producer, latency);
|
fVideoConnection.producer, latency);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
print_error("error settings run mode delay for video producer",
|
print_error("error settings run mode delay for video producer",
|
||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the nodes
|
// start the nodes
|
||||||
status = fMediaRoster->GetInitialLatencyFor(
|
status = fMediaRoster->GetInitialLatencyFor(
|
||||||
fVideoConnection.producer, &initLatency);
|
fVideoConnection.producer, &initLatency);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
print_error("error getting initial latency for video producer",
|
print_error("error getting initial latency for video producer",
|
||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initLatency += estimate_max_scheduling_latency();
|
initLatency += estimate_max_scheduling_latency();
|
||||||
@ -646,7 +658,7 @@ NodeManager::_StartNodes()
|
|||||||
&audioLatency);
|
&audioLatency);
|
||||||
TRACE("audio latency: %Ld\n", audioLatency);
|
TRACE("audio latency: %Ld\n", audioLatency);
|
||||||
}
|
}
|
||||||
|
|
||||||
BTimeSource* timeSource;
|
BTimeSource* timeSource;
|
||||||
if (fVideoProducer) {
|
if (fVideoProducer) {
|
||||||
timeSource = fMediaRoster->MakeTimeSourceFor(
|
timeSource = fMediaRoster->MakeTimeSourceFor(
|
||||||
@ -656,7 +668,7 @@ NodeManager::_StartNodes()
|
|||||||
fAudioConnection.producer);
|
fAudioConnection.producer);
|
||||||
}
|
}
|
||||||
bool running = timeSource->IsRunning();
|
bool running = timeSource->IsRunning();
|
||||||
|
|
||||||
// workaround for people without sound cards
|
// workaround for people without sound cards
|
||||||
// because the system time source won't be running
|
// because the system time source won't be running
|
||||||
bigtime_t real = BTimeSource::RealTime();
|
bigtime_t real = BTimeSource::RealTime();
|
||||||
@ -712,7 +724,7 @@ printf("performance time for %lld: %lld\n", real + latency
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _StopNodes
|
|
||||||
void
|
void
|
||||||
NodeManager::_StopNodes()
|
NodeManager::_StopNodes()
|
||||||
{
|
{
|
||||||
@ -739,4 +751,3 @@ NodeManager::_StopNodes()
|
|||||||
}
|
}
|
||||||
TRACE("NodeManager::_StopNodes() done\n");
|
TRACE("NodeManager::_StopNodes() done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
|
* Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
|
||||||
* Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
|
* Copyright (c) 2000-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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//! This class controls our media nodes and general playback
|
|
||||||
|
|
||||||
#ifndef NODE_MANAGER_H
|
#ifndef NODE_MANAGER_H
|
||||||
#define NODE_MANAGER_H
|
#define NODE_MANAGER_H
|
||||||
|
|
||||||
|
|
||||||
#include <MediaNode.h>
|
#include <MediaNode.h>
|
||||||
|
|
||||||
#include "PlaybackManager.h"
|
#include "PlaybackManager.h"
|
||||||
|
|
||||||
|
|
||||||
class BMediaRoster;
|
class BMediaRoster;
|
||||||
class AudioProducer;
|
class AudioProducer;
|
||||||
class VideoTarget;
|
class VideoTarget;
|
||||||
@ -21,8 +20,9 @@ class VideoConsumer;
|
|||||||
class AudioSupplier;
|
class AudioSupplier;
|
||||||
class VideoSupplier;
|
class VideoSupplier;
|
||||||
|
|
||||||
|
|
||||||
class NodeManager : public PlaybackManager {
|
class NodeManager : public PlaybackManager {
|
||||||
public:
|
public:
|
||||||
NodeManager();
|
NodeManager();
|
||||||
virtual ~NodeManager();
|
virtual ~NodeManager();
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class NodeManager : public PlaybackManager {
|
|||||||
|
|
||||||
virtual void SetPlayMode(int32 mode,
|
virtual void SetPlayMode(int32 mode,
|
||||||
bool continuePlaying = true);
|
bool continuePlaying = true);
|
||||||
|
|
||||||
virtual bigtime_t RealTimeForTime(bigtime_t time) const;
|
virtual bigtime_t RealTimeForTime(bigtime_t time) const;
|
||||||
virtual bigtime_t TimeForRealTime(bigtime_t time) const;
|
virtual bigtime_t TimeForRealTime(bigtime_t time) const;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class NodeManager : public PlaybackManager {
|
|||||||
status_t _StartNodes();
|
status_t _StartNodes();
|
||||||
void _StopNodes();
|
void _StopNodes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Connection {
|
struct Connection {
|
||||||
Connection();
|
Connection();
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ private:
|
|||||||
bigtime_t fPerformanceTimeBase;
|
bigtime_t fPerformanceTimeBase;
|
||||||
|
|
||||||
status_t fStatus;
|
status_t fStatus;
|
||||||
//
|
//
|
||||||
VideoTarget* fVideoTarget;
|
VideoTarget* fVideoTarget;
|
||||||
AudioSupplier* fAudioSupplier;
|
AudioSupplier* fAudioSupplier;
|
||||||
VideoSupplier* fVideoSupplier;
|
VideoSupplier* fVideoSupplier;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// PlaybackManager.cpp
|
// PlaybackManager.cpp
|
||||||
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -13,17 +14,20 @@
|
|||||||
|
|
||||||
#include "PlaybackManager.h"
|
#include "PlaybackManager.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_NODE_MANAGER
|
//#define TRACE_NODE_MANAGER
|
||||||
#ifdef TRACE_NODE_MANAGER
|
#ifdef TRACE_NODE_MANAGER
|
||||||
# define TRACE(x...) printf(x)
|
# define TRACE(x...) printf(x)
|
||||||
# define ERROR(x...) fprintf(stderr, x)
|
# define ERROR(x...) fprintf(stderr, x)
|
||||||
#else
|
#else
|
||||||
# define TRACE(x...)
|
# define TRACE(x...)
|
||||||
# define ERROR(x...) fprintf(stderr, x)
|
# define ERROR(x...) fprintf(stderr, x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tdebug(const char* str)
|
tdebug(const char* str)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ImportPLItemsCommand.h"
|
#include "ImportPLItemsCommand.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
|
|
||||||
#include <debugger.h>
|
#include <debugger.h>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "PlaylistListView.h"
|
#include "PlaylistListView.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
@ -32,6 +33,7 @@
|
|||||||
#include "RandomizePLItemsCommand.h"
|
#include "RandomizePLItemsCommand.h"
|
||||||
#include "RemovePLItemsCommand.h"
|
#include "RemovePLItemsCommand.h"
|
||||||
|
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
|
|
||||||
@ -75,9 +77,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
PlaylistListView::Item::Item(PlaylistItem* item)
|
PlaylistListView::Item::Item(PlaylistItem* item)
|
||||||
: SimpleItem(item->Name().String()),
|
:
|
||||||
fItem(item)
|
SimpleItem(item->Name().String()),
|
||||||
|
fItem(item)
|
||||||
{
|
{
|
||||||
fItem->AddListener(this);
|
fItem->AddListener(this);
|
||||||
}
|
}
|
||||||
|
@ -176,9 +176,8 @@ PlaylistWindow::MessageReceived(BMessage* message)
|
|||||||
// player window, _not_ when it is dropped in this window
|
// player window, _not_ when it is dropped in this window
|
||||||
// outside of the playlist!
|
// outside of the playlist!
|
||||||
int32 appendIndex;
|
int32 appendIndex;
|
||||||
if (message->FindInt32("append_index", &appendIndex) == B_OK) {
|
if (message->FindInt32("append_index", &appendIndex) == B_OK)
|
||||||
fListView->RefsReceived(message, appendIndex);
|
fListView->RefsReceived(message, appendIndex);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007, Haiku. All rights reserved.
|
* Copyright 2007-2010, 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 <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
* Fredrik Modéen <fredrik@modeen.se>
|
* Fredrik Modéen <fredrik@modeen.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PLAYLIST_WINDOW_H
|
#ifndef PLAYLIST_WINDOW_H
|
||||||
#define PLAYLIST_WINDOW_H
|
#define PLAYLIST_WINDOW_H
|
||||||
|
|
||||||
@ -16,6 +15,7 @@
|
|||||||
|
|
||||||
#include "ListenerAdapter.h"
|
#include "ListenerAdapter.h"
|
||||||
|
|
||||||
|
|
||||||
class BMenuBar;
|
class BMenuBar;
|
||||||
class BMenuItem;
|
class BMenuItem;
|
||||||
class CommandStack;
|
class CommandStack;
|
||||||
@ -27,10 +27,12 @@ class RWLocker;
|
|||||||
class BButton;
|
class BButton;
|
||||||
class BFilePanel;
|
class BFilePanel;
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH = 'rmtr'
|
M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH = 'rmtr'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PlaylistWindow : public BWindow {
|
class PlaylistWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
PlaylistWindow(BRect frame,
|
PlaylistWindow(BRect frame,
|
||||||
@ -63,4 +65,5 @@ private:
|
|||||||
entry_ref fSavedPlaylistRef;
|
entry_ref fSavedPlaylistRef;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // PLAYLIST_WINDOW_H
|
#endif // PLAYLIST_WINDOW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user