| Index: media/ffmpeg/ffmpeg_common.cc
|
| diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
|
| index 344e2656b9d4c4b004947aaf25df2e3ca01fb7e4..abc2a1a87d247a2f0968edac11ed6d63dca093d4 100644
|
| --- a/media/ffmpeg/ffmpeg_common.cc
|
| +++ b/media/ffmpeg/ffmpeg_common.cc
|
| @@ -8,6 +8,7 @@
|
| #include "base/logging.h"
|
| #include "base/metrics/histogram.h"
|
| #include "base/strings/string_number_conversions.h"
|
| +#include "base/strings/string_util.h"
|
| #include "media/base/decoder_buffer.h"
|
| #include "media/base/video_frame.h"
|
| #include "media/base/video_util.h"
|
| @@ -550,4 +551,37 @@ PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format) {
|
| return PIX_FMT_NONE;
|
| }
|
|
|
| +bool FFmpegUTCDateToTime(const char* date_utc,
|
| + base::Time* out) {
|
| + DCHECK(date_utc);
|
| + DCHECK(out);
|
| +
|
| + std::vector<std::string> fields;
|
| + std::vector<std::string> date_fields;
|
| + std::vector<std::string> time_fields;
|
| + base::Time::Exploded exploded;
|
| + exploded.millisecond = 0;
|
| +
|
| + // TODO(acolwell): Update this parsing code when FFmpeg returns sub-second
|
| + // information.
|
| + if ((Tokenize(date_utc, " ", &fields) == 2) &&
|
| + (Tokenize(fields[0], "-", &date_fields) == 3) &&
|
| + (Tokenize(fields[1], ":", &time_fields) == 3) &&
|
| + base::StringToInt(date_fields[0], &exploded.year) &&
|
| + base::StringToInt(date_fields[1], &exploded.month) &&
|
| + base::StringToInt(date_fields[2], &exploded.day_of_month) &&
|
| + base::StringToInt(time_fields[0], &exploded.hour) &&
|
| + base::StringToInt(time_fields[1], &exploded.minute) &&
|
| + base::StringToInt(time_fields[2], &exploded.second)) {
|
| + base::Time parsed_time = base::Time::FromUTCExploded(exploded);
|
| + if (parsed_time.is_null())
|
| + return false;
|
| +
|
| + *out = parsed_time;
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| } // namespace media
|
|
|