//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/dom/MediaIPCUtils.h"
#include "mozilla/PMediaDecoderParams.h"

#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"


//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct MediaDataIPDL|
//
namespace mozilla {
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::MediaDataIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).time());
    // Sentinel = 'time'
    (aWriter)->WriteSentinel(72221104);
    IPC::WriteParam(aWriter, (aVar).timecode());
    // Sentinel = 'timecode'
    (aWriter)->WriteSentinel(252969803);
    IPC::WriteParam(aWriter, (aVar).duration());
    // Sentinel = 'duration'
    (aWriter)->WriteSentinel(256050023);
    IPC::WriteParam(aWriter, (aVar).keyframe());
    // Sentinel = 'keyframe'
    (aWriter)->WriteSentinel(253821781);
    (aWriter)->WriteBytes((&((aVar).offset())), 8);
    // Sentinel = 'offset'
    (aWriter)->WriteSentinel(147653256);
}

auto ParamTraits<::mozilla::MediaDataIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___time = IPC::ReadParam<::mozilla::media::TimeUnit>(aReader);
    if (!maybe___time) {
        aReader->FatalError("Error deserializing 'time' (TimeUnit) member of 'MediaDataIPDL'");
        return {};

    }
    auto& _time = *maybe___time;
    // Sentinel = 'time'
    if ((!((aReader)->ReadSentinel(72221104)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'time' (TimeUnit) member of 'MediaDataIPDL'");
        return {};
    }
    auto maybe___timecode = IPC::ReadParam<::mozilla::media::TimeUnit>(aReader);
    if (!maybe___timecode) {
        aReader->FatalError("Error deserializing 'timecode' (TimeUnit) member of 'MediaDataIPDL'");
        return {};

    }
    auto& _timecode = *maybe___timecode;
    // Sentinel = 'timecode'
    if ((!((aReader)->ReadSentinel(252969803)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'timecode' (TimeUnit) member of 'MediaDataIPDL'");
        return {};
    }
    auto maybe___duration = IPC::ReadParam<::mozilla::media::TimeUnit>(aReader);
    if (!maybe___duration) {
        aReader->FatalError("Error deserializing 'duration' (TimeUnit) member of 'MediaDataIPDL'");
        return {};

    }
    auto& _duration = *maybe___duration;
    // Sentinel = 'duration'
    if ((!((aReader)->ReadSentinel(256050023)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'duration' (TimeUnit) member of 'MediaDataIPDL'");
        return {};
    }
    auto maybe___keyframe = IPC::ReadParam<bool>(aReader);
    if (!maybe___keyframe) {
        aReader->FatalError("Error deserializing 'keyframe' (bool) member of 'MediaDataIPDL'");
        return {};

    }
    auto& _keyframe = *maybe___keyframe;
    // Sentinel = 'keyframe'
    if ((!((aReader)->ReadSentinel(253821781)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'keyframe' (bool) member of 'MediaDataIPDL'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::int64_t{0},
            std::move(_time),
            std::move(_timecode),
            std::move(_duration),
            std::move(_keyframe)};
    if ((!((aReader)->ReadBytesInto((&((result__)->offset())), 8)))) {
        aReader->FatalError("Error bulk reading fields from int64_t");
        return {};
    }
    // Sentinel = 'offset'
    if ((!((aReader)->ReadSentinel(147653256)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from int64_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct CryptoInfo|
//
namespace mozilla {
auto CryptoInfo::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(CryptoInfo, mSkipByteBlock_) - offsetof(CryptoInfo, mCryptByteBlock_)) == 1,
        "Bad assumptions about field layout!");
}

} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::CryptoInfo>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).mEncryptionScheme());
    // Sentinel = 'mEncryptionScheme'
    (aWriter)->WriteSentinel(1046611694);
    IPC::WriteParam(aWriter, (aVar).mIV());
    // Sentinel = 'mIV'
    (aWriter)->WriteSentinel(36831501);
    IPC::WriteParam(aWriter, (aVar).mConstantIV());
    // Sentinel = 'mConstantIV'
    (aWriter)->WriteSentinel(443352151);
    IPC::WriteParam(aWriter, (aVar).mKeyId());
    // Sentinel = 'mKeyId'
    (aWriter)->WriteSentinel(134218308);
    IPC::WriteParam(aWriter, (aVar).mClearBytes());
    // Sentinel = 'mClearBytes'
    (aWriter)->WriteSentinel(426116188);
    IPC::WriteParam(aWriter, (aVar).mCipherBytes());
    // Sentinel = 'mCipherBytes'
    (aWriter)->WriteSentinel(512296144);
    (aWriter)->WriteBytes((&((aVar).mCryptByteBlock())), 2);
    // Sentinel = 'mCryptByteBlock | mSkipByteBlock'
    (aWriter)->WriteSentinel(3404008510);
}

auto ParamTraits<::mozilla::CryptoInfo>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___mEncryptionScheme = IPC::ReadParam<::mozilla::CryptoScheme>(aReader);
    if (!maybe___mEncryptionScheme) {
        aReader->FatalError("Error deserializing 'mEncryptionScheme' (CryptoScheme) member of 'CryptoInfo'");
        return {};

    }
    auto& _mEncryptionScheme = *maybe___mEncryptionScheme;
    // Sentinel = 'mEncryptionScheme'
    if ((!((aReader)->ReadSentinel(1046611694)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'mEncryptionScheme' (CryptoScheme) member of 'CryptoInfo'");
        return {};
    }
    auto maybe___mIV = IPC::ReadParam<nsTArray<::uint8_t>>(aReader);
    if (!maybe___mIV) {
        aReader->FatalError("Error deserializing 'mIV' (uint8_t[]) member of 'CryptoInfo'");
        return {};

    }
    auto& _mIV = *maybe___mIV;
    // Sentinel = 'mIV'
    if ((!((aReader)->ReadSentinel(36831501)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'mIV' (uint8_t[]) member of 'CryptoInfo'");
        return {};
    }
    auto maybe___mConstantIV = IPC::ReadParam<nsTArray<::uint8_t>>(aReader);
    if (!maybe___mConstantIV) {
        aReader->FatalError("Error deserializing 'mConstantIV' (uint8_t[]) member of 'CryptoInfo'");
        return {};

    }
    auto& _mConstantIV = *maybe___mConstantIV;
    // Sentinel = 'mConstantIV'
    if ((!((aReader)->ReadSentinel(443352151)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'mConstantIV' (uint8_t[]) member of 'CryptoInfo'");
        return {};
    }
    auto maybe___mKeyId = IPC::ReadParam<nsTArray<::uint8_t>>(aReader);
    if (!maybe___mKeyId) {
        aReader->FatalError("Error deserializing 'mKeyId' (uint8_t[]) member of 'CryptoInfo'");
        return {};

    }
    auto& _mKeyId = *maybe___mKeyId;
    // Sentinel = 'mKeyId'
    if ((!((aReader)->ReadSentinel(134218308)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'mKeyId' (uint8_t[]) member of 'CryptoInfo'");
        return {};
    }
    auto maybe___mClearBytes = IPC::ReadParam<nsTArray<::uint32_t>>(aReader);
    if (!maybe___mClearBytes) {
        aReader->FatalError("Error deserializing 'mClearBytes' (uint32_t[]) member of 'CryptoInfo'");
        return {};

    }
    auto& _mClearBytes = *maybe___mClearBytes;
    // Sentinel = 'mClearBytes'
    if ((!((aReader)->ReadSentinel(426116188)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'mClearBytes' (uint32_t[]) member of 'CryptoInfo'");
        return {};
    }
    auto maybe___mCipherBytes = IPC::ReadParam<nsTArray<::uint32_t>>(aReader);
    if (!maybe___mCipherBytes) {
        aReader->FatalError("Error deserializing 'mCipherBytes' (uint32_t[]) member of 'CryptoInfo'");
        return {};

    }
    auto& _mCipherBytes = *maybe___mCipherBytes;
    // Sentinel = 'mCipherBytes'
    if ((!((aReader)->ReadSentinel(512296144)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'mCipherBytes' (uint32_t[]) member of 'CryptoInfo'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_mEncryptionScheme),
            std::move(_mIV),
            std::move(_mConstantIV),
            std::move(_mKeyId),
            std::move(_mClearBytes),
            std::move(_mCipherBytes),
            ::uint8_t{0},
            ::uint8_t{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->mCryptByteBlock())), 2)))) {
        aReader->FatalError("Error bulk reading fields from uint8_t");
        return {};
    }
    // Sentinel = 'mCryptByteBlock | mSkipByteBlock'
    if ((!((aReader)->ReadSentinel(3404008510)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint8_t");
        return {};
    }
    return result__;
}

} // namespace IPC
