| 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 22 matching lines...) Expand all Loading... |
| 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 size_t capacity)>; | 41 size_t capacity)>; |
| 42 | 42 |
| 43 static scoped_refptr<MojoSharedBufferVideoFrame> |
| 44 WrapMojoSharedBufferVideoFrame( |
| 45 const scoped_refptr<MojoSharedBufferVideoFrame>& frame); |
| 46 |
| 47 static scoped_refptr<MojoSharedBufferVideoFrame> CreateYUV( |
| 48 VideoPixelFormat format, |
| 49 const gfx::Size& dimensions, |
| 50 base::TimeDelta timestamp); |
| 51 |
| 43 // Creates a new I420 frame in shared memory with provided parameters | 52 // Creates a new I420 frame in shared memory with provided parameters |
| 44 // (coded_size() == natural_size() == visible_rect()), or returns nullptr. | 53 // (coded_size() == natural_size() == visible_rect()), or returns nullptr. |
| 45 // Buffers for the frame are allocated but not initialized. The caller must | 54 // Buffers for the frame are allocated but not initialized. The caller must |
| 46 // not make assumptions about the actual underlying sizes, but check the | 55 // not make assumptions about the actual underlying sizes, but check the |
| 47 // returned VideoFrame instead. | 56 // returned VideoFrame instead. |
| 48 static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultI420( | 57 static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultI420( |
| 49 const gfx::Size& dimensions, | 58 const gfx::Size& dimensions, |
| 50 base::TimeDelta timestamp); | 59 base::TimeDelta timestamp); |
| 51 | 60 |
| 52 // Creates a MojoSharedBufferVideoFrame that uses the memory in |handle|. | 61 // Creates a MojoSharedBufferVideoFrame that uses the memory in |handle|. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 size_t shared_buffer_size_; | 128 size_t shared_buffer_size_; |
| 120 size_t offsets_[kMaxPlanes]; | 129 size_t offsets_[kMaxPlanes]; |
| 121 MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_; | 130 MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_; |
| 122 | 131 |
| 123 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); | 132 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); |
| 124 }; | 133 }; |
| 125 | 134 |
| 126 } // namespace media | 135 } // namespace media |
| 127 | 136 |
| 128 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ | 137 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ |
| OLD | NEW |