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

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 5581008: Add a new GetInstance() method for singleton classes, take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 385
386 void FFmpegDemuxer::InitializeTask(DataSource* data_source, 386 void FFmpegDemuxer::InitializeTask(DataSource* data_source,
387 FilterCallback* callback) { 387 FilterCallback* callback) {
388 DCHECK_EQ(MessageLoop::current(), message_loop()); 388 DCHECK_EQ(MessageLoop::current(), message_loop());
389 scoped_ptr<FilterCallback> c(callback); 389 scoped_ptr<FilterCallback> c(callback);
390 390
391 data_source_ = data_source; 391 data_source_ = data_source;
392 392
393 // Add ourself to Protocol list and get our unique key. 393 // Add ourself to Protocol list and get our unique key.
394 std::string key = FFmpegGlue::get()->AddProtocol(this); 394 std::string key = FFmpegGlue::GetInstance()->AddProtocol(this);
395 395
396 // Open FFmpeg AVFormatContext. 396 // Open FFmpeg AVFormatContext.
397 DCHECK(!format_context_); 397 DCHECK(!format_context_);
398 AVFormatContext* context = NULL; 398 AVFormatContext* context = NULL;
399 int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL); 399 int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL);
400 400
401 // Remove ourself from protocol list. 401 // Remove ourself from protocol list.
402 FFmpegGlue::get()->RemoveProtocol(this); 402 FFmpegGlue::GetInstance()->RemoveProtocol(this);
403 403
404 if (result < 0) { 404 if (result < 0) {
405 host()->SetError(DEMUXER_ERROR_COULD_NOT_OPEN); 405 host()->SetError(DEMUXER_ERROR_COULD_NOT_OPEN);
406 callback->Run(); 406 callback->Run();
407 return; 407 return;
408 } 408 }
409 409
410 DCHECK(context); 410 DCHECK(context);
411 format_context_ = context; 411 format_context_ = context;
412 412
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 read_event_.Wait(); 606 read_event_.Wait();
607 return last_read_bytes_; 607 return last_read_bytes_;
608 } 608 }
609 609
610 void FFmpegDemuxer::SignalReadCompleted(size_t size) { 610 void FFmpegDemuxer::SignalReadCompleted(size_t size) {
611 last_read_bytes_ = size; 611 last_read_bytes_ = size;
612 read_event_.Signal(); 612 read_event_.Signal();
613 } 613 }
614 614
615 } // namespace media 615 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698