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

Side by Side Diff: media/tools/player_x11/player_x11.cc

Issue 9015015: Take advantage of the new Pass() machinery on scoped_ptr{,_malloc}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the dependency on CL 8968032 and point TODOs at the newly-filed bug. Created 8 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <X11/keysym.h> 5 #include <X11/keysym.h>
6 #include <X11/Xlib.h> 6 #include <X11/Xlib.h>
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <iostream> // NOLINT 9 #include <iostream> // NOLINT
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Load media libraries. 106 // Load media libraries.
107 if (!media::InitializeMediaLibrary(FilePath())) { 107 if (!media::InitializeMediaLibrary(FilePath())) {
108 std::cout << "Unable to initialize the media library." << std::endl; 108 std::cout << "Unable to initialize the media library." << std::endl;
109 return false; 109 return false;
110 } 110 }
111 111
112 // Create our filter factories. 112 // Create our filter factories.
113 scoped_ptr<media::FilterCollection> collection( 113 scoped_ptr<media::FilterCollection> collection(
114 new media::FilterCollection()); 114 new media::FilterCollection());
115 collection->SetDemuxerFactory( 115 collection->SetDemuxerFactory(
116 new media::FFmpegDemuxerFactory( 116 scoped_ptr<media::DemuxerFactory>(
117 new media::FileDataSourceFactory(), message_loop)); 117 new media::FFmpegDemuxerFactory(scoped_ptr<media::DataSourceFactory>(
118 new media::FileDataSourceFactory()), message_loop)));
118 collection->AddAudioDecoder(new media::FFmpegAudioDecoder( 119 collection->AddAudioDecoder(new media::FFmpegAudioDecoder(
119 message_loop_factory->GetMessageLoop("AudioDecoderThread"))); 120 message_loop_factory->GetMessageLoop("AudioDecoderThread")));
120 collection->AddVideoDecoder(new media::FFmpegVideoDecoder( 121 collection->AddVideoDecoder(new media::FFmpegVideoDecoder(
121 message_loop_factory->GetMessageLoop("VideoDecoderThread"))); 122 message_loop_factory->GetMessageLoop("VideoDecoderThread")));
122 123
123 // Create our video renderer and save a reference to it for painting. 124 // Create our video renderer and save a reference to it for painting.
124 g_video_renderer = new media::VideoRendererBase( 125 g_video_renderer = new media::VideoRendererBase(
125 base::Bind(&Paint, paint_message_loop, paint_cb), 126 base::Bind(&Paint, paint_message_loop, paint_cb),
126 base::Bind(&SetOpaque)); 127 base::Bind(&SetOpaque));
127 collection->AddVideoRenderer(g_video_renderer); 128 collection->AddVideoRenderer(g_video_renderer);
128 129
129 if (enable_audio) { 130 if (enable_audio) {
130 collection->AddAudioRenderer( 131 collection->AddAudioRenderer(
131 new media::ReferenceAudioRenderer(g_audio_manager)); 132 new media::ReferenceAudioRenderer(g_audio_manager));
132 } else { 133 } else {
133 collection->AddAudioRenderer(new media::NullAudioRenderer()); 134 collection->AddAudioRenderer(new media::NullAudioRenderer());
134 } 135 }
135 136
136 // Create the pipeline and start it. 137 // Create the pipeline and start it.
137 *pipeline = new media::PipelineImpl(message_loop, new media::MediaLog()); 138 *pipeline = new media::PipelineImpl(message_loop, new media::MediaLog());
138 media::PipelineStatusNotification note; 139 media::PipelineStatusNotification note;
139 (*pipeline)->Start(collection.release(), filename, note.Callback()); 140 (*pipeline)->Start(collection.Pass(), filename, note.Callback());
140 141
141 // Wait until the pipeline is fully initialized. 142 // Wait until the pipeline is fully initialized.
142 note.Wait(); 143 note.Wait();
143 if (note.status() != media::PIPELINE_OK) { 144 if (note.status() != media::PIPELINE_OK) {
144 std::cout << "InitPipeline: " << note.status() << std::endl; 145 std::cout << "InitPipeline: " << note.status() << std::endl;
145 (*pipeline)->Stop(media::PipelineStatusCB()); 146 (*pipeline)->Stop(media::PipelineStatusCB());
146 return false; 147 return false;
147 } 148 }
148 149
149 // And start the playback. 150 // And start the playback.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // Cleanup tasks. 303 // Cleanup tasks.
303 message_loop_factory.reset(); 304 message_loop_factory.reset();
304 305
305 thread->Stop(); 306 thread->Stop();
306 XDestroyWindow(g_display, g_window); 307 XDestroyWindow(g_display, g_window);
307 XCloseDisplay(g_display); 308 XCloseDisplay(g_display);
308 g_audio_manager = NULL; 309 g_audio_manager = NULL;
309 310
310 return 0; 311 return 0;
311 } 312 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698