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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 236023003: Add WebMediaPlayer::timelineOffset() support to WebMediaPlayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR comments Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index de1968afc43d200f86f0eeb3791621ce72d54d72..d54db072725801e754db463d2a00b5f299d2cf94 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -34,6 +34,22 @@
namespace media {
+static base::Time ExtractTimelineOffset(AVFormatContext* format_context) {
+ if (strstr(format_context->iformat->name, "webm") ||
+ strstr(format_context->iformat->name, "matroska")) {
+ const AVDictionaryEntry* entry =
+ av_dict_get(format_context->metadata, "creation_time", NULL, 0);
+
+ base::Time timeline_offset;
+ if (entry != NULL && entry->value != NULL &&
+ FFmpegUTCDateToTime(entry->value, &timeline_offset)) {
+ return timeline_offset;
+ }
+ }
+
+ return base::Time();
+}
+
//
// FFmpegDemuxerStream
//
@@ -486,6 +502,10 @@ base::TimeDelta FFmpegDemuxer::GetStartTime() const {
return start_time_;
}
+base::Time FFmpegDemuxer::GetTimelineOffset() const {
+ return timeline_offset_;
+}
+
void FFmpegDemuxer::AddTextStreams() {
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -674,6 +694,8 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
if (strcmp(format_context->iformat->name, "avi") == 0)
format_context->flags |= AVFMT_FLAG_GENPTS;
+ timeline_offset_ = ExtractTimelineOffset(format_context);
+
// Good to go: set the duration and bitrate and notify we're done
// initializing.
host_->SetDuration(max_duration);
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698