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

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

Issue 2908303003: media: Create Mojo StructTraits for VideoFrame (Closed)
Patch Set: Correct mojo_cdm_allocator_unittest.cc 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 bool IsNull(const scoped_refptr<media::VideoFrame>& input) {
23 return !input;
24 }
25
26 static void SetToNull(scoped_refptr<media::VideoFrame>* input) {
27 *input = nullptr;
28 }
29
30 static media::VideoPixelFormat format(
31 const scoped_refptr<media::VideoFrame>& input) {
32 return input->format();
33 }
34
35 static const gfx::Size& coded_size(
36 const scoped_refptr<media::VideoFrame>& input) {
37 return input->coded_size();
38 }
39
40 static const gfx::Rect& visible_rect(
41 const scoped_refptr<media::VideoFrame>& input) {
42 return input->visible_rect();
43 }
44
45 static const gfx::Size& natural_size(
46 const scoped_refptr<media::VideoFrame>& input) {
47 return input->natural_size();
48 }
49
50 static bool end_of_stream(const scoped_refptr<media::VideoFrame>& input) {
51 return input->metadata()->IsTrue(media::VideoFrameMetadata::END_OF_STREAM);
52 }
53
54 static base::TimeDelta timestamp(
55 const scoped_refptr<media::VideoFrame>& input) {
56 return input->timestamp();
57 }
58
59 static media::mojom::VideoFrameDataPtr data(
60 const scoped_refptr<media::VideoFrame>& input);
61
62 static bool Read(media::mojom::VideoFrameDataView input,
63 scoped_refptr<media::VideoFrame>* output);
64 };
65
66 } // namespace mojo
67
68 #endif // MEDIA_MOJO_INTERFACES_VIDEO_FRAME_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698