Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1090)

Unified Diff: media/base/video_frame.h

Issue 10824141: Remove VideoDecoder::natural_size() & added VideoFrame::natural_size(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/video_frame.h
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 26a9dea9330d0e12f6ce17969a34b2922042c243..955a2b54d8db09e193d8c0928acbd0f3dd9fb5dc 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,30 @@ 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.
+ // |size| is the width and height of the frame data in pixels.
Ami GONE FROM CHROMIUM 2012/08/02 17:34:45 This line does not tell me this is "coded size".
acolwell GONE FROM CHROMIUM 2012/08/02 20:20:21 Renamed to data_size as agreed in offline discussi
+ // |natural_size| is the width and height of the frame when the frame's aspect
+ // ratio is applied to |size|.
static scoped_refptr<VideoFrame> CreateFrame(
Format format,
- size_t width,
- size_t height,
+ const gfx::Size& 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& size);
// Wraps a native texture of the given parameters with a VideoFrame. When the
// frame is destroyed |no_longer_needed.Run()| will be called.
+ // |size| is the width and height of the frame data in pixels.
Ami GONE FROM CHROMIUM 2012/08/02 17:34:45 ditto
acolwell GONE FROM CHROMIUM 2012/08/02 20:20:21 Done.
+ // |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& size,
+ const gfx::Size& natural_size,
base::TimeDelta timestamp,
const base::Closure& no_longer_needed);
@@ -69,13 +73,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& size() const { return size_; }
Ami GONE FROM CHROMIUM 2012/08/02 17:34:45 ditto
acolwell GONE FROM CHROMIUM 2012/08/02 20:20:21 Done.
+ const gfx::Size& natural_size() const { return natural_size_; }
int stride(size_t plane) const;
@@ -115,8 +118,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,
Ami GONE FROM CHROMIUM 2012/08/02 17:34:45 ditto
acolwell GONE FROM CHROMIUM 2012/08/02 20:20:21 Done.
+ const gfx::Size& natural_size,
base::TimeDelta timestamp);
virtual ~VideoFrame();
@@ -130,9 +133,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.
Ami GONE FROM CHROMIUM 2012/08/02 17:34:45 ditto
acolwell GONE FROM CHROMIUM 2012/08/02 20:20:21 Done.
+ gfx::Size 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

Powered by Google App Engine
This is Rietveld 408576698