// components/media_gallery_util/public/mojom/media_parser.mojom-data-view.h is auto generated by mojom_bindings_generator.py, do not edit

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

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef COMPONENTS_MEDIA_GALLERY_UTIL_PUBLIC_MOJOM_MEDIA_PARSER_MOJOM_DATA_VIEW_H_
#define COMPONENTS_MEDIA_GALLERY_UTIL_PUBLIC_MOJOM_MEDIA_PARSER_MOJOM_DATA_VIEW_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "components/media_gallery_util/public/mojom/media_parser.mojom-shared-internal.h"
#include "media/mojo/mojom/media_types.mojom-shared.h"
#include "mojo/public/mojom/base/file.mojom-shared.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"
#include "mojo/public/mojom/base/values.mojom-shared.h"
#include "sandbox/policy/mojom/sandbox.mojom-shared.h"


namespace chrome::mojom {
class ExtractVideoFrameResultDataView;

class MediaStreamInfoDataView;

class MediaMetadataDataView;

class AttachedImageDataView;

class VideoFrameDataDataView;


}  // chrome::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::chrome::mojom::ExtractVideoFrameResultDataView> {
  using Data = ::chrome::mojom::internal::ExtractVideoFrameResult_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::chrome::mojom::MediaStreamInfoDataView> {
  using Data = ::chrome::mojom::internal::MediaStreamInfo_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::chrome::mojom::MediaMetadataDataView> {
  using Data = ::chrome::mojom::internal::MediaMetadata_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::chrome::mojom::AttachedImageDataView> {
  using Data = ::chrome::mojom::internal::AttachedImage_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::chrome::mojom::VideoFrameDataDataView> {
  using Data = ::chrome::mojom::internal::VideoFrameData_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

}  // namespace internal
}  // namespace mojo


namespace chrome::mojom {
// Interface base classes. They are used for type safety check.
class MediaParserInterfaceBase {};

using MediaParserPtrDataView =
    mojo::InterfacePtrDataView<MediaParserInterfaceBase>;
using MediaParserRequestDataView =
    mojo::InterfaceRequestDataView<MediaParserInterfaceBase>;
using MediaParserAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<MediaParserInterfaceBase>;
using MediaParserAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<MediaParserInterfaceBase>;
class MediaParserFactoryInterfaceBase {};

using MediaParserFactoryPtrDataView =
    mojo::InterfacePtrDataView<MediaParserFactoryInterfaceBase>;
using MediaParserFactoryRequestDataView =
    mojo::InterfaceRequestDataView<MediaParserFactoryInterfaceBase>;
using MediaParserFactoryAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<MediaParserFactoryInterfaceBase>;
using MediaParserFactoryAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<MediaParserFactoryInterfaceBase>;
class MediaDataSourceInterfaceBase {};

using MediaDataSourcePtrDataView =
    mojo::InterfacePtrDataView<MediaDataSourceInterfaceBase>;
using MediaDataSourceRequestDataView =
    mojo::InterfaceRequestDataView<MediaDataSourceInterfaceBase>;
using MediaDataSourceAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<MediaDataSourceInterfaceBase>;
using MediaDataSourceAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<MediaDataSourceInterfaceBase>;


class ExtractVideoFrameResultDataView {
 public:
  ExtractVideoFrameResultDataView() = default;

  ExtractVideoFrameResultDataView(
      internal::ExtractVideoFrameResult_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetFrameDataDataView(
      VideoFrameDataDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadFrameData(UserType* output) {
    
    auto* pointer = !data_->frame_data.is_null() ? &data_->frame_data : nullptr;
    return mojo::internal::Deserialize<::chrome::mojom::VideoFrameDataDataView>(
        pointer, output, message_);
  }
  inline void GetConfigDataView(
      ::media::mojom::VideoDecoderConfigDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadConfig(UserType* output) {
    
    auto* pointer = data_->config.Get();
    return mojo::internal::Deserialize<::media::mojom::VideoDecoderConfigDataView>(
        pointer, output, message_);
  }
 private:
  internal::ExtractVideoFrameResult_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class MediaStreamInfoDataView {
 public:
  MediaStreamInfoDataView() = default;

  MediaStreamInfoDataView(
      internal::MediaStreamInfo_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetTypeDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadType(UserType* output) {
    
    auto* pointer = data_->type.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetAdditionalPropertiesDataView(
      ::mojo_base::mojom::DictionaryValueDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadAdditionalProperties(UserType* output) {
    
    auto* pointer = data_->additional_properties.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::DictionaryValueDataView>(
        pointer, output, message_);
  }
 private:
  internal::MediaStreamInfo_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class MediaMetadataDataView {
 public:
  MediaMetadataDataView() = default;

  MediaMetadataDataView(
      internal::MediaMetadata_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetMimeTypeDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadMimeType(UserType* output) {
    
    auto* pointer = data_->mime_type.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  int32_t height() const {
    return data_->height;
  }
  int32_t width() const {
    return data_->width;
  }
  double duration() const {
    return data_->duration;
  }
  int32_t rotation() const {
    return data_->rotation;
  }
  inline void GetAlbumDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadAlbum(UserType* output) {
    
    auto* pointer = data_->album.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetArtistDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadArtist(UserType* output) {
    
    auto* pointer = data_->artist.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetCommentDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadComment(UserType* output) {
    
    auto* pointer = data_->comment.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetCopyrightDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadCopyright(UserType* output) {
    
    auto* pointer = data_->copyright.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  int32_t disc() const {
    return data_->disc;
  }
  inline void GetGenreDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadGenre(UserType* output) {
    
    auto* pointer = data_->genre.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetLanguageDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadLanguage(UserType* output) {
    
    auto* pointer = data_->language.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetTitleDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadTitle(UserType* output) {
    
    auto* pointer = data_->title.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  int32_t track() const {
    return data_->track;
  }
  inline void GetRawTagsDataView(
      mojo::ArrayDataView<MediaStreamInfoDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadRawTags(UserType* output) {
    
    auto* pointer = data_->raw_tags.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::chrome::mojom::MediaStreamInfoDataView>>(
        pointer, output, message_);
  }
 private:
  internal::MediaMetadata_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class AttachedImageDataView {
 public:
  AttachedImageDataView() = default;

  AttachedImageDataView(
      internal::AttachedImage_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetTypeDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadType(UserType* output) {
    
    auto* pointer = data_->type.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetDataDataView(
      mojo::ArrayDataView<uint8_t>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadData(UserType* output) {
    
    auto* pointer = data_->data.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>(
        pointer, output, message_);
  }
 private:
  internal::AttachedImage_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class VideoFrameDataDataView {
 public:
  using Tag = internal::VideoFrameData_Data::VideoFrameData_Tag;

  VideoFrameDataDataView() = default;

  VideoFrameDataDataView(
      internal::VideoFrameData_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const {
    // For inlined unions, |data_| is always non-null. In that case we need to
    // check |data_->is_null()|.
    return !data_ || data_->is_null();
  }

  Tag tag() const { return data_->tag; }
  bool is_encoded_data() const { return data_->tag == Tag::kEncodedData; }
  inline void GetEncodedDataDataView(
      mojo::ArrayDataView<uint8_t>* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadEncodedData(UserType* output) const {
    
    CHECK(is_encoded_data());
    return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>(
        data_->data.f_encoded_data.Get(), output, message_);
  }
  bool is_decoded_frame() const { return data_->tag == Tag::kDecodedFrame; }
  inline void GetDecodedFrameDataView(
      ::media::mojom::VideoFrameDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadDecodedFrame(UserType* output) const {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::media::mojom::VideoFrameDataView, UserType>(),
    "Attempting to read the optional `decoded_frame` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadDecodedFrame` instead "
    "of `ReadDecodedFrame if you're fine with null values being "
    "silently ignored in this case.");
    CHECK(is_decoded_frame());
    return mojo::internal::Deserialize<::media::mojom::VideoFrameDataView>(
        data_->data.f_decoded_frame.Get(), output, message_);
  }

 private:
  internal::VideoFrameData_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};



}  // chrome::mojom

#endif  // COMPONENTS_MEDIA_GALLERY_UTIL_PUBLIC_MOJOM_MEDIA_PARSER_MOJOM_DATA_VIEW_H_