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

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

Issue 23072043: Change NeedKeyCB to use std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix seek_tester, demuxer_bench, and player_x11 Created 7 years, 4 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
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/ffmpeg_demuxer.h" 5 #include "media/filters/ffmpeg_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 return ConvertFromTimeBase(time_base, timestamp); 281 return ConvertFromTimeBase(time_base, timestamp);
282 } 282 }
283 283
284 // 284 //
285 // FFmpegDemuxer 285 // FFmpegDemuxer
286 // 286 //
287 FFmpegDemuxer::FFmpegDemuxer( 287 FFmpegDemuxer::FFmpegDemuxer(
288 const scoped_refptr<base::MessageLoopProxy>& message_loop, 288 const scoped_refptr<base::MessageLoopProxy>& message_loop,
289 DataSource* data_source, 289 DataSource* data_source,
290 const FFmpegNeedKeyCB& need_key_cb, 290 const NeedKeyCB& need_key_cb,
291 const scoped_refptr<MediaLog>& media_log) 291 const scoped_refptr<MediaLog>& media_log)
292 : host_(NULL), 292 : host_(NULL),
293 message_loop_(message_loop), 293 message_loop_(message_loop),
294 weak_factory_(this), 294 weak_factory_(this),
295 blocking_thread_("FFmpegDemuxer"), 295 blocking_thread_("FFmpegDemuxer"),
296 pending_read_(false), 296 pending_read_(false),
297 pending_seek_(false), 297 pending_seek_(false),
298 data_source_(data_source), 298 data_source_(data_source),
299 media_log_(media_log), 299 media_log_(media_log),
300 bitrate_(0), 300 bitrate_(0),
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 if (!*iter || 805 if (!*iter ||
806 (audio_disabled_ && (*iter)->type() == DemuxerStream::AUDIO)) { 806 (audio_disabled_ && (*iter)->type() == DemuxerStream::AUDIO)) {
807 continue; 807 continue;
808 } 808 }
809 (*iter)->SetEndOfStream(); 809 (*iter)->SetEndOfStream();
810 } 810 }
811 } 811 }
812 812
813 void FFmpegDemuxer::FireNeedKey(const std::string& init_data_type, 813 void FFmpegDemuxer::FireNeedKey(const std::string& init_data_type,
814 const std::string& encryption_key_id) { 814 const std::string& encryption_key_id) {
815 int key_id_size = encryption_key_id.size(); 815 std::vector<uint8> key_id_local(encryption_key_id.begin(),
816 scoped_ptr<uint8[]> key_id_local(new uint8[key_id_size]); 816 encryption_key_id.end());
817 memcpy(key_id_local.get(), encryption_key_id.data(), key_id_size); 817 need_key_cb_.Run(init_data_type, key_id_local);
818 need_key_cb_.Run(init_data_type, key_id_local.Pass(), key_id_size);
819 } 818 }
820 819
821 void FFmpegDemuxer::NotifyCapacityAvailable() { 820 void FFmpegDemuxer::NotifyCapacityAvailable() {
822 DCHECK(message_loop_->BelongsToCurrentThread()); 821 DCHECK(message_loop_->BelongsToCurrentThread());
823 ReadFrameIfNeeded(); 822 ReadFrameIfNeeded();
824 } 823 }
825 824
826 void FFmpegDemuxer::NotifyBufferingChanged() { 825 void FFmpegDemuxer::NotifyBufferingChanged() {
827 DCHECK(message_loop_->BelongsToCurrentThread()); 826 DCHECK(message_loop_->BelongsToCurrentThread());
828 Ranges<base::TimeDelta> buffered; 827 Ranges<base::TimeDelta> buffered;
(...skipping 10 matching lines...) Expand all
839 } 838 }
840 for (size_t i = 0; i < buffered.size(); ++i) 839 for (size_t i = 0; i < buffered.size(); ++i)
841 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); 840 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i));
842 } 841 }
843 842
844 void FFmpegDemuxer::OnDataSourceError() { 843 void FFmpegDemuxer::OnDataSourceError() {
845 host_->OnDemuxerError(PIPELINE_ERROR_READ); 844 host_->OnDemuxerError(PIPELINE_ERROR_READ);
846 } 845 }
847 846
848 } // namespace media 847 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698