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

Side by Side Diff: media/mojo/interfaces/video_frame_struct_traits.h

Issue 2908303003: media: Create Mojo StructTraits for VideoFrame (Closed)
Patch Set: Remove death test. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_MOJO_INTERFACES_VIDEO_FRAME_STRUCT_TRAITS_H_
6 #define MEDIA_MOJO_INTERFACES_VIDEO_FRAME_STRUCT_TRAITS_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "gpu/ipc/common/mailbox_holder_struct_traits.h"
10 #include "media/base/ipc/media_param_traits_macros.h"
11 #include "media/base/video_frame.h"
12 #include "media/mojo/interfaces/media_types.mojom.h"
13 #include "mojo/common/common_custom_types_struct_traits.h"
14 #include "mojo/public/cpp/bindings/struct_traits.h"
15 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
16
17 namespace mojo {
18
19 template <>
20 struct StructTraits<media::mojom::VideoFrameDataView,
21 scoped_refptr<media::VideoFrame>> {
22 static void* SetUpContext(const scoped_refptr<media::VideoFrame>& input);
23
24 static void TearDownContext(const scoped_refptr<media::VideoFrame>&,
25 void* context);
26
27 static bool IsNull(const scoped_refptr<media::VideoFrame>& input) {
28 return !input;
29 }
30
31 static void SetToNull(scoped_refptr<media::VideoFrame>* input) {
32 *input = nullptr;
33 }
34
35 static media::VideoPixelFormat format(
36 const scoped_refptr<media::VideoFrame>& input) {
37 return input->format();
38 }
39
40 static const gfx::Size& coded_size(
41 const scoped_refptr<media::VideoFrame>& input) {
42 return input->coded_size();
43 }
44
45 static const gfx::Rect& visible_rect(
46 const scoped_refptr<media::VideoFrame>& input) {
47 return input->visible_rect();
48 }
49
50 static const gfx::Size& natural_size(
51 const scoped_refptr<media::VideoFrame>& input) {
52 return input->natural_size();
53 }
54
55 static bool end_of_stream(const scoped_refptr<media::VideoFrame>& input) {
56 return input->metadata()->IsTrue(media::VideoFrameMetadata::END_OF_STREAM);
57 }
58
59 static base::TimeDelta timestamp(
60 const scoped_refptr<media::VideoFrame>& input) {
61 return input->timestamp();
62 }
63
64 static media::mojom::VideoFrameDataPtr& data(
65 const scoped_refptr<media::VideoFrame>& input,
66 void* context);
67
68 static bool Read(media::mojom::VideoFrameDataView input,
69 scoped_refptr<media::VideoFrame>* output);
70 };
71
72 } // namespace mojo
73
74 #endif // MEDIA_MOJO_INTERFACES_VIDEO_FRAME_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698