summaryrefslogtreecommitdiffstats
path: root/media/ffmpeg/ffmpeg_util.cc
blob: aa9f7a273698d0a63aa1824096fc2e5d860878eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/ffmpeg/ffmpeg_util.h"

#include "media/ffmpeg/ffmpeg_common.h"

namespace media {

static const AVRational kMicrosBase = { 1, base::Time::kMicrosecondsPerSecond };

base::TimeDelta ConvertTimestamp(const AVRational& time_base, int64 timestamp) {
  int64 microseconds = av_rescale_q(timestamp, time_base, kMicrosBase);
  return base::TimeDelta::FromMicroseconds(microseconds);
}

}  // namespace media