| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "media/base/audio_decoder_config.h" |
| 9 #include "media/base/video_decoder_config.h" |
| 8 | 10 |
| 9 namespace media { | 11 namespace media { |
| 10 | 12 |
| 11 static const AVRational kMicrosBase = { 1, base::Time::kMicrosecondsPerSecond }; | 13 static const AVRational kMicrosBase = { 1, base::Time::kMicrosecondsPerSecond }; |
| 12 | 14 |
| 13 base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, | 15 base::TimeDelta ConvertFromTimeBase(const AVRational& time_base, |
| 14 int64 timestamp) { | 16 int64 timestamp) { |
| 15 int64 microseconds = av_rescale_q(timestamp, time_base, kMicrosBase); | 17 int64 microseconds = av_rescale_q(timestamp, time_base, kMicrosBase); |
| 16 return base::TimeDelta::FromMicroseconds(microseconds); | 18 return base::TimeDelta::FromMicroseconds(microseconds); |
| 17 } | 19 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 avcodec_close(stream->codec); | 334 avcodec_close(stream->codec); |
| 333 } | 335 } |
| 334 } | 336 } |
| 335 } | 337 } |
| 336 | 338 |
| 337 // Then finally cleanup the format context. | 339 // Then finally cleanup the format context. |
| 338 av_close_input_file(format_context); | 340 av_close_input_file(format_context); |
| 339 } | 341 } |
| 340 | 342 |
| 341 } // namespace media | 343 } // namespace media |
| OLD | NEW |