| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |