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

Side by Side Diff: media/video/picture.h

Issue 6901036: Update VideoDecode PPAPI structs to be consistent with media structures, part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing a few parameter types Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_VIDEO_PICTURE_H_ 5 #ifndef MEDIA_VIDEO_PICTURE_H_
6 #define MEDIA_VIDEO_PICTURE_H_ 6 #define MEDIA_VIDEO_PICTURE_H_
7 7
8 #include <vector> 8 #include "base/basictypes.h"
9 9 #include "ui/gfx/size.h"
10 #include "base/compiler_specific.h"
11 #include "media/video/video_decode_accelerator.h"
12 10
13 namespace media { 11 namespace media {
14 12
15 // TODO(vmr): Evaluate the generalization potential of these interfaces & 13 // Interface expected from PictureBuffers where pictures are stored.
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 Include a comment pointer to the equivalent PP str
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Done.
16 // classes and refactor as needed with the rest of media stack. 14 class PictureBuffer {
17 class PictureBuffer : public VideoDecodeAccelerator::PictureBuffer {
18 public: 15 public:
19 PictureBuffer(int32 id, gfx::Size pixel_size, 16 enum MemoryType {
20 std::vector<uint32> color_format, MemoryType memory_type, 17 PICTUREBUFFER_MEMORYTYPE_NONE = 0,
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 I wonder about the utility of NONE. What does tha
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 I'm not sure either :/ Looks like most of the exis
21 std::vector<DataPlaneHandle> data_plane_handles); 18 PICTUREBUFFER_MEMORYTYPE_SYSTEM,
22 virtual ~PictureBuffer(); 19 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE,
20 };
23 21
24 // VideoDecodeAccelerator::PictureBuffer implementation. 22 union Data {
25 virtual int32 GetId() OVERRIDE; 23 struct {
26 virtual gfx::Size GetSize() OVERRIDE; 24 uint32 context_id; // GLES context id.
27 virtual const std::vector<uint32>& GetColorFormat() OVERRIDE; 25 uint32 texture_id; // GLES texture id.
28 virtual MemoryType GetMemoryType() OVERRIDE; 26 } gles2_texture;
29 virtual std::vector<DataPlaneHandle>& GetPlaneHandles() OVERRIDE; 27 void* sysmem; // Simply a pointer to system memory.
28 Data();
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 Unions can have constructors??? OMG. Per offline
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Done.
29 };
30
31 PictureBuffer();
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 ctor goes at the top
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Done.
32 void Initialize(int32 id, MemoryType memory_type,
33 gfx::Size dimensions, Data data);
34
35 int32 GetId() const;
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 const getters can be lower_case()'d (ditto for Pic
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Done.
36 MemoryType GetMemoryType() const;
37 gfx::Size GetDimensions() const;
38 Data GetData() const;
30 39
31 private: 40 private:
32 int32 id_; 41 int32 id_;
33 gfx::Size pixel_size_;
34 std::vector<uint32> color_format_;
35 MemoryType memory_type_; 42 MemoryType memory_type_;
36 std::vector<DataPlaneHandle>& data_plane_handles_; 43 gfx::Size dimensions_;
37 44 Data data_;
38 DISALLOW_IMPLICIT_CONSTRUCTORS(PictureBuffer); 45 bool initialized_;
39 }; 46 };
scherkus (not reviewing) 2011/04/29 20:33:01 DISALLOW etc?
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Since I'm using std::vectors that contain instance
40 47
41 class Picture : public VideoDecodeAccelerator::Picture { 48 class Picture {
42 public: 49 public:
43 Picture(PictureBuffer* picture_buffer, gfx::Size decoded_pixel_size, 50 // Picture size related functions.
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 ISTM the same commentary belongs also in the PP st
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Done.
44 gfx::Size visible_pixel_size, void* user_handle); 51 // There are three types of logical picture sizes that applications using
45 virtual ~Picture(); 52 // video decoder should be aware of:
53 // - Visible picture size,
54 // - Decoded picture size, and
55 // - Picture buffer size.
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 You explain visible & decoded sizes, but what abou
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Ah whoops, didn't read this very carefully when I
56 //
57 // Visible picture size means the actual picture size that is intended to be
58 // displayed from the decoded output.
59 //
60 // Decoded picture size might vary from the visible size of the picture,
61 // because of the underlying properties of the codec. Vast majority of
62 // modern video compression algorithms are based on (macro)block-based
63 // transforms and therefore process the picture in small windows (usually
64 // of size 16x16 pixels) one by one. However, if the native picture size
65 // does not happen to match the block-size of the algorithm, there may be
66 // redundant data left on the sides of the output picture, which are not
67 // intended for display. For example, this happens to video of size 854x480
68 // and H.264 codec. Since the width (854 pixels) is not multiple of the
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 s/not/not a/
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 n/a now
69 // block size of the coding format (16 pixels), pixel columns 854-863
70 // contain garbage data which is notintended for display.
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 s/noti/not i/
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 n/a now
71 //
72 // Plugin is providing the buffers for output decoding and it should know
73 // the picture buffer size it has provided to the decoder. Thus, there is
74 // no function to query the buffer size from this class.
46 75
47 // VideoDecodeAccelerator::Picture implementation. 76 Picture();
48 virtual PictureBuffer* picture_buffer() OVERRIDE; 77 void Initialize(int32 picture_buffer_id, gfx::Size decoded_pixel_size,
49 virtual gfx::Size GetDecodedSize() const OVERRIDE; 78 gfx::Size visible_pixel_size, void* user_handle);
50 virtual gfx::Size GetVisibleSize() const OVERRIDE; 79
51 virtual void* GetUserHandle() OVERRIDE; 80 // Returns the id of the picture buffer where this picture is contained.
81 int32 GetId() const;
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 picture_buffer_id() ?
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Done.
82
83 // Returns the decoded size of the decoded picture in pixels.
84 gfx::Size GetDecodedSize() const;
85
86 // Returns the visible size of the decoded picture in pixels.
87 gfx::Size GetVisibleSize() const;
88
89 // Returns metadata associated with the picture.
90 void* GetUserHandle() const;
52 91
53 private: 92 private:
54 // Pointer to the picture buffer which contains this picture. 93 // ID of the picture buffer which contains this picture.
55 PictureBuffer* picture_buffer_; 94 int32 picture_buffer_id_;
56 gfx::Size decoded_pixel_size_; 95 gfx::Size decoded_pixel_size_;
57 gfx::Size visible_pixel_size_; 96 gfx::Size visible_pixel_size_;
58 void* user_handle_; 97 void* user_handle_;
59 98 bool initialized_;
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 DISALLOW_COPY_AND_ASSIGN for this and PictureBuffe
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 As I told Andrew above: since I'm using std::vecto
60 DISALLOW_IMPLICIT_CONSTRUCTORS(Picture);
61 }; 99 };
62 100
63 } // namespace media 101 } // namespace media
64 102
65 #endif // MEDIA_VIDEO_PICTURE_H_ 103 #endif // MEDIA_VIDEO_PICTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698