Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Unified Diff: media/tools/player_x11/player_x11.cc

Issue 8818012: Remove the AudioManager singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Set svn eol properties for a couple of files Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/tools/player_wtl/movie.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/tools/player_x11/player_x11.cc
===================================================================
--- media/tools/player_x11/player_x11.cc (revision 114012)
+++ media/tools/player_x11/player_x11.cc (working copy)
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <iostream>
-#include <signal.h>
#include <X11/keysym.h>
#include <X11/Xlib.h>
+#include <signal.h>
+#include <iostream> // NOLINT
+
#include "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -14,6 +15,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
+#include "media/audio/audio_manager.h"
#include "media/base/filter_collection.h"
#include "media/base/media.h"
#include "media/base/media_log.h"
@@ -33,6 +35,8 @@
static Window g_window = 0;
static bool g_running = false;
+AudioManager* g_audio_manager = NULL;
+
class MessageLoopQuitter {
public:
explicit MessageLoopQuitter(MessageLoop* loop) : loop_(loop) {}
@@ -102,10 +106,12 @@
new X11VideoRenderer(g_display, g_window, paint_message_loop));
}
- if (enable_audio)
- collection->AddAudioRenderer(new media::ReferenceAudioRenderer());
- else
+ if (enable_audio) {
+ collection->AddAudioRenderer(
+ new media::ReferenceAudioRenderer(g_audio_manager));
+ } else {
collection->AddAudioRenderer(new media::NullAudioRenderer());
+ }
// Create the pipeline and start it.
*pipeline = new media::PipelineImpl(message_loop, new media::MediaLog());
@@ -176,7 +182,7 @@
base::Unretained(quitter)));
return;
} else if (key == XK_space) {
- if (pipeline->GetPlaybackRate() < 0.01f) // paused
+ if (pipeline->GetPlaybackRate() < 0.01f) // paused
pipeline->SetPlaybackRate(1.0f);
else
pipeline->SetPlaybackRate(0.0f);
@@ -194,6 +200,9 @@
}
int main(int argc, char** argv) {
+ scoped_refptr<AudioManager> audio_manager(AudioManager::Create());
+ g_audio_manager = audio_manager;
+
// Read arguments.
if (argc == 1) {
std::cout << "Usage: " << argv[0] << " --file=FILE" << std::endl
@@ -252,7 +261,7 @@
message_loop.PostTask(FROM_HERE, base::Bind(
&PeriodicalUpdate, pipeline, &message_loop, audio_only));
message_loop.Run();
- } else{
+ } else {
std::cout << "Pipeline initialization failed..." << std::endl;
}
@@ -262,5 +271,7 @@
thread->Stop();
XDestroyWindow(g_display, g_window);
XCloseDisplay(g_display);
+ g_audio_manager = NULL;
+
return 0;
}
« no previous file with comments | « media/tools/player_wtl/movie.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698