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

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 2090323002: Make callers of FromUTC(Local)Exploded in media/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 5 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
« no previous file with comments | « no previous file | media/formats/webm/webm_info_parser.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/ffmpeg/ffmpeg_common.h" 5 #include "media/ffmpeg/ffmpeg_common.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 return false; 740 return false;
741 741
742 base::Time::Exploded exploded; 742 base::Time::Exploded exploded;
743 exploded.millisecond = 0; 743 exploded.millisecond = 0;
744 if (base::StringToInt(date_fields[0], &exploded.year) && 744 if (base::StringToInt(date_fields[0], &exploded.year) &&
745 base::StringToInt(date_fields[1], &exploded.month) && 745 base::StringToInt(date_fields[1], &exploded.month) &&
746 base::StringToInt(date_fields[2], &exploded.day_of_month) && 746 base::StringToInt(date_fields[2], &exploded.day_of_month) &&
747 base::StringToInt(time_fields[0], &exploded.hour) && 747 base::StringToInt(time_fields[0], &exploded.hour) &&
748 base::StringToInt(time_fields[1], &exploded.minute) && 748 base::StringToInt(time_fields[1], &exploded.minute) &&
749 base::StringToInt(time_fields[2], &exploded.second)) { 749 base::StringToInt(time_fields[2], &exploded.second)) {
750 base::Time parsed_time = base::Time::FromUTCExploded(exploded); 750 if (base::Time::FromUTCExploded(exploded, out))
751 if (parsed_time.is_null()) 751 return true;
752 return false;
753
754 *out = parsed_time;
755 return true;
756 } 752 }
757 753
758 return false; 754 return false;
759 } 755 }
760 756
761 int32_t HashCodecName(const char* codec_name) { 757 int32_t HashCodecName(const char* codec_name) {
762 // Use the first 32-bits from the SHA1 hash as the identifier. 758 // Use the first 32-bits from the SHA1 hash as the identifier.
763 int32_t hash; 759 int32_t hash;
764 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); 760 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4);
765 return hash; 761 return hash;
766 } 762 }
767 763
768 } // namespace media 764 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/formats/webm/webm_info_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698