summaryrefslogtreecommitdiffstats
path: root/media/base/video_frame.h
diff options
context:
space:
mode:
authoracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 22:42:52 +0000
committeracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 22:42:52 +0000
commite4ee4911dfbfe88088e68275bb6799b1078319a3 (patch)
treeb09d499ef3cc1a2a283f2218958d1e87778e9c2f /media/base/video_frame.h
parent79f59939f69556273b5f65fa012402d2c6431e7e (diff)
downloadchromium_src-e4ee4911dfbfe88088e68275bb6799b1078319a3.zip
chromium_src-e4ee4911dfbfe88088e68275bb6799b1078319a3.tar.gz
chromium_src-e4ee4911dfbfe88088e68275bb6799b1078319a3.tar.bz2
Remove VideoDecoder::natural_size() & added VideoFrame::natural_size().
BUG=122913 Review URL: https://chromiumcodereview.appspot.com/10824141 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/video_frame.h')
-rw-r--r--media/base/video_frame.h41
1 files changed, 24 insertions, 17 deletions
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 26a9dea..c40cb23 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "base/md5.h"
#include "media/base/buffers.h"
+#include "ui/gfx/size.h"
namespace media {
@@ -39,27 +40,31 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Creates a new frame in system memory with given parameters. Buffers for
// the frame are allocated but not initialized.
+ // |data_size| is the width and height of the frame data in pixels.
+ // |natural_size| is the width and height of the frame when the frame's aspect
+ // ratio is applied to |data_size|.
static scoped_refptr<VideoFrame> CreateFrame(
Format format,
- size_t width,
- size_t height,
+ const gfx::Size& data_size,
+ const gfx::Size& natural_size,
base::TimeDelta timestamp);
// Call prior to CreateFrame to ensure validity of frame configuration. Called
// automatically by VideoDecoderConfig::IsValidConfig().
// TODO(scherkus): VideoDecoderConfig shouldn't call this method
- static bool IsValidConfig(
- Format format,
- size_t width,
- size_t height);
+ static bool IsValidConfig(Format format, const gfx::Size& data_size,
+ const gfx::Size& natural_size);
// Wraps a native texture of the given parameters with a VideoFrame. When the
// frame is destroyed |no_longer_needed.Run()| will be called.
+ // |data_size| is the width and height of the frame data in pixels.
+ // |natural_size| is the width and height of the frame when the frame's aspect
+ // ratio is applied to |size|.
static scoped_refptr<VideoFrame> WrapNativeTexture(
uint32 texture_id,
uint32 texture_target,
- size_t width,
- size_t height,
+ const gfx::Size& data_size,
+ const gfx::Size& natural_size,
base::TimeDelta timestamp,
const base::Closure& no_longer_needed);
@@ -69,13 +74,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Allocates YV12 frame based on |width| and |height|, and sets its data to
// the YUV equivalent of RGB(0,0,0).
- static scoped_refptr<VideoFrame> CreateBlackFrame(int width, int height);
+ static scoped_refptr<VideoFrame> CreateBlackFrame(const gfx::Size& size);
Format format() const { return format_; }
- size_t width() const { return width_; }
-
- size_t height() const { return height_; }
+ const gfx::Size& data_size() const { return data_size_; }
+ const gfx::Size& natural_size() const { return natural_size_; }
int stride(size_t plane) const;
@@ -115,8 +119,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
friend class base::RefCountedThreadSafe<VideoFrame>;
// Clients must use the static CreateFrame() method to create a new frame.
VideoFrame(Format format,
- size_t video_width,
- size_t video_height,
+ const gfx::Size& size,
+ const gfx::Size& natural_size,
base::TimeDelta timestamp);
virtual ~VideoFrame();
@@ -130,9 +134,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Frame format.
Format format_;
- // Width and height of surface.
- size_t width_;
- size_t height_;
+ // Width and height of the video frame.
+ gfx::Size data_size_;
+
+ // Width and height of the video frame with aspect ratio taken
+ // into account.
+ gfx::Size natural_size_;
// Array of strides for each plane, typically greater or equal to the width
// of the surface divided by the horizontal sampling period. Note that