* 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:
Axel Dörfler 2010-04-13 15:11:39 +00:00
parent 33fbe25496
commit bafcab9265
9 changed files with 110 additions and 82 deletions

View File

@ -43,12 +43,17 @@
#include "SettingsWindow.h"
MainApp* gMainApp;
static const char* kCurrentPlaylistFilename = "MediaPlayer Current Playlist";
const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer";
MainApp* gMainApp;
static const char* kMediaServerSig = B_MEDIA_SERVER_SIGNATURE;
static const char* kMediaServerAddOnSig = "application/x-vnd.Be.addon-host";
MainApp::MainApp()
:
BApplication(kAppSig),
@ -569,9 +574,6 @@ MainApp::_HandleFilePanelResult(BFilePanel* panel, const BMessage* message)
}
static const char* kCurrentPlaylistFilename = "MediaPlayer Current Playlist";
void
MainApp::_StoreCurrentPlaylist(const BMessage* message) const
{
@ -605,6 +607,7 @@ MainApp::_RestoreCurrentPlaylist(BMessage* message) const
return message->Unflatten(&file);
}
void
MainApp::_InstallPlaylistMimeType()
{

View File

@ -3,6 +3,11 @@
* Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
* All Rights Reserved. Distributed under the terms of the MIT license.
*/
//! This class controls our media nodes and general playback
#include "NodeManager.h"
#include <stdio.h>
@ -18,52 +23,59 @@
#include "VideoProducer.h"
#include "VideoSupplier.h"
// debugging
//#define TRACE_NODE_MANAGER
#ifdef TRACE_NODE_MANAGER
# define TRACE(x...) printf(x)
# define ERROR(x...) fprintf(stderr, x)
# define TRACE(x...) printf(x)
# define ERROR(x...) fprintf(stderr, x)
#else
# define TRACE(x...)
# define ERROR(x...) fprintf(stderr, x)
# define TRACE(x...)
# define ERROR(x...) fprintf(stderr, x)
#endif
#define print_error(str, status) printf(str ", error: %s\n", strerror(status))
NodeManager::Connection::Connection()
: connected(false)
:
connected(false)
{
memset(&format, 0, sizeof(media_format));
}
// constructor
// #pragma mark -
NodeManager::NodeManager()
: PlaybackManager(),
fMediaRoster(NULL),
fAudioProducer(NULL),
fVideoConsumer(NULL),
fVideoProducer(NULL),
fTimeSource(media_node::null),
fAudioConnection(),
fVideoConnection(),
fPerformanceTimeBase(0),
fStatus(B_NO_INIT),
fVideoTarget(NULL),
fAudioSupplier(NULL),
fVideoSupplier(NULL),
fVideoBounds(0, 0, -1, -1),
fPeakListener(NULL)
:
PlaybackManager(),
fMediaRoster(NULL),
fAudioProducer(NULL),
fVideoConsumer(NULL),
fVideoProducer(NULL),
fTimeSource(media_node::null),
fAudioConnection(),
fVideoConnection(),
fPerformanceTimeBase(0),
fStatus(B_NO_INIT),
fVideoTarget(NULL),
fAudioSupplier(NULL),
fVideoSupplier(NULL),
fVideoBounds(0, 0, -1, -1),
fPeakListener(NULL)
{
}
// destructor
NodeManager::~NodeManager()
{
_StopNodes();
_TearDownNodes();
}
// Init
status_t
NodeManager::Init(BRect videoBounds, float videoFrameRate,
color_space preferredVideoFormat, float audioFrameRate,
@ -87,14 +99,14 @@ NodeManager::Init(BRect videoBounds, float videoFrameRate,
audioFrameRate, audioChannels, enabledNodes, useOverlays, true);
}
// InitCheck
status_t
NodeManager::InitCheck()
{
return fStatus;
}
// SetPlayMode
void
NodeManager::SetPlayMode(int32 mode, bool continuePlaying)
{
@ -108,7 +120,7 @@ NodeManager::SetPlayMode(int32 mode, bool continuePlaying)
PlaybackManager::SetPlayMode(mode, continuePlaying);
}
// CleanupNodes
status_t
NodeManager::CleanupNodes()
{
@ -116,7 +128,7 @@ NodeManager::CleanupNodes()
return _TearDownNodes(false);
}
// FormatChanged
status_t
NodeManager::FormatChanged(BRect videoBounds, float videoFrameRate,
color_space preferredVideoFormat, float audioFrameRate,
@ -154,7 +166,7 @@ NodeManager::FormatChanged(BRect videoBounds, float videoFrameRate,
return ret;
}
// RealTimeForTime
bigtime_t
NodeManager::RealTimeForTime(bigtime_t time) const
{
@ -170,7 +182,7 @@ NodeManager::RealTimeForTime(bigtime_t time) const
return result;
}
// TimeForRealTime
bigtime_t
NodeManager::TimeForRealTime(bigtime_t time) const
{
@ -185,7 +197,7 @@ NodeManager::TimeForRealTime(bigtime_t time) const
return result;
}
// SetCurrentAudioTime
void
NodeManager::SetCurrentAudioTime(bigtime_t time)
{
@ -197,7 +209,7 @@ NodeManager::SetCurrentAudioTime(bigtime_t time)
}
}
// SetVideoBounds
void
NodeManager::SetVideoBounds(BRect bounds)
{
@ -207,14 +219,14 @@ NodeManager::SetVideoBounds(BRect bounds)
}
}
// VideoBounds
BRect
NodeManager::VideoBounds() const
{
return fVideoBounds;
}
// SetVideoTarget
void
NodeManager::SetVideoTarget(VideoTarget* videoTarget)
{
@ -225,14 +237,14 @@ NodeManager::SetVideoTarget(VideoTarget* videoTarget)
}
}
// GetVideoTarget
VideoTarget*
NodeManager::GetVideoTarget() const
{
return fVideoTarget;
}
// SetVolume
void
NodeManager::SetVolume(float percent)
{
@ -240,7 +252,7 @@ NodeManager::SetVolume(float percent)
// our audio node...
}
// SetPeakListener
void
NodeManager::SetPeakListener(BHandler* handler)
{
@ -249,9 +261,10 @@ NodeManager::SetPeakListener(BHandler* handler)
fAudioProducer->SetPeakListener(fPeakListener);
}
// #pragma mark -
// _SetUpNodes
status_t
NodeManager::_SetUpNodes(color_space preferredVideoFormat, uint32 enabledNodes,
bool useOverlays, float audioFrameRate, uint32 audioChannels)
@ -309,7 +322,6 @@ fNoAudio = true;
}
// _SetUpVideoNodes
status_t
NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
bool useOverlays)
@ -444,7 +456,7 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
return fStatus;
}
// _SetUpAudioNodes
status_t
NodeManager::_SetUpAudioNodes(float audioFrameRate, uint32 audioChannels)
{
@ -517,7 +529,7 @@ NodeManager::_SetUpAudioNodes(float audioFrameRate, uint32 audioChannels)
return fStatus;
}
// _TearDownNodes
status_t
NodeManager::_TearDownNodes(bool disconnect)
{
@ -600,7 +612,7 @@ TRACE("NodeManager::_TearDownNodes() done\n");
return err;
}
// _StartNodes
status_t
NodeManager::_StartNodes()
{
@ -712,7 +724,7 @@ printf("performance time for %lld: %lld\n", real + latency
return status;
}
// _StopNodes
void
NodeManager::_StopNodes()
{
@ -739,4 +751,3 @@ NodeManager::_StopNodes()
}
TRACE("NodeManager::_StopNodes() done\n");
}

