Chromium Code Reviews| Index: components/arc/video_accelerator/video_encode_accelerator_struct_traits.h |
| diff --git a/components/arc/video_accelerator/video_encode_accelerator_struct_traits.h b/components/arc/video_accelerator/video_encode_accelerator_struct_traits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..635a05fdb2642a778f5ec0e2c22600b23febed75 |
| --- /dev/null |
| +++ b/components/arc/video_accelerator/video_encode_accelerator_struct_traits.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2017 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_ARC_VIDEO_ACCELERATOR_VIDEO_ENCODE_ACCELERATOR_STRUCT_TRAITS_H_ |
| +#define COMPONENTS_ARC_VIDEO_ACCELERATOR_VIDEO_ENCODE_ACCELERATOR_STRUCT_TRAITS_H_ |
| + |
| +#include "components/arc/common/video_encode_accelerator.mojom.h" |
| +#include "media/video/video_encode_accelerator.h" |
| + |
| +namespace mojo { |
| + |
| +template <> |
| +struct EnumTraits<arc::mojom::VideoEncodeAccelerator::Error, |
| + media::VideoEncodeAccelerator::Error> { |
| + static arc::mojom::VideoEncodeAccelerator::Error ToMojom( |
| + media::VideoEncodeAccelerator::Error input); |
| + |
| + static bool FromMojom(arc::mojom::VideoEncodeAccelerator::Error input, |
| + media::VideoEncodeAccelerator::Error* output); |
| +}; |
| + |
| +template <> |
| +struct EnumTraits<arc::mojom::VideoPixelFormat, media::VideoPixelFormat> { |
| + static arc::mojom::VideoPixelFormat ToMojom(media::VideoPixelFormat input); |
| + |
| + static bool FromMojom(arc::mojom::VideoPixelFormat input, |
| + media::VideoPixelFormat* output); |
| +}; |
| + |
| +template <> |
| +struct EnumTraits<arc::mojom::VideoCodecProfile, media::VideoCodecProfile> { |
| + static arc::mojom::VideoCodecProfile ToMojom(media::VideoCodecProfile input); |
| + |
| + static bool FromMojom(arc::mojom::VideoCodecProfile input, |
| + media::VideoCodecProfile* output); |
| +}; |
| + |
| +template <> |
| +struct StructTraits<arc::mojom::VideoEncodeProfileDataView, |
| + media::VideoEncodeAccelerator::SupportedProfile> { |
| + static media::VideoCodecProfile profile( |
| + const media::VideoEncodeAccelerator::SupportedProfile& r) { |
| + return r.profile; |
| + } |
| + static gfx::Size max_resolution( |
|
dcheng
2017/06/21 09:42:29
Nit: return non-trivial types by const ref
dcheng
2017/06/22 20:05:13
I think this might have been missed in the latest
Owen Lin
2017/06/23 01:37:54
Sorry, I missed that. Done.
|
| + const media::VideoEncodeAccelerator::SupportedProfile& r) { |
| + return r.max_resolution; |
| + } |
| + static uint32_t max_framerate_numerator( |
| + const media::VideoEncodeAccelerator::SupportedProfile& r) { |
| + return r.max_framerate_numerator; |
| + } |
| + static uint32_t max_framerate_denominator( |
| + const media::VideoEncodeAccelerator::SupportedProfile& r) { |
| + return r.max_framerate_denominator; |
| + } |
| + |
| + static bool Read(arc::mojom::VideoEncodeProfileDataView data, |
| + media::VideoEncodeAccelerator::SupportedProfile* out) { |
| + NOTIMPLEMENTED(); |
| + return false; |
| + } |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // COMPONENTS_ARC_VIDEO_ACCELERATOR_VIDEO_ENCODE_ACCELERATOR_STRUCT_TRAITS_H_ |