Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "ui/gfx/size.h" | |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 struct PP_BufferInfo_Dev; |
| 11 #include "media/video/video_decode_accelerator.h" | 12 struct PP_GLESBuffer_Dev; |
| 13 struct PP_Picture_Dev; | |
| 14 struct PP_SysmemBuffer_Dev; | |
| 12 | 15 |
| 13 namespace media { | 16 namespace media { |
| 14 | 17 |
| 15 // TODO(vmr): Evaluate the generalization potential of these interfaces & | 18 // Information about the picture buffer. |
| 16 // classes and refactor as needed with the rest of media stack. | 19 // This is the media-namespace equivalent of PP_BufferInfo_Dev. |
| 17 class PictureBuffer : public VideoDecodeAccelerator::PictureBuffer { | 20 class BufferInfo { |
| 18 public: | 21 public: |
| 19 PictureBuffer(int32 id, gfx::Size pixel_size, | 22 BufferInfo(int32 id, gfx::Size size); |
| 20 std::vector<uint32> color_format, MemoryType memory_type, | 23 BufferInfo(const PP_BufferInfo_Dev& info); |
| 21 std::vector<DataPlaneHandle> data_plane_handles); | |
| 22 virtual ~PictureBuffer(); | |
| 23 | 24 |
| 24 // VideoDecodeAccelerator::PictureBuffer implementation. | 25 // Returns the client-specified id of the buffer. |
| 25 virtual int32 GetId() OVERRIDE; | 26 int32 id() const { |
| 26 virtual gfx::Size GetSize() OVERRIDE; | 27 return id_; |
| 27 virtual const std::vector<uint32>& GetColorFormat() OVERRIDE; | 28 } |
| 28 virtual MemoryType GetMemoryType() OVERRIDE; | 29 |
| 29 virtual std::vector<DataPlaneHandle>& GetPlaneHandles() OVERRIDE; | 30 // Returns the size of the buffer. |
| 31 gfx::Size size() const { | |
| 32 return size_; | |
| 33 } | |
| 34 private: | |
|
scherkus (not reviewing)
2011/05/04 00:03:28
nit: add blank line before public/private/protecte
vrk (LEFT CHROMIUM)
2011/05/05 05:57:12
Done.
| |
| 35 int32 id_; | |
| 36 gfx::Size size_; | |
| 37 }; | |
| 38 | |
| 39 // A picture buffer that is composed of a GLES2 texture and context. | |
| 40 // This is the media-namespace equivalent of PP_GLESBuffer_Dev. | |
| 41 class GLESBuffer { | |
| 42 public: | |
| 43 GLESBuffer(int32 id, gfx::Size size, uint32 texture_id, uint32 context_id); | |
| 44 GLESBuffer(const PP_GLESBuffer_Dev& buffer); | |
| 45 | |
| 46 // Returns the id of the texture. | |
| 47 uint32 texture_id() const { | |
| 48 return texture_id_; | |
| 49 } | |
| 50 | |
| 51 // Returns the id of the context in which this texture lives. | |
| 52 // TODO(vrk): I'm not sure if "id" is what we want, or some reference to the | |
| 53 // PPB_Context3D_Dev. Not sure how this eventually gets used. | |
| 54 uint32 context_id() const { | |
| 55 return context_id_; | |
| 56 } | |
| 57 | |
| 58 // Returns information regarding the buffer. | |
| 59 const BufferInfo& buffer_info() const { | |
| 60 return info_; | |
| 61 } | |
| 30 | 62 |
| 31 private: | 63 private: |
| 32 int32 id_; | 64 uint32 texture_id_; |
| 33 gfx::Size pixel_size_; | 65 uint32 context_id_; |
| 34 std::vector<uint32> color_format_; | 66 BufferInfo info_; |
| 35 MemoryType memory_type_; | |
| 36 std::vector<DataPlaneHandle>& data_plane_handles_; | |
| 37 | |
| 38 DISALLOW_IMPLICIT_CONSTRUCTORS(PictureBuffer); | |
| 39 }; | 67 }; |
| 40 | 68 |
| 41 class Picture : public VideoDecodeAccelerator::Picture { | 69 // A picture buffer that lives in system memory. |
| 70 // This is the media-namespace equivalent of PP_SysmemBuffer_Dev. | |
| 71 class SysmemBuffer { | |
| 42 public: | 72 public: |
| 43 Picture(PictureBuffer* picture_buffer, gfx::Size decoded_pixel_size, | 73 SysmemBuffer(int32 id, gfx::Size size, void* data); |
| 44 gfx::Size visible_pixel_size, void* user_handle); | 74 SysmemBuffer(const PP_SysmemBuffer_Dev&); |
| 45 virtual ~Picture(); | |
| 46 | 75 |
| 47 // VideoDecodeAccelerator::Picture implementation. | 76 // Returns a pointer to the buffer data. |
| 48 virtual PictureBuffer* picture_buffer() OVERRIDE; | 77 void* data() const { |
| 49 virtual gfx::Size GetDecodedSize() const OVERRIDE; | 78 return data_; |
| 50 virtual gfx::Size GetVisibleSize() const OVERRIDE; | 79 } |
| 51 virtual void* GetUserHandle() OVERRIDE; | 80 |
| 81 // Returns information regarding the buffer. | |
| 82 const BufferInfo& buffer_info() const { | |
| 83 return info_; | |
| 84 } | |
| 52 | 85 |
| 53 private: | 86 private: |
| 54 // Pointer to the picture buffer which contains this picture. | 87 void* data_; |
| 55 PictureBuffer* picture_buffer_; | 88 BufferInfo info_; |
|
Ami GONE FROM CHROMIUM
2011/05/03 23:34:47
I wonder if we're really going to end up wishing w
vrk (LEFT CHROMIUM)
2011/05/05 05:57:12
I think it's likely too... every time I've used he
| |
| 56 gfx::Size decoded_pixel_size_; | 89 }; |
| 57 gfx::Size visible_pixel_size_; | 90 |
| 91 // A decoded picture frame. | |
| 92 // This is the media-namespace equivalent of PP_Picture_Dev. | |
| 93 class Picture { | |
| 94 public: | |
| 95 Picture(const PP_Picture_Dev& picture); | |
| 96 | |
| 97 // Returns the id of the picture buffer where this picture is contained. | |
| 98 int32 picture_buffer_id() const { | |
| 99 return picture_buffer_id_; | |
| 100 } | |
| 101 | |
| 102 // Returns the visible size of the decoded picture in pixels. | |
| 103 gfx::Size visible_size() const { | |
| 104 return visible_size_; | |
| 105 } | |
| 106 | |
| 107 // Returns the decoded size of the decoded picture in pixels. | |
| 108 gfx::Size decoded_size() const { | |
| 109 return decoded_size_; | |
| 110 } | |
| 111 | |
| 112 // Returns the handle associated with the bitstream buffer from which this | |
| 113 // picture was decoded. | |
|
Ami GONE FROM CHROMIUM
2011/05/03 23:34:47
What if a picture spans more than one (or more tha
vrk (LEFT CHROMIUM)
2011/05/05 05:57:12
Ooh, not prepared for that! Mind if I just leave a
| |
| 114 void* user_handle() const { | |
| 115 return user_handle_; | |
| 116 } | |
| 117 | |
| 118 private: | |
| 119 int32 picture_buffer_id_; | |
| 120 gfx::Size decoded_size_; | |
| 121 gfx::Size visible_size_; | |
| 58 void* user_handle_; | 122 void* user_handle_; |
| 59 | |
| 60 DISALLOW_IMPLICIT_CONSTRUCTORS(Picture); | |
| 61 }; | 123 }; |
| 62 | 124 |
| 63 } // namespace media | 125 } // namespace media |
| 64 | 126 |
| 65 #endif // MEDIA_VIDEO_PICTURE_H_ | 127 #endif // MEDIA_VIDEO_PICTURE_H_ |
| OLD | NEW |