summaryrefslogtreecommitdiff
path: root/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.h
blob: ac43d30ecbf85bd885db8a2cfd2a00fce6a61a36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2019 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_MOJOM_SUPPORTED_VIDEO_DECODER_CONFIG_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_SUPPORTED_VIDEO_DECODER_CONFIG_MOJOM_TRAITS_H_

#include "media/base/ipc/media_param_traits.h"
#include "media/base/supported_video_decoder_config.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "media/mojo/mojom/video_decoder.mojom.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"

namespace mojo {

template <>
struct StructTraits<media::mojom::SupportedVideoDecoderConfigDataView,
                    media::SupportedVideoDecoderConfig> {
  static media::VideoCodecProfile profile_min(
      const media::SupportedVideoDecoderConfig& input) {
    return input.profile_min;
  }

  static media::VideoCodecProfile profile_max(
      const media::SupportedVideoDecoderConfig& input) {
    return input.profile_max;
  }

  static const gfx::Size& coded_size_min(
      const media::SupportedVideoDecoderConfig& input) {
    return input.coded_size_min;
  }

  static const gfx::Size& coded_size_max(
      const media::SupportedVideoDecoderConfig& input) {
    return input.coded_size_max;
  }

  static bool allow_encrypted(const media::SupportedVideoDecoderConfig& input) {
    return input.allow_encrypted;
  }

  static bool require_encrypted(
      const media::SupportedVideoDecoderConfig& input) {
    return input.require_encrypted;
  }

  static bool Read(media::mojom::SupportedVideoDecoderConfigDataView input,
                   media::SupportedVideoDecoderConfig* output);
};

}  // namespace mojo

#endif  // MEDIA_MOJO_MOJOM_SUPPORTED_VIDEO_DECODER_CONFIG_MOJOM_TRAITS_H_