Chromium Code Reviews| Index: components/video_capture/mojo_video_frame.h |
| diff --git a/components/video_capture/mojo_video_frame.h b/components/video_capture/mojo_video_frame.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a91762ee86b0a2c0d2c510b46937cdd5c704418d |
| --- /dev/null |
| +++ b/components/video_capture/mojo_video_frame.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_ |
| +#define COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/time/time.h" |
| +#include "media/base/video_frame.h" |
| +#include "media/base/video_types.h" |
| +#include "mojo/public/cpp/system/buffer.h" |
| + |
| +namespace gfx { |
| +class Size; |
| +} |
| + |
| +namespace video_capture { |
| + |
| +// A derived class of media::VideoFrame holding a mojo::SharedBuffer which is |
| +// mapped on constructor and remains so for the lifetime of the MojoVideoFrame. |
| +// The underlying VideoFrame uses this SharedBuffer as storage. MojoVideoFrames |
| +// frames are ref-counted, always I420, and coded_size() == natural_size() == |
| +// visible_rect(). |
| +class MojoVideoFrame : public media::VideoFrame { |
| + public: |
| + static scoped_refptr<MojoVideoFrame> CreateMojoVideoFrame( |
| + const gfx::Size& dimensions, |
| + base::TimeDelta timestamp); |
| + |
| + explicit MojoVideoFrame(const gfx::Size& dimensions, |
| + base::TimeDelta timestamp); |
|
emircan
2016/02/16 17:45:48
Should this be private since we have the static ca
mcasas
2016/02/16 23:17:21
Done.
|
| + |
| + mojo::SharedBufferHandle handle() { return shared_buffer_.handle.get(); } |
| + size_t mapped_size() const { return shared_buffer_size_; } |
| + |
| + private: |
| + ~MojoVideoFrame() override; |
| + |
| + const size_t shared_buffer_size_; |
| + const mojo::SharedBuffer shared_buffer_; |
| +}; |
| + |
| +} // namespace video_capture |
| + |
| +#endif // COMPONENTS_VIDEO_CAPTURE_MOJO_VIDEO_FRAME_H_ |