| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "media/base/media_export.h" | |
| 14 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 15 #include "mojo/public/cpp/system/buffer.h" | 14 #include "mojo/public/cpp/system/buffer.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 18 | 17 |
| 19 namespace media { | 18 namespace media { |
| 20 | 19 |
| 21 // A derived class of media::VideoFrame holding a mojo::SharedBufferHandle | 20 // A derived class of media::VideoFrame holding a mojo::SharedBufferHandle |
| 22 // which is mapped on constructor and remains so for the lifetime of the | 21 // which is mapped on constructor and remains so for the lifetime of the |
| 23 // object. These frames are ref-counted. | 22 // object. These frames are ref-counted. |
| 24 class MEDIA_EXPORT MojoSharedBufferVideoFrame : public VideoFrame { | 23 class MojoSharedBufferVideoFrame : public VideoFrame { |
| 25 public: | 24 public: |
| 26 // Creates a new I420 frame in shared memory with provided parameters | 25 // Creates a new I420 frame in shared memory with provided parameters |
| 27 // (coded_size() == natural_size() == visible_rect()), or returns nullptr. | 26 // (coded_size() == natural_size() == visible_rect()), or returns nullptr. |
| 28 // Buffers for the frame are allocated but not initialized. The caller must | 27 // Buffers for the frame are allocated but not initialized. The caller must |
| 29 // not make assumptions about the actual underlying sizes, but check the | 28 // not make assumptions about the actual underlying sizes, but check the |
| 30 // returned VideoFrame instead. | 29 // returned VideoFrame instead. |
| 31 static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultI420( | 30 static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultI420( |
| 32 const gfx::Size& dimensions, | 31 const gfx::Size& dimensions, |
| 33 base::TimeDelta timestamp); | 32 base::TimeDelta timestamp); |
| 34 | 33 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 size_t shared_buffer_size_; | 75 size_t shared_buffer_size_; |
| 77 uint8_t* shared_buffer_data_; | 76 uint8_t* shared_buffer_data_; |
| 78 size_t offsets_[kMaxPlanes]; | 77 size_t offsets_[kMaxPlanes]; |
| 79 | 78 |
| 80 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); | 79 DISALLOW_COPY_AND_ASSIGN(MojoSharedBufferVideoFrame); |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 } // namespace media | 82 } // namespace media |
| 84 | 83 |
| 85 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ | 84 #endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_ |
| OLD | NEW |