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

Unified Diff: media/formats/webm/webm_info_parser.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/formats/webm/webm_info_parser.h ('k') | media/formats/webm/webm_stream_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/webm/webm_info_parser.cc
diff --git a/media/formats/webm/webm_info_parser.cc b/media/formats/webm/webm_info_parser.cc
index ac4f08c40469f14f20136e4f42fe583268d95495..6309c21e9db2e00614d93bec5957b9100666b0b5 100644
--- a/media/formats/webm/webm_info_parser.cc
+++ b/media/formats/webm/webm_info_parser.cc
@@ -74,6 +74,25 @@ bool WebMInfoParser::OnFloat(int id, double val) {
}
bool WebMInfoParser::OnBinary(int id, const uint8* data, int size) {
+ if (id == kWebMIdDateUTC) {
+ if (size != 8)
+ return false;
+
+ int64 date_in_nanoseconds = 0;
+ for (int i = 0; i < size; ++i)
+ date_in_nanoseconds = (date_in_nanoseconds << 8) | data[i];
+
+ base::Time::Exploded exploded_epoch;
+ exploded_epoch.year = 2001;
+ exploded_epoch.month = 1;
+ exploded_epoch.day_of_month = 1;
+ exploded_epoch.hour = 0;
+ exploded_epoch.minute = 0;
+ exploded_epoch.second = 0;
+ exploded_epoch.millisecond = 0;
+ date_utc_ = base::Time::FromUTCExploded(exploded_epoch) +
+ base::TimeDelta::FromMicroseconds(date_in_nanoseconds / 1000);
+ }
return true;
}
« no previous file with comments | « media/formats/webm/webm_info_parser.h ('k') | media/formats/webm/webm_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698