View File

@ -3,16 +3,15 @@
* Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
* All Rights Reserved. Distributed under the terms of the MIT license.
*/
//! This class controls our media nodes and general playback
#ifndef NODE_MANAGER_H
#define NODE_MANAGER_H
#include <MediaNode.h>
#include "PlaybackManager.h"
class BMediaRoster;
class AudioProducer;
class VideoTarget;
@ -21,8 +20,9 @@ class VideoConsumer;
class AudioSupplier;
class VideoSupplier;
class NodeManager : public PlaybackManager {
public:
public:
NodeManager();
virtual ~NodeManager();
@ -89,7 +89,7 @@ class NodeManager : public PlaybackManager {
status_t _StartNodes();
void _StopNodes();
private:
private:
struct Connection {
Connection();

View File

@ -1,5 +1,6 @@
// PlaybackManager.cpp
#include <algorithm>
#include <stdio.h>
@ -13,17 +14,20 @@
#include "PlaybackManager.h"
using namespace std;
//#define TRACE_NODE_MANAGER
#ifdef TRACE_NODE_MANAGER
# define TRACE(x...) printf(x)
# define ERROR(x...) fprintf(stderr, x)
# define TRACE(x...) printf(x)
# define ERROR(x...) fprintf(stderr, x)
#else
# define TRACE(x...)
# define ERROR(x...) fprintf(stderr, x)
# define TRACE(x...)
# define ERROR(x...) fprintf(stderr, x)
#endif
void
tdebug(const char* str)
{

View File

@ -3,6 +3,7 @@
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "ImportPLItemsCommand.h"
#include <new>

View File

@ -20,6 +20,7 @@
*
*/
#include "Playlist.h"
#include <debugger.h>

View File

@ -3,6 +3,7 @@
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "PlaylistListView.h"
#include <new>
@ -32,6 +33,7 @@
#include "RandomizePLItemsCommand.h"
#include "RemovePLItemsCommand.h"
using std::nothrow;
@ -75,9 +77,13 @@ private:
};
// #pragma mark -
PlaylistListView::Item::Item(PlaylistItem* item)
: SimpleItem(item->Name().String()),
fItem(item)
:
SimpleItem(item->Name().String()),
fItem(item)
{
fItem->AddListener(this);
}

View File

@ -176,9 +176,8 @@ PlaylistWindow::MessageReceived(BMessage* message)
// player window, _not_ when it is dropped in this window
// outside of the playlist!
int32 appendIndex;
if (message->FindInt32("append_index", &appendIndex) == B_OK) {
if (message->FindInt32("append_index", &appendIndex) == B_OK)
fListView->RefsReceived(message, appendIndex);
}
break;
}

View File

@ -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.
*
* Authors:
* Stephan Aßmus <superstippi@gmx.de>
* Fredrik Modéen <fredrik@modeen.se>
*/
#ifndef PLAYLIST_WINDOW_H
#define PLAYLIST_WINDOW_H
@ -16,6 +15,7 @@
#include "ListenerAdapter.h"
class BMenuBar;
class BMenuItem;
class CommandStack;
@ -27,10 +27,12 @@ class RWLocker;
class BButton;
class BFilePanel;
enum {
M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH = 'rmtr'
};
class PlaylistWindow : public BWindow {
public:
PlaylistWindow(BRect frame,
@ -63,4 +65,5 @@ private:
entry_ref fSavedPlaylistRef;
};
#endif // PLAYLIST_WINDOW_H