| Index: media/capture/service/mojo_video_frame.h
|
| diff --git a/media/capture/service/mojo_video_frame.h b/media/capture/service/mojo_video_frame.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..11ddb5dce70e8f978ca2a78a30ba3dd42ec6aa66
|
| --- /dev/null
|
| +++ b/media/capture/service/mojo_video_frame.h
|
| @@ -0,0 +1,48 @@
|
| +// 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 MEDIA_CAPTURE_SERVICE_MOJO_VIDEO_FRAME_H_
|
| +#define MEDIA_CAPTURE_SERVICE_MOJO_VIDEO_FRAME_H_
|
| +
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/time/time.h"
|
| +#include "media/base/video_frame.h"
|
| +#include "mojo/public/cpp/system/buffer.h"
|
| +
|
| +namespace gfx {
|
| +class Size;
|
| +}
|
| +
|
| +namespace media {
|
| +
|
| +// 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:
|
| + // Creates and maps a MojoVideoFrame or returns nullptr.
|
| + static scoped_refptr<MojoVideoFrame> CreateMojoVideoFrame(
|
| + const gfx::Size& dimensions,
|
| + base::TimeDelta timestamp);
|
| +
|
| + mojo::SharedBufferHandle handle() { return shared_buffer_.handle.get(); }
|
| + size_t mapped_size() const { return shared_buffer_size_; }
|
| +
|
| + private:
|
| + explicit MojoVideoFrame(const gfx::Size& dimensions,
|
| + base::TimeDelta timestamp);
|
| + ~MojoVideoFrame() override;
|
| +
|
| + // Maps |shared_buffer_| or returns false.
|
| + bool Init();
|
| +
|
| + const size_t shared_buffer_size_;
|
| + const mojo::SharedBuffer shared_buffer_;
|
| +};
|
| +
|
| +} // namespace media
|
| +
|
| +#endif // MEDIA_CAPTURE_SERVICE_MOJO_VIDEO_FRAME_H_
|
|
|