summaryrefslogtreecommitdiffstats
path: root/media/ffmpeg
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-01 00:49:07 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-01 00:49:07 +0000
commit3360355599b28cc4874db9b51ce5a2146d779aa6 (patch)
tree86b40540df09e85972036773b6dbedd61e5c25f7 /media/ffmpeg
parentf28dd7b26f0ec615bb56ab393429466757f4c93f (diff)
downloadchromium_src-3360355599b28cc4874db9b51ce5a2146d779aa6.zip
chromium_src-3360355599b28cc4874db9b51ce5a2146d779aa6.tar.gz
chromium_src-3360355599b28cc4874db9b51ce5a2146d779aa6.tar.bz2
Clean up VideoDecoderConfig and replace VideoCodecInfo with a bool.
Similar to AudioDecoderConfig that was introduced in r102183, add Initialize() and IsValidConfig() to VideoDecoderConfig and update documentation. This helps pave the way to remove DemuxerStream::GetAVStream(). Since natural_size isn't used by neither VideoDecoderConfig nor VideoDecodeEngines, remove it from both and replace VideoCodecInfo with a bool. Review URL: http://codereview.chromium.org/8084021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/ffmpeg')
-rw-r--r--media/ffmpeg/ffmpeg_common.cc13
-rw-r--r--media/ffmpeg/ffmpeg_common.h4
2 files changed, 6 insertions, 11 deletions
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 76cc36d..f1835ce 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -220,25 +220,20 @@ base::TimeDelta GetFrameDuration(AVStream* stream) {
return ConvertFromTimeBase(time_base, 1);
}
-int GetNaturalHeight(AVStream* stream) {
- return stream->codec->height;
-}
-
-int GetNaturalWidth(AVStream* stream) {
- double aspect_ratio;
+gfx::Size GetNaturalSize(AVStream* stream) {
+ double aspect_ratio = 1.0;
if (stream->sample_aspect_ratio.num)
aspect_ratio = av_q2d(stream->sample_aspect_ratio);
else if (stream->codec->sample_aspect_ratio.num)
aspect_ratio = av_q2d(stream->codec->sample_aspect_ratio);
- else
- aspect_ratio = 1.0;
+ int height = stream->codec->height;
int width = floor(stream->codec->width * aspect_ratio + 0.5);
// An even width makes things easier for YV12 and appears to be the behavior
// expected by WebKit layout tests.
- return width & ~1;
+ return gfx::Size(width & ~1, height);
}
void DestroyAVFormatContext(AVFormatContext* format_context) {
diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
index 9248e18..cc15e58 100644
--- a/media/ffmpeg/ffmpeg_common.h
+++ b/media/ffmpeg/ffmpeg_common.h
@@ -15,6 +15,7 @@
#include "media/base/channel_layout.h"
#include "media/base/media_export.h"
#include "media/video/video_decode_engine.h"
+#include "ui/gfx/size.h"
// Include FFmpeg header files.
extern "C" {
@@ -87,8 +88,7 @@ base::TimeDelta GetFrameDuration(AVStream* stream);
// Calculates the natural width and height of the video using the video's
// encoded dimensions and sample_aspect_ratio.
-int GetNaturalHeight(AVStream* stream);
-int GetNaturalWidth(AVStream* stream);
+gfx::Size GetNaturalSize(AVStream* stream);
// Closes & destroys all AVStreams in the context and then closes &
// destroys the AVFormatContext.