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

Side by Side Diff: media/ffmpeg/ffmpeg_common.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/ffmpeg/ffmpeg_common_unittest.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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h"
11 #include "media/base/decoder_buffer.h" 12 #include "media/base/decoder_buffer.h"
12 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
13 #include "media/base/video_util.h" 14 #include "media/base/video_util.h"
14 15
15 namespace media { 16 namespace media {
16 17
17 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are 18 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
18 // padded. Check here to ensure FFmpeg only receives data padded to its 19 // padded. Check here to ensure FFmpeg only receives data padded to its
19 // specifications. 20 // specifications.
20 COMPILE_ASSERT(DecoderBuffer::kPaddingSize >= FF_INPUT_BUFFER_PADDING_SIZE, 21 COMPILE_ASSERT(DecoderBuffer::kPaddingSize >= FF_INPUT_BUFFER_PADDING_SIZE,
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 case VideoFrame::YV12J: 544 case VideoFrame::YV12J:
544 return PIX_FMT_YUVJ420P; 545 return PIX_FMT_YUVJ420P;
545 case VideoFrame::YV12A: 546 case VideoFrame::YV12A:
546 return PIX_FMT_YUVA420P; 547 return PIX_FMT_YUVA420P;
547 default: 548 default:
548 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 549 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
549 } 550 }
550 return PIX_FMT_NONE; 551 return PIX_FMT_NONE;
551 } 552 }
552 553
554 bool FFmpegUTCDateToTime(const char* date_utc,
555 base::Time* out) {
556 DCHECK(date_utc);
557 DCHECK(out);
558
559 std::vector<std::string> fields;
560 std::vector<std::string> date_fields;
561 std::vector<std::string> time_fields;
562 base::Time::Exploded exploded;
563 exploded.millisecond = 0;
564
565 // TODO(acolwell): Update this parsing code when FFmpeg returns sub-second
566 // information.
567 if ((Tokenize(date_utc, " ", &fields) == 2) &&
568 (Tokenize(fields[0], "-", &date_fields) == 3) &&
569 (Tokenize(fields[1], ":", &time_fields) == 3) &&
570 base::StringToInt(date_fields[0], &exploded.year) &&
571 base::StringToInt(date_fields[1], &exploded.month) &&
572 base::StringToInt(date_fields[2], &exploded.day_of_month) &&
573 base::StringToInt(time_fields[0], &exploded.hour) &&
574 base::StringToInt(time_fields[1], &exploded.minute) &&
575 base::StringToInt(time_fields[2], &exploded.second)) {
576 base::Time parsed_time = base::Time::FromUTCExploded(exploded);
577 if (parsed_time.is_null())
578 return false;
579
580 *out = parsed_time;
581 return true;
582 }
583
584 return false;
585 }
586
553 } // namespace media 587 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/ffmpeg/ffmpeg_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698