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

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

Issue 7021020: Clean up video frame sizes, types in Video Decode API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: responses to CR Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/pepper_platform_video_decoder_impl.cc ('k') | media/video/picture.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ui/gfx/gl/gl_context.h" 9 #include "ui/gfx/gl/gl_context.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
11 11
12 namespace media { 12 namespace media {
13 13
14 // Common information about GLES & Sysmem picture buffers. 14 // A picture buffer that is composed of a GLES2 texture.
15 // This is the media-namespace equivalent of PP_BufferInfo_Dev. 15 // This is the media-namespace equivalent of PP_PictureBuffer_Dev.
16 class BaseBuffer { 16 class PictureBuffer {
17 public: 17 public:
18 BaseBuffer(int32 id, gfx::Size size); 18 PictureBuffer(int32 id, gfx::Size size, uint32 texture_id);
19 virtual ~BaseBuffer();
20 19
21 // Returns the client-specified id of the buffer. 20 // Returns the client-specified id of the buffer.
22 int32 id() const { 21 int32 id() const {
23 return id_; 22 return id_;
24 } 23 }
25 24
26 // Returns the size of the buffer. 25 // Returns the size of the buffer.
27 gfx::Size size() const { 26 gfx::Size size() const {
28 return size_; 27 return size_;
29 } 28 }
30 29
31 private:
32 int32 id_;
33 gfx::Size size_;
34 };
35
36 // A picture buffer that is composed of a GLES2 texture and context.
37 // This is the media-namespace equivalent of PP_GLESBuffer_Dev.
38 class GLESBuffer : public BaseBuffer {
39 public:
40 GLESBuffer(int32 id, gfx::Size size, uint32 texture_id);
41
42 // Returns the id of the texture. 30 // Returns the id of the texture.
43 // NOTE: The texture id in the renderer process corresponds to a different 31 // NOTE: The texture id in the renderer process corresponds to a different
44 // texture id in the GPU process. 32 // texture id in the GPU process.
45 uint32 texture_id() const { 33 uint32 texture_id() const {
46 return texture_id_; 34 return texture_id_;
47 } 35 }
48 36
49 private: 37 private:
38 int32 id_;
39 gfx::Size size_;
50 uint32 texture_id_; 40 uint32 texture_id_;
51 }; 41 };
52 42
53 // TODO(fischman,vrk): rip out SysmemBuffer and all its vestiges (such as
54 // BaseBuffer's existence, VideoDecodeAccelerator::MemoryType, their ppapi
55 // equivalents, etc). Rename GLESBuffer to PictureBuffer.
56
57 // A picture buffer that lives in system memory.
58 // This is the media-namespace equivalent of PP_SysmemBuffer_Dev.
59 class SysmemBuffer : public BaseBuffer {
60 public:
61 SysmemBuffer(int32 id, gfx::Size size, void* data);
62
63 // Returns a pointer to the buffer data.
64 void* data() const {
65 return data_;
66 }
67
68 private:
69 void* data_;
70 };
71
72 // A decoded picture frame. 43 // A decoded picture frame.
73 // This is the media-namespace equivalent of PP_Picture_Dev. 44 // This is the media-namespace equivalent of PP_Picture_Dev.
74 class Picture { 45 class Picture {
75 public: 46 public:
76 Picture(int32 picture_buffer_id, int32 bitstream_buffer_id, 47 Picture(int32 picture_buffer_id, int32 bitstream_buffer_id);
77 gfx::Size visible_size, gfx::Size decoded_size);
78 48
79 // Returns the id of the picture buffer where this picture is contained. 49 // Returns the id of the picture buffer where this picture is contained.
80 int32 picture_buffer_id() const { 50 int32 picture_buffer_id() const {
81 return picture_buffer_id_; 51 return picture_buffer_id_;
82 } 52 }
83 53
84 // Returns the id of the bitstream buffer from which this frame was decoded. 54 // Returns the id of the bitstream buffer from which this frame was decoded.
85 int32 bitstream_buffer_id() const { 55 int32 bitstream_buffer_id() const {
86 return bitstream_buffer_id_; 56 return bitstream_buffer_id_;
87 } 57 }
88 58
89 void set_bitstream_buffer_id(int32 bitstream_buffer_id) { 59 void set_bitstream_buffer_id(int32 bitstream_buffer_id) {
90 bitstream_buffer_id_ = bitstream_buffer_id; 60 bitstream_buffer_id_ = bitstream_buffer_id;
91 } 61 }
92 62
93 // Returns the visible size of the decoded picture in pixels.
94 gfx::Size visible_size() const {
95 return visible_size_;
96 }
97
98 // Returns the decoded size of the decoded picture in pixels.
99 gfx::Size decoded_size() const {
100 return decoded_size_;
101 }
102
103 private: 63 private:
104 int32 picture_buffer_id_; 64 int32 picture_buffer_id_;
105 int32 bitstream_buffer_id_; 65 int32 bitstream_buffer_id_;
106 gfx::Size visible_size_;
107 gfx::Size decoded_size_;
108 }; 66 };
109 67
110 } // namespace media 68 } // namespace media
111 69
112 #endif // MEDIA_VIDEO_PICTURE_H_ 70 #endif // MEDIA_VIDEO_PICTURE_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper_platform_video_decoder_impl.cc ('k') | media/video/picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698