OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ | 5 #ifndef MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ |
6 #define MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ | 6 #define MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 size_t v_offset, | 65 size_t v_offset, |
66 int32_t y_stride, | 66 int32_t y_stride, |
67 int32_t u_stride, | 67 int32_t u_stride, |
68 int32_t v_stride, | 68 int32_t v_stride, |
69 base::TimeDelta timestamp); | 69 base::TimeDelta timestamp); |
70 | 70 |
71 // Returns the offsets relative to the start of |shared_buffer| for the | 71 // Returns the offsets relative to the start of |shared_buffer| for the |
72 // |plane| specified. | 72 // |plane| specified. |
73 size_t PlaneOffset(size_t plane) const; | 73 size_t PlaneOffset(size_t plane) const; |
74 | 74 |
75 // Returns the mojo shared memory handle. This object continues to own the | |
76 // handle. Caller should call duplicate the handle if they want to keep a | |
dcheng
2017/06/05 20:33:01
Nit: delete "call"
sandersd (OOO until July 31)
2017/06/06 01:05:47
Done.
| |
77 // copy of the shared memory. | |
78 const mojo::SharedBufferHandle& Handle() const; | |
79 | |
80 // Returns the size of the shared memory. | |
81 size_t MappedSize() const; | |
82 | |
75 // Sets the callback to be called to free the shared buffer. If not null, | 83 // Sets the callback to be called to free the shared buffer. If not null, |
76 // it is called on destruction, and is passed ownership of |handle|. | 84 // it is called on destruction, and is passed ownership of |handle|. |
77 void SetMojoSharedBufferDoneCB( | 85 void SetMojoSharedBufferDoneCB( |
78 const MojoSharedBufferDoneCB& mojo_shared_buffer_done_cb); | 86 const MojoSharedBufferDoneCB& mojo_shared_buffer_done_cb); |
79 | 87 |
80 private: | 88 private: |
81 // mojo::TypeConverter added as a friend so that MojoSharedBufferVideoFrame | 89 // mojo::TypeConverter added as a friend so that MojoSharedBufferVideoFrame |
82 // can be transferred across a mojo connection. | 90 // can be transferred across a mojo connection. |
83 friend struct mojo::TypeConverter<mojo::StructPtr<mojom::VideoFrame>, | 91 friend struct mojo::TypeConverter<mojo::StructPtr<mojom::VideoFrame>, |
84 scoped_refptr<VideoFrame>>; | 92 scoped_refptr<VideoFrame>>; |
(...skipping 10 matching lines...) Expand all Loading... | |
95 | 103 |
96 // Initializes the MojoSharedBufferVideoFrame by creating a mapping onto | 104 // Initializes the MojoSharedBufferVideoFrame by creating a mapping onto |
97 // the shared memory, and then setting the strides and offsets as specified. | 105 // the shared memory, and then setting the strides and offsets as specified. |
98 bool Init(int32_t y_stride, | 106 bool Init(int32_t y_stride, |
99 int32_t u_stride, | 107 int32_t u_stride, |
100 int32_t v_stride, | 108 int32_t v_stride, |
101 size_t y_offset, | 109 size_t y_offset, |
102 size_t u_offset, | 110 size_t u_offset, |
103 size_t v_offset); | 111 size_t v_offset); |
104 | 112 |
105 // Returns the mojo shared memory handle. This object continues to own the | |
106 // handle. Caller should call duplicate the handle if they want to keep a | |
107 // copy of the shared memory. | |
108 const mojo::SharedBufferHandle& Handle() const; | |
109 | |
110 // Returns the size of the shared memory. | |
111 size_t MappedSize() const; | |
112 | |
113 uint8_t* shared_buffer_data() { | 113 uint8_t* shared_buffer_data() { |
114 return reinterpret_cast<uint8_t*>(shared_buffer_mapping_.get()); | 114 return reinterpret_cast<uint8_t*>(shared_buffer_mapping_.get()); |
115 }; | 115 }; |
116 | 116 |
117 mojo::ScopedSharedBufferHandle shared_buffer_handle_; | 117 mojo::ScopedSharedBufferHandle shared_buffer_handle_; |
118 mojo::ScopedSharedBufferMapping shared_buffer_mapping_; | 118 mojo::ScopedSharedBufferMapping shared_buffer_mapping_; |
119 size_t shared_buffer_size_; | 119 size_t shared_buffer_size_; |
120 size_t offsets_[kMaxPlanes]; | 120 size_t offsets_[kMaxPlanes]; |
121 MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_; | 121 MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); | 123 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace media | 126 } // namespace media |
127 | 127 |
128 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ | 128 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ |
OLD | NEW |