Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: media/mojo/services/mojo_video_frame.h

Issue 1704273002: Add MojoVideoFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/mojo/services/mojo_video_frame.h
diff --git a/media/mojo/services/mojo_video_frame.h b/media/mojo/services/mojo_video_frame.h
new file mode 100644
index 0000000000000000000000000000000000000000..396651bffcccec0505f9faa54ee9e5901dce3639
--- /dev/null
+++ b/media/mojo/services/mojo_video_frame.h
@@ -0,0 +1,63 @@
+// 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_MOJO_SERVICES_MOJO_VIDEO_FRAME_H_
+#define MEDIA_MOJO_SERVICES_MOJO_VIDEO_FRAME_H_
+
+#include <stddef.h>
+
+#include "base/macros.h"
+#include "media/base/media_export.h"
+#include "media/base/video_frame.h"
+#include "mojo/public/cpp/system/buffer.h"
+
+namespace media {
+
+class MEDIA_EXPORT MojoVideoFrame : public VideoFrame {
+ public:
+ static scoped_refptr<VideoFrame> Create(VideoPixelFormat format,
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect,
+ const gfx::Size& natural_size,
+ int32_t y_stride,
+ int32_t u_stride,
+ int32_t v_stride,
+ mojo::ScopedSharedBufferHandle handle,
+ size_t data_size,
+ size_t y_offset,
+ size_t u_offset,
+ size_t v_offset,
+ base::TimeDelta timestamp);
+
+ // Returns the mojo shared memory handle, if present. This object continues
+ // to own the handle.
+ mojo::SharedBufferHandle mojo_shared_memory_handle() const;
+
+ // Returns the size of the shared memory.
+ size_t mojo_shared_memory_size() const;
+
+ // Returns the offsets relative to the start of |mojo_shared_memory_handle|
+ // for the |plane| specified.
+ size_t plane_offset(size_t plane) const;
+
+ private:
+ MojoVideoFrame(VideoPixelFormat format,
+ StorageType storage_type,
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect,
+ const gfx::Size& natural_size,
+ base::TimeDelta timestamp);
+ ~MojoVideoFrame() override;
+
+ // SharedBufferHandle attached to the video_frame.
+ mojo::ScopedSharedBufferHandle mojo_shared_memory_handle_;
+ size_t mojo_shared_memory_size_;
+ size_t offsets_[kMaxPlanes];
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MojoVideoFrame);
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_FRAME_H_

Powered by Google App Engine
This is Rietveld 408576698