* 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" #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),
@ -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()
{ {

View File

@ -3,6 +3,11 @@
* 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,6 +23,7 @@
#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
@ -30,15 +36,21 @@
#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(), :
PlaybackManager(),
fMediaRoster(NULL), fMediaRoster(NULL),
fAudioProducer(NULL), fAudioProducer(NULL),
fVideoConsumer(NULL), fVideoConsumer(NULL),
@ -56,14 +68,14 @@ NodeManager::NodeManager()
{ {
} }
// 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)
@ -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)
@ -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()
{ {
@ -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");
} }

View File

@ -3,16 +3,15 @@
* 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();
@ -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();

View File

@ -1,5 +1,6 @@
// PlaybackManager.cpp // PlaybackManager.cpp
#include <algorithm> #include <algorithm>
#include <stdio.h> #include <stdio.h>
@ -13,8 +14,10 @@
#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)
@ -24,6 +27,7 @@ using namespace std;
# define ERROR(x...) fprintf(stderr, x) # define ERROR(x...) fprintf(stderr, x)
#endif #endif
void void
tdebug(const char* str) tdebug(const char* str)
{ {

View File

@ -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>

View File

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

View File

@ -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,8 +77,12 @@ private:
}; };
// #pragma mark -
PlaylistListView::Item::Item(PlaylistItem* item) PlaylistListView::Item::Item(PlaylistItem* item)
: SimpleItem(item->Name().String()), :
SimpleItem(item->Name().String()),
fItem(item) fItem(item)
{ {
fItem->AddListener(this); fItem->AddListener(this);

View File

@ -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;
} }

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. * 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