summaryrefslogtreecommitdiffstats
path: root/media/ffmpeg
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 00:05:39 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 00:05:39 +0000
commite7a557c64a933835da445cda865a8f81bd92b8b0 (patch)
treee5fdf02f91d06f17aa34e32c6a94c82703e4c374 /media/ffmpeg
parente3149dbeafdcb286e24aa676b125eb9b0134ab11 (diff)
downloadchromium_src-e7a557c64a933835da445cda865a8f81bd92b8b0.zip
chromium_src-e7a557c64a933835da445cda865a8f81bd92b8b0.tar.gz
chromium_src-e7a557c64a933835da445cda865a8f81bd92b8b0.tar.bz2
Refactor FFmpegVideoDecoder to try and generalize code common to all video decoders.
This changes the DecoderBase API to be fully asynchronous when invoking its subclass's actions. Review URL: http://codereview.chromium.org/465044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/ffmpeg')
-rw-r--r--media/ffmpeg/ffmpeg_util.cc18
-rw-r--r--media/ffmpeg/ffmpeg_util.h18
2 files changed, 36 insertions, 0 deletions
diff --git a/media/ffmpeg/ffmpeg_util.cc b/media/ffmpeg/ffmpeg_util.cc
new file mode 100644
index 0000000..1be3b12
--- /dev/null
+++ b/media/ffmpeg/ffmpeg_util.cc
@@ -0,0 +1,18 @@
+// Copyright (c) 2009 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/filters/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
diff --git a/media/ffmpeg/ffmpeg_util.h b/media/ffmpeg/ffmpeg_util.h
new file mode 100644
index 0000000..6799cc4
--- /dev/null
+++ b/media/ffmpeg/ffmpeg_util.h
@@ -0,0 +1,18 @@
+// Copyright (c) 2009 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.
+
+#ifndef MEDIA_FFMPEG_FFMPEG_UTIL_H_
+#define MEDIA_FFMPEG_FFMPEG_UTIL_H_
+
+#include "base/time.h"
+
+struct AVRational;
+
+namespace media {
+
+base::TimeDelta ConvertTimestamp(const AVRational& time_base, int64 timestamp);
+
+} // namespace media
+
+#endif // MEDIA_FFMPEG_FFMPEG_UTIL_H_