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


#include "mozilla/dom/MediaIPCUtils.h"
#include "mozilla/RemoteMediaDataEncoderChild.h"
#include "mozilla/RemoteMediaDataEncoderParent.h"
#include "mozilla/PRemoteMediaManagerParent.h"
#include "mozilla/PRemoteMediaManagerChild.h"
#include "mozilla/PRemoteEncoder.h"
#include "mozilla/PRemoteEncoderParent.h"
#include "mozilla/PRemoteEncoderChild.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"

namespace mozilla {
namespace PRemoteEncoder {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::PRemoteEncoderParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::PRemoteEncoderChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_Construct(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Construct__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Construct(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Construct__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_Init(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Init__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Init(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Init__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_Encode(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Encode__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Encode(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Encode__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_Reconfigure(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Reconfigure__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Reconfigure(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Reconfigure__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_Drain(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Drain__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Drain(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Drain__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_ReleaseTicket(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_ReleaseTicket__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_Shutdown(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Shutdown__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Shutdown(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Shutdown__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_SetBitrate(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_SetBitrate__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_SetBitrate(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_SetBitrate__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg___delete____ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply___delete____ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}

} // namespace PRemoteEncoder
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union EncodedInputIPDL|
//
namespace mozilla {
auto EncodedInputIPDL::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TArrayOfRemoteAudioData:
        {
            (ptr_ArrayOfRemoteAudioData())->~ArrayOfRemoteAudioData__tdef();
            break;
        }
    case TArrayOfRemoteVideoData:
        {
            (ptr_ArrayOfRemoteVideoData())->~ArrayOfRemoteVideoData__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT EncodedInputIPDL::EncodedInputIPDL(ArrayOfRemoteAudioData* aOther)
{
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>(aOther);
    mType = TArrayOfRemoteAudioData;
}

MOZ_IMPLICIT EncodedInputIPDL::EncodedInputIPDL(RefPtr<ArrayOfRemoteAudioData>&& aOther)
{
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>(std::move(aOther));
    mType = TArrayOfRemoteAudioData;
}

MOZ_IMPLICIT EncodedInputIPDL::EncodedInputIPDL(ArrayOfRemoteVideoData* aOther)
{
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>(aOther);
    mType = TArrayOfRemoteVideoData;
}

MOZ_IMPLICIT EncodedInputIPDL::EncodedInputIPDL(RefPtr<ArrayOfRemoteVideoData>&& aOther)
{
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>(std::move(aOther));
    mType = TArrayOfRemoteVideoData;
}

MOZ_IMPLICIT EncodedInputIPDL::EncodedInputIPDL(const EncodedInputIPDL& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TArrayOfRemoteAudioData:
        {
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>((aOther).get_ArrayOfRemoteAudioData());
            break;
        }
    case TArrayOfRemoteVideoData:
        {
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>((aOther).get_ArrayOfRemoteVideoData());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT EncodedInputIPDL::EncodedInputIPDL(EncodedInputIPDL&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TArrayOfRemoteAudioData:
        {
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>(std::move((aOther).get_ArrayOfRemoteAudioData()));
            (aOther).MaybeDestroy();
            break;
        }
    case TArrayOfRemoteVideoData:
        {
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>(std::move((aOther).get_ArrayOfRemoteVideoData()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

EncodedInputIPDL::~EncodedInputIPDL()
{
    MaybeDestroy();
}

auto EncodedInputIPDL::operator=(ArrayOfRemoteAudioData* aRhs) -> EncodedInputIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>(aRhs);
    mType = TArrayOfRemoteAudioData;
    return (*(this));
}

auto EncodedInputIPDL::operator=(RefPtr<ArrayOfRemoteAudioData>&& aRhs) -> EncodedInputIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>(std::move(aRhs));
    mType = TArrayOfRemoteAudioData;
    return (*(this));
}

auto EncodedInputIPDL::operator=(ArrayOfRemoteVideoData* aRhs) -> EncodedInputIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>(aRhs);
    mType = TArrayOfRemoteVideoData;
    return (*(this));
}

auto EncodedInputIPDL::operator=(RefPtr<ArrayOfRemoteVideoData>&& aRhs) -> EncodedInputIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>(std::move(aRhs));
    mType = TArrayOfRemoteVideoData;
    return (*(this));
}

auto EncodedInputIPDL::operator=(const EncodedInputIPDL& aRhs) -> EncodedInputIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TArrayOfRemoteAudioData:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>((aRhs).get_ArrayOfRemoteAudioData());
            break;
        }
    case TArrayOfRemoteVideoData:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>((aRhs).get_ArrayOfRemoteVideoData());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto EncodedInputIPDL::operator=(EncodedInputIPDL&& aRhs) -> EncodedInputIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TArrayOfRemoteAudioData:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteAudioData()) RefPtr<ArrayOfRemoteAudioData>(std::move((aRhs).get_ArrayOfRemoteAudioData()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TArrayOfRemoteVideoData:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_ArrayOfRemoteVideoData()) RefPtr<ArrayOfRemoteVideoData>(std::move((aRhs).get_ArrayOfRemoteVideoData()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::EncodedInputIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::EncodedInputIPDL union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'EncodedInputIPDL'
    (aWriter)->WriteSentinel(868812268);

    switch (type) {
    case union__::TArrayOfRemoteAudioData:
        {
            IPC::WriteParam(aWriter, (aVar).get_ArrayOfRemoteAudioData());
            // Sentinel = 'TArrayOfRemoteAudioData'
            (aWriter)->WriteSentinel(1771571425);
            return;
        }
    case union__::TArrayOfRemoteVideoData:
        {
            IPC::WriteParam(aWriter, (aVar).get_ArrayOfRemoteVideoData());
            // Sentinel = 'TArrayOfRemoteVideoData'
            (aWriter)->WriteSentinel(1776093414);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union EncodedInputIPDL");
            return;
        }
    }
}

auto ParamTraits<::mozilla::EncodedInputIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::EncodedInputIPDL union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union EncodedInputIPDL");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'EncodedInputIPDL'
    if ((!((aReader)->ReadSentinel(868812268)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union EncodedInputIPDL");
        return {};
    }

    switch (type) {
    case union__::TArrayOfRemoteAudioData:
        {
            auto maybe__tmp = IPC::ReadParam<RefPtr<::mozilla::ArrayOfRemoteAudioData>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TArrayOfRemoteAudioData of union EncodedInputIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TArrayOfRemoteAudioData'
            if ((!((aReader)->ReadSentinel(1771571425)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TArrayOfRemoteAudioData of union EncodedInputIPDL");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TArrayOfRemoteVideoData:
        {
            auto maybe__tmp = IPC::ReadParam<RefPtr<::mozilla::ArrayOfRemoteVideoData>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TArrayOfRemoteVideoData of union EncodedInputIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TArrayOfRemoteVideoData'
            if ((!((aReader)->ReadSentinel(1776093414)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TArrayOfRemoteVideoData of union EncodedInputIPDL");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union EncodedInputIPDL");
            return {};
        }
    }
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::EncodeInitCompletionIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).description());
    // Sentinel = 'description'
    (aWriter)->WriteSentinel(461833381);
    IPC::WriteParam(aWriter, (aVar).hardware());
    // Sentinel = 'hardware'
    (aWriter)->WriteSentinel(248972111);
    IPC::WriteParam(aWriter, (aVar).hardwareReason());
    // Sentinel = 'hardwareReason'
    (aWriter)->WriteSentinel(717161911);
}

auto ParamTraits<::mozilla::EncodeInitCompletionIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___description = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___description) {
        aReader->FatalError("Error deserializing 'description' (nsCString) member of 'EncodeInitCompletionIPDL'");
        return {};

    }
    auto& _description = *maybe___description;
    // Sentinel = 'description'
    if ((!((aReader)->ReadSentinel(461833381)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'description' (nsCString) member of 'EncodeInitCompletionIPDL'");
        return {};
    }
    auto maybe___hardware = IPC::ReadParam<bool>(aReader);
    if (!maybe___hardware) {
        aReader->FatalError("Error deserializing 'hardware' (bool) member of 'EncodeInitCompletionIPDL'");
        return {};

    }
    auto& _hardware = *maybe___hardware;
    // Sentinel = 'hardware'
    if ((!((aReader)->ReadSentinel(248972111)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'hardware' (bool) member of 'EncodeInitCompletionIPDL'");
        return {};
    }
    auto maybe___hardwareReason = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___hardwareReason) {
        aReader->FatalError("Error deserializing 'hardwareReason' (nsCString) member of 'EncodeInitCompletionIPDL'");
        return {};

    }
    auto& _hardwareReason = *maybe___hardwareReason;
    // Sentinel = 'hardwareReason'
    if ((!((aReader)->ReadSentinel(717161911)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'hardwareReason' (nsCString) member of 'EncodeInitCompletionIPDL'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_description),
            std::move(_hardware),
            std::move(_hardwareReason)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union EncodeInitResultIPDL|
//
namespace mozilla {
auto EncodeInitResultIPDL::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TMediaResult:
        {
            (ptr_MediaResult())->~MediaResult__tdef();
            break;
        }
    case TEncodeInitCompletionIPDL:
        {
            (ptr_EncodeInitCompletionIPDL())->~EncodeInitCompletionIPDL__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT EncodeInitResultIPDL::EncodeInitResultIPDL(const MediaResult& aOther)
{
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(aOther);
    mType = TMediaResult;
}

MOZ_IMPLICIT EncodeInitResultIPDL::EncodeInitResultIPDL(MediaResult&& aOther)
{
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move(aOther));
    mType = TMediaResult;
}

MOZ_IMPLICIT EncodeInitResultIPDL::EncodeInitResultIPDL(const EncodeInitCompletionIPDL& aOther)
{
    new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL(aOther);
    mType = TEncodeInitCompletionIPDL;
}

MOZ_IMPLICIT EncodeInitResultIPDL::EncodeInitResultIPDL(EncodeInitCompletionIPDL&& aOther)
{
    new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL(std::move(aOther));
    mType = TEncodeInitCompletionIPDL;
}

MOZ_IMPLICIT EncodeInitResultIPDL::EncodeInitResultIPDL(const EncodeInitResultIPDL& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TMediaResult:
        {
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult((aOther).get_MediaResult());
            break;
        }
    case TEncodeInitCompletionIPDL:
        {
            new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL((aOther).get_EncodeInitCompletionIPDL());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT EncodeInitResultIPDL::EncodeInitResultIPDL(EncodeInitResultIPDL&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TMediaResult:
        {
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move((aOther).get_MediaResult()));
            (aOther).MaybeDestroy();
            break;
        }
    case TEncodeInitCompletionIPDL:
        {
            new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL(std::move((aOther).get_EncodeInitCompletionIPDL()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

EncodeInitResultIPDL::~EncodeInitResultIPDL()
{
    MaybeDestroy();
}

auto EncodeInitResultIPDL::operator=(const MediaResult& aRhs) -> EncodeInitResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(aRhs);
    mType = TMediaResult;
    return (*(this));
}

auto EncodeInitResultIPDL::operator=(MediaResult&& aRhs) -> EncodeInitResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move(aRhs));
    mType = TMediaResult;
    return (*(this));
}

auto EncodeInitResultIPDL::operator=(const EncodeInitCompletionIPDL& aRhs) -> EncodeInitResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL(aRhs);
    mType = TEncodeInitCompletionIPDL;
    return (*(this));
}

auto EncodeInitResultIPDL::operator=(EncodeInitCompletionIPDL&& aRhs) -> EncodeInitResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL(std::move(aRhs));
    mType = TEncodeInitCompletionIPDL;
    return (*(this));
}

auto EncodeInitResultIPDL::operator=(const EncodeInitResultIPDL& aRhs) -> EncodeInitResultIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TMediaResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult((aRhs).get_MediaResult());
            break;
        }
    case TEncodeInitCompletionIPDL:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL((aRhs).get_EncodeInitCompletionIPDL());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto EncodeInitResultIPDL::operator=(EncodeInitResultIPDL&& aRhs) -> EncodeInitResultIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TMediaResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move((aRhs).get_MediaResult()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TEncodeInitCompletionIPDL:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_EncodeInitCompletionIPDL()) EncodeInitCompletionIPDL(std::move((aRhs).get_EncodeInitCompletionIPDL()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::EncodeInitResultIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::EncodeInitResultIPDL union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'EncodeInitResultIPDL'
    (aWriter)->WriteSentinel(1356728203);

    switch (type) {
    case union__::TMediaResult:
        {
            IPC::WriteParam(aWriter, (aVar).get_MediaResult());
            // Sentinel = 'TMediaResult'
            (aWriter)->WriteSentinel(487326900);
            return;
        }
    case union__::TEncodeInitCompletionIPDL:
        {
            IPC::WriteParam(aWriter, (aVar).get_EncodeInitCompletionIPDL());
            // Sentinel = 'TEncodeInitCompletionIPDL'
            (aWriter)->WriteSentinel(2089027962);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union EncodeInitResultIPDL");
            return;
        }
    }
}

auto ParamTraits<::mozilla::EncodeInitResultIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::EncodeInitResultIPDL union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union EncodeInitResultIPDL");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'EncodeInitResultIPDL'
    if ((!((aReader)->ReadSentinel(1356728203)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union EncodeInitResultIPDL");
        return {};
    }

    switch (type) {
    case union__::TMediaResult:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::MediaResult>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TMediaResult of union EncodeInitResultIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TMediaResult'
            if ((!((aReader)->ReadSentinel(487326900)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TMediaResult of union EncodeInitResultIPDL");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TEncodeInitCompletionIPDL:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::EncodeInitCompletionIPDL>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TEncodeInitCompletionIPDL of union EncodeInitResultIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TEncodeInitCompletionIPDL'
            if ((!((aReader)->ReadSentinel(2089027962)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TEncodeInitCompletionIPDL of union EncodeInitResultIPDL");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union EncodeInitResultIPDL");
            return {};
        }
    }
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::EncodeCompletionIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).samples());
    // Sentinel = 'samples'
    (aWriter)->WriteSentinel(198443766);
    (aWriter)->WriteBytes((&((aVar).ticketId())), 4);
    // Sentinel = 'ticketId'
    (aWriter)->WriteSentinel(248906546);
}

auto ParamTraits<::mozilla::EncodeCompletionIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___samples = IPC::ReadParam<RefPtr<::mozilla::ArrayOfRemoteMediaRawData>>(aReader);
    if (!maybe___samples) {
        aReader->FatalError("Error deserializing 'samples' (ArrayOfRemoteMediaRawData) member of 'EncodeCompletionIPDL'");
        return {};

    }
    auto& _samples = *maybe___samples;
    // Sentinel = 'samples'
    if ((!((aReader)->ReadSentinel(198443766)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'samples' (ArrayOfRemoteMediaRawData) member of 'EncodeCompletionIPDL'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_samples),
            ::uint32_t{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->ticketId())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'ticketId'
    if ((!((aReader)->ReadSentinel(248906546)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union EncodeResultIPDL|
//
namespace mozilla {
auto EncodeResultIPDL::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TMediaResult:
        {
            (ptr_MediaResult())->~MediaResult__tdef();
            break;
        }
    case TEncodeCompletionIPDL:
        {
            (ptr_EncodeCompletionIPDL())->~EncodeCompletionIPDL__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT EncodeResultIPDL::EncodeResultIPDL(const MediaResult& aOther)
{
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(aOther);
    mType = TMediaResult;
}

MOZ_IMPLICIT EncodeResultIPDL::EncodeResultIPDL(MediaResult&& aOther)
{
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move(aOther));
    mType = TMediaResult;
}

MOZ_IMPLICIT EncodeResultIPDL::EncodeResultIPDL(const EncodeCompletionIPDL& aOther)
{
    new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL(aOther);
    mType = TEncodeCompletionIPDL;
}

MOZ_IMPLICIT EncodeResultIPDL::EncodeResultIPDL(EncodeCompletionIPDL&& aOther)
{
    new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL(std::move(aOther));
    mType = TEncodeCompletionIPDL;
}

MOZ_IMPLICIT EncodeResultIPDL::EncodeResultIPDL(const EncodeResultIPDL& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TMediaResult:
        {
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult((aOther).get_MediaResult());
            break;
        }
    case TEncodeCompletionIPDL:
        {
            new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL((aOther).get_EncodeCompletionIPDL());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT EncodeResultIPDL::EncodeResultIPDL(EncodeResultIPDL&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TMediaResult:
        {
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move((aOther).get_MediaResult()));
            (aOther).MaybeDestroy();
            break;
        }
    case TEncodeCompletionIPDL:
        {
            new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL(std::move((aOther).get_EncodeCompletionIPDL()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

EncodeResultIPDL::~EncodeResultIPDL()
{
    MaybeDestroy();
}

auto EncodeResultIPDL::operator=(const MediaResult& aRhs) -> EncodeResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(aRhs);
    mType = TMediaResult;
    return (*(this));
}

auto EncodeResultIPDL::operator=(MediaResult&& aRhs) -> EncodeResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move(aRhs));
    mType = TMediaResult;
    return (*(this));
}

auto EncodeResultIPDL::operator=(const EncodeCompletionIPDL& aRhs) -> EncodeResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL(aRhs);
    mType = TEncodeCompletionIPDL;
    return (*(this));
}

auto EncodeResultIPDL::operator=(EncodeCompletionIPDL&& aRhs) -> EncodeResultIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL(std::move(aRhs));
    mType = TEncodeCompletionIPDL;
    return (*(this));
}

auto EncodeResultIPDL::operator=(const EncodeResultIPDL& aRhs) -> EncodeResultIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TMediaResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult((aRhs).get_MediaResult());
            break;
        }
    case TEncodeCompletionIPDL:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL((aRhs).get_EncodeCompletionIPDL());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto EncodeResultIPDL::operator=(EncodeResultIPDL&& aRhs) -> EncodeResultIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TMediaResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_MediaResult()) MediaResult(std::move((aRhs).get_MediaResult()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TEncodeCompletionIPDL:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_EncodeCompletionIPDL()) EncodeCompletionIPDL(std::move((aRhs).get_EncodeCompletionIPDL()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::EncodeResultIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::EncodeResultIPDL union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'EncodeResultIPDL'
    (aWriter)->WriteSentinel(874907127);

    switch (type) {
    case union__::TMediaResult:
        {
            IPC::WriteParam(aWriter, (aVar).get_MediaResult());
            // Sentinel = 'TMediaResult'
            (aWriter)->WriteSentinel(487326900);
            return;
        }
    case union__::TEncodeCompletionIPDL:
        {
            IPC::WriteParam(aWriter, (aVar).get_EncodeCompletionIPDL());
            // Sentinel = 'TEncodeCompletionIPDL'
            (aWriter)->WriteSentinel(1479280614);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union EncodeResultIPDL");
            return;
        }
    }
}

auto ParamTraits<::mozilla::EncodeResultIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::EncodeResultIPDL union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union EncodeResultIPDL");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'EncodeResultIPDL'
    if ((!((aReader)->ReadSentinel(874907127)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union EncodeResultIPDL");
        return {};
    }

    switch (type) {
    case union__::TMediaResult:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::MediaResult>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TMediaResult of union EncodeResultIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TMediaResult'
            if ((!((aReader)->ReadSentinel(487326900)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TMediaResult of union EncodeResultIPDL");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TEncodeCompletionIPDL:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::EncodeCompletionIPDL>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TEncodeCompletionIPDL of union EncodeResultIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TEncodeCompletionIPDL'
            if ((!((aReader)->ReadSentinel(1479280614)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TEncodeCompletionIPDL of union EncodeResultIPDL");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union EncodeResultIPDL");
            return {};
        }
    }
}

} // namespace IPC
