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

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

Issue 2491043003: MediaResource refactoring to support multiple streams (Closed)
Patch Set: rebase Created 3 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
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 <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 ConvertToTimeBase(seeking_stream->time_base, seek_time), 1019 ConvertToTimeBase(seeking_stream->time_base, seek_time),
1020 // Always seek to a timestamp <= to the desired timestamp. 1020 // Always seek to a timestamp <= to the desired timestamp.
1021 AVSEEK_FLAG_BACKWARD), 1021 AVSEEK_FLAG_BACKWARD),
1022 base::Bind(&FFmpegDemuxer::OnSeekFrameDone, weak_factory_.GetWeakPtr())); 1022 base::Bind(&FFmpegDemuxer::OnSeekFrameDone, weak_factory_.GetWeakPtr()));
1023 } 1023 }
1024 1024
1025 base::Time FFmpegDemuxer::GetTimelineOffset() const { 1025 base::Time FFmpegDemuxer::GetTimelineOffset() const {
1026 return timeline_offset_; 1026 return timeline_offset_;
1027 } 1027 }
1028 1028
1029 DemuxerStream* FFmpegDemuxer::GetStream(DemuxerStream::Type type) { 1029 std::vector<DemuxerStream*> FFmpegDemuxer::GetStreams() {
1030 DCHECK(task_runner_->BelongsToCurrentThread()); 1030 DCHECK(task_runner_->BelongsToCurrentThread());
1031 return GetFFmpegStream(type); 1031 std::vector<DemuxerStream*> result;
1032 for (const auto& stream : streams_) {
1033 if (stream)
tguilbert 2017/01/24 23:24:40 Can there ever be null streams?
servolk 2017/01/25 00:57:32 Yes. Streams with unsupported audio/video codecs o
1034 result.push_back(stream.get());
1035 }
1036 return result;
1032 } 1037 }
1033 1038
1034 FFmpegDemuxerStream* FFmpegDemuxer::GetFFmpegStream( 1039 FFmpegDemuxerStream* FFmpegDemuxer::GetFFmpegStream(
tguilbert 2017/01/24 23:24:40 Should this be renamed to "GetFirstEnabledStream"?
servolk 2017/01/25 00:57:32 Thanks for drawing my attention to this. I've fixe
tguilbert 2017/01/25 02:36:46 That name seems good to me.
1035 DemuxerStream::Type type) const { 1040 DemuxerStream::Type type) const {
1036 for (const auto& stream : streams_) { 1041 for (const auto& stream : streams_) {
1037 if (stream && stream->type() == type && stream->enabled()) { 1042 if (stream && stream->type() == type && stream->enabled()) {
1038 return stream.get(); 1043 return stream.get();
1039 } 1044 }
1040 } 1045 }
1041 return NULL; 1046 return NULL;
1042 } 1047 }
1043 1048
1044 base::TimeDelta FFmpegDemuxer::GetStartTime() const { 1049 base::TimeDelta FFmpegDemuxer::GetStartTime() const {
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 1813
1809 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { 1814 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
1810 DCHECK(task_runner_->BelongsToCurrentThread()); 1815 DCHECK(task_runner_->BelongsToCurrentThread());
1811 for (const auto& stream : streams_) { 1816 for (const auto& stream : streams_) {
1812 if (stream) 1817 if (stream)
1813 stream->SetLiveness(liveness); 1818 stream->SetLiveness(liveness);
1814 } 1819 }
1815 } 1820 }
1816 1821
1817 } // namespace media 1822 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698