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
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77

media / mojo / common / media_type_converters.h [blame]

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_MOJO_COMMON_MEDIA_TYPE_CONVERTERS_H_
#define MEDIA_MOJO_COMMON_MEDIA_TYPE_CONVERTERS_H_

#include <memory>
#include <optional>

#include "base/memory/scoped_refptr.h"
#include "media/mojo/mojom/content_decryption_module.mojom.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "mojo/public/cpp/bindings/type_converter.h"

namespace media {
class AudioBuffer;
class DecoderBuffer;
class DecryptConfig;
}  // namespace media

// These are specializations of mojo::TypeConverter and have to be in the mojo
// namespace.
namespace mojo {

template <>
struct TypeConverter<media::mojom::DecryptConfigPtr, media::DecryptConfig> {
  static media::mojom::DecryptConfigPtr Convert(
      const media::DecryptConfig& input);
};
template <>
struct TypeConverter<std::unique_ptr<media::DecryptConfig>,
                     media::mojom::DecryptConfigPtr> {
  static std::unique_ptr<media::DecryptConfig> Convert(
      const media::mojom::DecryptConfigPtr& input);
};

template <>
struct TypeConverter<media::mojom::DecoderBufferSideDataPtr,
                     media::DecoderBufferSideData> {
  static media::mojom::DecoderBufferSideDataPtr Convert(
      const media::DecoderBufferSideData& input);
};

template <>
struct TypeConverter<std::unique_ptr<media::DecoderBufferSideData>,
                     media::mojom::DecoderBufferSideDataPtr> {
  static std::unique_ptr<media::DecoderBufferSideData> Convert(
      const media::mojom::DecoderBufferSideDataPtr& input);
};

template <>
struct TypeConverter<media::mojom::DecoderBufferPtr, media::DecoderBuffer> {
  static media::mojom::DecoderBufferPtr Convert(
      const media::DecoderBuffer& input);
};
template <>
struct TypeConverter<scoped_refptr<media::DecoderBuffer>,
                     media::mojom::DecoderBufferPtr> {
  static scoped_refptr<media::DecoderBuffer> Convert(
      const media::mojom::DecoderBufferPtr& input);
};

template <>
struct TypeConverter<media::mojom::AudioBufferPtr, media::AudioBuffer> {
  static media::mojom::AudioBufferPtr Convert(const media::AudioBuffer& input);
};
template <>
struct TypeConverter<scoped_refptr<media::AudioBuffer>,
                     media::mojom::AudioBufferPtr> {
  static scoped_refptr<media::AudioBuffer> Convert(
      const media::mojom::AudioBufferPtr& input);
};

}  // namespace mojo

#endif  // MEDIA_MOJO_COMMON_MEDIA_TYPE_CONVERTERS_H_