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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // A derived class of media::VideoFrame holding a mojo::SharedBufferHandle | 32 // A derived class of media::VideoFrame holding a mojo::SharedBufferHandle |
33 // which is mapped on constructor and remains so for the lifetime of the | 33 // which is mapped on constructor and remains so for the lifetime of the |
34 // object. These frames are ref-counted. | 34 // object. These frames are ref-counted. |
35 class MojoSharedBufferVideoFrame : public VideoFrame { | 35 class MojoSharedBufferVideoFrame : public VideoFrame { |
36 public: | 36 public: |
37 // Callback called when this object is destructed. Ownership of the shared | 37 // Callback called when this object is destructed. Ownership of the shared |
38 // memory is transferred to the callee. | 38 // memory is transferred to the callee. |
39 using MojoSharedBufferDoneCB = | 39 using MojoSharedBufferDoneCB = |
40 base::Callback<void(mojo::ScopedSharedBufferHandle buffer, | 40 base::Callback<void(mojo::ScopedSharedBufferHandle buffer, |
41 uint32_t capacity)>; | 41 size_t capacity)>; |
42 | 42 |
43 // Creates a new I420 frame in shared memory with provided parameters | 43 // Creates a new I420 frame in shared memory with provided parameters |
44 // (coded_size() == natural_size() == visible_rect()), or returns nullptr. | 44 // (coded_size() == natural_size() == visible_rect()), or returns nullptr. |
45 // Buffers for the frame are allocated but not initialized. The caller must | 45 // Buffers for the frame are allocated but not initialized. The caller must |
46 // not make assumptions about the actual underlying sizes, but check the | 46 // not make assumptions about the actual underlying sizes, but check the |
47 // returned VideoFrame instead. | 47 // returned VideoFrame instead. |
48 static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultI420( | 48 static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultI420( |
49 const gfx::Size& dimensions, | 49 const gfx::Size& dimensions, |
50 base::TimeDelta timestamp); | 50 base::TimeDelta timestamp); |
51 | 51 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 uint8_t* shared_buffer_data_; | 114 uint8_t* shared_buffer_data_; |
115 size_t offsets_[kMaxPlanes]; | 115 size_t offsets_[kMaxPlanes]; |
116 MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_; | 116 MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); | 118 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); |
119 }; | 119 }; |
120 | 120 |
121 } // namespace media | 121 } // namespace media |
122 | 122 |
123 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ | 123 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ |
OLD | NEW |