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 #include "media/video/picture.h" | 5 #include "media/video/picture.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | |
| 8 | |
| 7 namespace media { | 9 namespace media { |
| 8 | 10 |
| 9 // PictureBuffer implementation. | 11 PictureBuffer::Data::Data() { |
|
Ami GONE FROM CHROMIUM
2011/04/29 18:40:34
Hopefully this can go away.
vrk (LEFT CHROMIUM)
2011/05/03 18:19:58
Yup! Gone.
| |
| 10 PictureBuffer::PictureBuffer(int32 id, | 12 // Initialize an empty union to null. |
| 11 gfx::Size pixel_size, | 13 memset(this, 0, sizeof(Data)); |
|
scherkus (not reviewing)
2011/04/29 20:33:01
pedantic nit: use variables for sizeof() calculati
vrk (LEFT CHROMIUM)
2011/05/03 18:19:58
n/a now!
| |
| 12 std::vector<uint32> color_format, | |
| 13 MemoryType memory_type, | |
| 14 std::vector<DataPlaneHandle> data_plane_handles) | |
| 15 : id_(id), | |
| 16 pixel_size_(pixel_size), | |
| 17 color_format_(color_format), | |
| 18 memory_type_(memory_type), | |
| 19 data_plane_handles_(data_plane_handles) { | |
| 20 } | 14 } |
| 21 | 15 |
| 22 PictureBuffer::~PictureBuffer() {} | 16 PictureBuffer::PictureBuffer() |
| 17 : id_(-1), | |
| 18 memory_type_(PICTUREBUFFER_MEMORYTYPE_NONE), | |
| 19 dimensions_(gfx::Size()), | |
| 20 data_(Data()), | |
|
Ami GONE FROM CHROMIUM
2011/04/29 18:40:34
FWIW you can omit the explicit ctor name:
dimensio
vrk (LEFT CHROMIUM)
2011/05/03 18:19:58
Totally forgot about that, thanks Ami!! N/A anymor
| |
| 21 initialized_(false) { | |
| 22 } | |
| 23 | 23 |
| 24 int32 PictureBuffer::GetId() { | 24 void PictureBuffer::Initialize(int32 id, |
| 25 PictureBuffer::MemoryType memory_type, | |
| 26 gfx::Size dimensions, | |
| 27 PictureBuffer::Data data) { | |
| 28 DCHECK(!initialized_); | |
|
Ami GONE FROM CHROMIUM
2011/04/29 18:40:34
Wait, what? If you don't want to allow *re*-initi
vrk (LEFT CHROMIUM)
2011/05/03 18:19:58
Explained offline. Fixed now!
| |
| 29 id_ = id; | |
| 30 memory_type_ = memory_type; | |
| 31 dimensions_ = dimensions; | |
| 32 data_ = data; | |
| 33 initialized_ = true; | |
| 34 } | |
| 35 | |
| 36 int32 PictureBuffer::GetId() const { | |
| 37 DCHECK(initialized_); | |
| 25 return id_; | 38 return id_; |
| 26 } | 39 } |
| 27 | 40 |
| 28 gfx::Size PictureBuffer::GetSize() { | 41 PictureBuffer::MemoryType PictureBuffer::GetMemoryType() const { |
| 29 return pixel_size_; | 42 DCHECK(initialized_); |
| 30 } | |
| 31 | |
| 32 const std::vector<uint32>& PictureBuffer::GetColorFormat() { | |
| 33 return color_format_; | |
| 34 } | |
| 35 | |
| 36 PictureBuffer::MemoryType PictureBuffer::GetMemoryType() { | |
| 37 return memory_type_; | 43 return memory_type_; |
| 38 } | 44 } |
| 39 | 45 |
| 40 std::vector<PictureBuffer::DataPlaneHandle>& PictureBuffer::GetPlaneHandles() { | 46 gfx::Size PictureBuffer::GetDimensions() const { |
| 41 return data_plane_handles_; | 47 DCHECK(initialized_); |
| 48 return dimensions_; | |
| 42 } | 49 } |
| 43 | 50 |
| 44 // Picture implementation. | 51 PictureBuffer::Data PictureBuffer::GetData() const { |
| 45 Picture::Picture(PictureBuffer* picture_buffer, gfx::Size decoded_pixel_size, | 52 DCHECK(initialized_); |
| 46 gfx::Size visible_pixel_size, void* user_handle) | 53 return data_; |
| 47 : picture_buffer_(picture_buffer), | |
| 48 decoded_pixel_size_(decoded_pixel_size), | |
| 49 visible_pixel_size_(visible_pixel_size), | |
| 50 user_handle_(user_handle) { | |
| 51 } | 54 } |
| 52 | 55 |
| 53 Picture::~Picture() {} | 56 Picture::Picture() |
| 57 : picture_buffer_id_(-1), | |
| 58 decoded_pixel_size_(gfx::Size()), | |
| 59 visible_pixel_size_(gfx::Size()), | |
| 60 user_handle_(NULL), | |
| 61 initialized_(false) { | |
| 62 } | |
| 54 | 63 |
| 55 PictureBuffer* Picture::picture_buffer() { | 64 void Picture::Initialize(int32 picture_buffer_id, |
| 56 return picture_buffer_; | 65 gfx::Size decoded_pixel_size, |
| 66 gfx::Size visible_pixel_size, | |
| 67 void* user_handle) { | |
| 68 DCHECK(!initialized_); | |
| 69 picture_buffer_id_ = picture_buffer_id; | |
| 70 decoded_pixel_size_ = decoded_pixel_size; | |
| 71 visible_pixel_size_ = visible_pixel_size; | |
| 72 user_handle_ = user_handle; | |
| 73 initialized_ = true; | |
| 74 } | |
| 75 | |
| 76 int32 Picture::GetId() const { | |
| 77 DCHECK(initialized_); | |
| 78 return picture_buffer_id_; | |
| 57 } | 79 } |
| 58 | 80 |
| 59 gfx::Size Picture::GetDecodedSize() const { | 81 gfx::Size Picture::GetDecodedSize() const { |
| 82 DCHECK(initialized_); | |
| 60 return decoded_pixel_size_; | 83 return decoded_pixel_size_; |
| 61 } | 84 } |
| 62 | 85 |
| 63 gfx::Size Picture::GetVisibleSize() const { | 86 gfx::Size Picture::GetVisibleSize() const { |
| 87 DCHECK(initialized_); | |
| 64 return visible_pixel_size_; | 88 return visible_pixel_size_; |
| 65 } | 89 } |
| 66 | 90 |
| 67 void* Picture::GetUserHandle() { | 91 void* Picture::GetUserHandle() const { |
| 92 DCHECK(initialized_); | |
| 68 return user_handle_; | 93 return user_handle_; |
| 69 } | 94 } |
| 70 | 95 |
| 71 } // namespace media | 96 } // namespace media |
| 72 | |
| OLD | NEW |