// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.9

#include "pybase.h"
#include "py.Windows.Media.Editing.h"


namespace py::cpp::Windows::Media::Editing
{
    struct module_state
    {
        PyObject* type_MediaTrimmingPreference;
        PyObject* type_VideoFramePrecision;
        PyTypeObject* type_BackgroundAudioTrack;
        PyTypeObject* type_EmbeddedAudioTrack;
        PyTypeObject* type_MediaClip;
        PyTypeObject* type_MediaComposition;
        PyTypeObject* type_MediaOverlay;
        PyTypeObject* type_MediaOverlayLayer;
    };

    static PyObject* register_MediaTrimmingPreference(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_MediaTrimmingPreference)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_MediaTrimmingPreference = type;
        Py_INCREF(state->type_MediaTrimmingPreference);


        Py_RETURN_NONE;
    }

    static PyObject* register_VideoFramePrecision(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_VideoFramePrecision)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_VideoFramePrecision = type;
        Py_INCREF(state->type_VideoFramePrecision);


        Py_RETURN_NONE;
    }

    // ----- BackgroundAudioTrack class --------------------
    static constexpr const char* const type_name_BackgroundAudioTrack = "BackgroundAudioTrack";

    static PyObject* _new_BackgroundAudioTrack(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_BackgroundAudioTrack);
        return nullptr;
    }

    static void _dealloc_BackgroundAudioTrack(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* BackgroundAudioTrack_Clone(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"Clone", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.Clone());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* BackgroundAudioTrack_CreateFromEmbeddedAudioTrack(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"CreateFromEmbeddedAudioTrack", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Media::Editing::EmbeddedAudioTrack>(args, 0);

                return py::convert(winrt::Windows::Media::Editing::BackgroundAudioTrack::CreateFromEmbeddedAudioTrack(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* BackgroundAudioTrack_CreateFromFileAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"CreateFromFileAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageFile>(args, 0);

                return py::convert(winrt::Windows::Media::Editing::BackgroundAudioTrack::CreateFromFileAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* BackgroundAudioTrack_GetAudioEncodingProperties(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"GetAudioEncodingProperties", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.GetAudioEncodingProperties());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* BackgroundAudioTrack_get_Volume(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"Volume"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Volume());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int BackgroundAudioTrack_put_Volume(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"Volume"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<double>(arg);

            self->obj.Volume(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* BackgroundAudioTrack_get_TrimTimeFromStart(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"TrimTimeFromStart"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.TrimTimeFromStart());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int BackgroundAudioTrack_put_TrimTimeFromStart(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"TrimTimeFromStart"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(arg);

            self->obj.TrimTimeFromStart(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* BackgroundAudioTrack_get_TrimTimeFromEnd(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"TrimTimeFromEnd"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.TrimTimeFromEnd());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int BackgroundAudioTrack_put_TrimTimeFromEnd(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"TrimTimeFromEnd"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(arg);

            self->obj.TrimTimeFromEnd(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* BackgroundAudioTrack_get_Delay(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"Delay"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Delay());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int BackgroundAudioTrack_put_Delay(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"Delay"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(arg);

            self->obj.Delay(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* BackgroundAudioTrack_get_AudioEffectDefinitions(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"AudioEffectDefinitions"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.AudioEffectDefinitions());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* BackgroundAudioTrack_get_OriginalDuration(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"OriginalDuration"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.OriginalDuration());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* BackgroundAudioTrack_get_TrimmedDuration(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"TrimmedDuration"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.TrimmedDuration());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* BackgroundAudioTrack_get_UserData(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.BackgroundAudioTrack", L"UserData"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.UserData());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_BackgroundAudioTrack(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::Editing::BackgroundAudioTrack>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_BackgroundAudioTrack(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::Editing::BackgroundAudioTrack>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_BackgroundAudioTrack[] = {
        { "clone", reinterpret_cast<PyCFunction>(BackgroundAudioTrack_Clone), METH_VARARGS, nullptr },
        { "create_from_embedded_audio_track", reinterpret_cast<PyCFunction>(BackgroundAudioTrack_CreateFromEmbeddedAudioTrack), METH_VARARGS | METH_STATIC, nullptr },
        { "create_from_file_async", reinterpret_cast<PyCFunction>(BackgroundAudioTrack_CreateFromFileAsync), METH_VARARGS | METH_STATIC, nullptr },
        { "get_audio_encoding_properties", reinterpret_cast<PyCFunction>(BackgroundAudioTrack_GetAudioEncodingProperties), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_BackgroundAudioTrack, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_BackgroundAudioTrack), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_BackgroundAudioTrack[] = {
        { "volume", reinterpret_cast<getter>(BackgroundAudioTrack_get_Volume), reinterpret_cast<setter>(BackgroundAudioTrack_put_Volume), nullptr, nullptr },
        { "trim_time_from_start", reinterpret_cast<getter>(BackgroundAudioTrack_get_TrimTimeFromStart), reinterpret_cast<setter>(BackgroundAudioTrack_put_TrimTimeFromStart), nullptr, nullptr },
        { "trim_time_from_end", reinterpret_cast<getter>(BackgroundAudioTrack_get_TrimTimeFromEnd), reinterpret_cast<setter>(BackgroundAudioTrack_put_TrimTimeFromEnd), nullptr, nullptr },
        { "delay", reinterpret_cast<getter>(BackgroundAudioTrack_get_Delay), reinterpret_cast<setter>(BackgroundAudioTrack_put_Delay), nullptr, nullptr },
        { "audio_effect_definitions", reinterpret_cast<getter>(BackgroundAudioTrack_get_AudioEffectDefinitions), nullptr, nullptr, nullptr },
        { "original_duration", reinterpret_cast<getter>(BackgroundAudioTrack_get_OriginalDuration), nullptr, nullptr, nullptr },
        { "trimmed_duration", reinterpret_cast<getter>(BackgroundAudioTrack_get_TrimmedDuration), nullptr, nullptr, nullptr },
        { "user_data", reinterpret_cast<getter>(BackgroundAudioTrack_get_UserData), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_BackgroundAudioTrack[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_BackgroundAudioTrack) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_BackgroundAudioTrack) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_BackgroundAudioTrack) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_BackgroundAudioTrack) },
        { },
    };

    static PyType_Spec type_spec_BackgroundAudioTrack =
    {
        "_winsdk_Windows_Media_Editing.BackgroundAudioTrack",
        sizeof(py::wrapper::Windows::Media::Editing::BackgroundAudioTrack),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_BackgroundAudioTrack
    };

    // ----- EmbeddedAudioTrack class --------------------
    static constexpr const char* const type_name_EmbeddedAudioTrack = "EmbeddedAudioTrack";

    static PyObject* _new_EmbeddedAudioTrack(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_EmbeddedAudioTrack);
        return nullptr;
    }

    static void _dealloc_EmbeddedAudioTrack(py::wrapper::Windows::Media::Editing::EmbeddedAudioTrack* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* EmbeddedAudioTrack_GetAudioEncodingProperties(py::wrapper::Windows::Media::Editing::EmbeddedAudioTrack* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.EmbeddedAudioTrack", L"GetAudioEncodingProperties", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.GetAudioEncodingProperties());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_EmbeddedAudioTrack(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::Editing::EmbeddedAudioTrack>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_EmbeddedAudioTrack(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::Editing::EmbeddedAudioTrack>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_EmbeddedAudioTrack[] = {
        { "get_audio_encoding_properties", reinterpret_cast<PyCFunction>(EmbeddedAudioTrack_GetAudioEncodingProperties), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_EmbeddedAudioTrack, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_EmbeddedAudioTrack), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_EmbeddedAudioTrack[] = {
        { }
    };

    static PyType_Slot _type_slots_EmbeddedAudioTrack[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_EmbeddedAudioTrack) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_EmbeddedAudioTrack) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_EmbeddedAudioTrack) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_EmbeddedAudioTrack) },
        { },
    };

    static PyType_Spec type_spec_EmbeddedAudioTrack =
    {
        "_winsdk_Windows_Media_Editing.EmbeddedAudioTrack",
        sizeof(py::wrapper::Windows::Media::Editing::EmbeddedAudioTrack),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_EmbeddedAudioTrack
    };

    // ----- MediaClip class --------------------
    static constexpr const char* const type_name_MediaClip = "MediaClip";

    static PyObject* _new_MediaClip(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_MediaClip);
        return nullptr;
    }

    static void _dealloc_MediaClip(py::wrapper::Windows::Media::Editing::MediaClip* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* MediaClip_Clone(py::wrapper::Windows::Media::Editing::MediaClip* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaClip", L"Clone", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.Clone());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaClip_CreateFromColor(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaClip", L"CreateFromColor", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Color>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(args, 1);

                return py::convert(winrt::Windows::Media::Editing::MediaClip::CreateFromColor(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaClip_CreateFromFileAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaClip", L"CreateFromFileAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageFile>(args, 0);

                return py::convert(winrt::Windows::Media::Editing::MediaClip::CreateFromFileAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaClip_CreateFromImageFileAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaClip", L"CreateFromImageFileAsync", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageFile>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(args, 1);

                return py::convert(winrt::Windows::Media::Editing::MediaClip::CreateFromImageFileAsync(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaClip_CreateFromSurface(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaClip", L"CreateFromSurface", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(args, 1);

                return py::convert(winrt::Windows::Media::Editing::MediaClip::CreateFromSurface(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaClip_GetVideoEncodingProperties(py::wrapper::Windows::Media::Editing::MediaClip* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaClip", L"GetVideoEncodingProperties", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.GetVideoEncodingProperties());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_SelectedEmbeddedAudioTrackIndex(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"SelectedEmbeddedAudioTrackIndex"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.SelectedEmbeddedAudioTrackIndex());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaClip_put_SelectedEmbeddedAudioTrackIndex(py::wrapper::Windows::Media::Editing::MediaClip* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"SelectedEmbeddedAudioTrackIndex"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<uint32_t>(arg);

            self->obj.SelectedEmbeddedAudioTrackIndex(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaClip_get_TrimTimeFromEnd(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"TrimTimeFromEnd"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.TrimTimeFromEnd());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaClip_put_TrimTimeFromEnd(py::wrapper::Windows::Media::Editing::MediaClip* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"TrimTimeFromEnd"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(arg);

            self->obj.TrimTimeFromEnd(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaClip_get_Volume(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"Volume"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Volume());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaClip_put_Volume(py::wrapper::Windows::Media::Editing::MediaClip* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"Volume"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<double>(arg);

            self->obj.Volume(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaClip_get_TrimTimeFromStart(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"TrimTimeFromStart"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.TrimTimeFromStart());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaClip_put_TrimTimeFromStart(py::wrapper::Windows::Media::Editing::MediaClip* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"TrimTimeFromStart"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(arg);

            self->obj.TrimTimeFromStart(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaClip_get_EmbeddedAudioTracks(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"EmbeddedAudioTracks"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.EmbeddedAudioTracks());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_EndTimeInComposition(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"EndTimeInComposition"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.EndTimeInComposition());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_OriginalDuration(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"OriginalDuration"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.OriginalDuration());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_StartTimeInComposition(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"StartTimeInComposition"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.StartTimeInComposition());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_TrimmedDuration(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"TrimmedDuration"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.TrimmedDuration());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_UserData(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"UserData"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.UserData());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_VideoEffectDefinitions(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"VideoEffectDefinitions"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.VideoEffectDefinitions());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaClip_get_AudioEffectDefinitions(py::wrapper::Windows::Media::Editing::MediaClip* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaClip", L"AudioEffectDefinitions"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.AudioEffectDefinitions());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_MediaClip(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::Editing::MediaClip>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_MediaClip(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::Editing::MediaClip>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_MediaClip[] = {
        { "clone", reinterpret_cast<PyCFunction>(MediaClip_Clone), METH_VARARGS, nullptr },
        { "create_from_color", reinterpret_cast<PyCFunction>(MediaClip_CreateFromColor), METH_VARARGS | METH_STATIC, nullptr },
        { "create_from_file_async", reinterpret_cast<PyCFunction>(MediaClip_CreateFromFileAsync), METH_VARARGS | METH_STATIC, nullptr },
        { "create_from_image_file_async", reinterpret_cast<PyCFunction>(MediaClip_CreateFromImageFileAsync), METH_VARARGS | METH_STATIC, nullptr },
        { "create_from_surface", reinterpret_cast<PyCFunction>(MediaClip_CreateFromSurface), METH_VARARGS | METH_STATIC, nullptr },
        { "get_video_encoding_properties", reinterpret_cast<PyCFunction>(MediaClip_GetVideoEncodingProperties), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_MediaClip, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_MediaClip), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_MediaClip[] = {
        { "selected_embedded_audio_track_index", reinterpret_cast<getter>(MediaClip_get_SelectedEmbeddedAudioTrackIndex), reinterpret_cast<setter>(MediaClip_put_SelectedEmbeddedAudioTrackIndex), nullptr, nullptr },
        { "trim_time_from_end", reinterpret_cast<getter>(MediaClip_get_TrimTimeFromEnd), reinterpret_cast<setter>(MediaClip_put_TrimTimeFromEnd), nullptr, nullptr },
        { "volume", reinterpret_cast<getter>(MediaClip_get_Volume), reinterpret_cast<setter>(MediaClip_put_Volume), nullptr, nullptr },
        { "trim_time_from_start", reinterpret_cast<getter>(MediaClip_get_TrimTimeFromStart), reinterpret_cast<setter>(MediaClip_put_TrimTimeFromStart), nullptr, nullptr },
        { "embedded_audio_tracks", reinterpret_cast<getter>(MediaClip_get_EmbeddedAudioTracks), nullptr, nullptr, nullptr },
        { "end_time_in_composition", reinterpret_cast<getter>(MediaClip_get_EndTimeInComposition), nullptr, nullptr, nullptr },
        { "original_duration", reinterpret_cast<getter>(MediaClip_get_OriginalDuration), nullptr, nullptr, nullptr },
        { "start_time_in_composition", reinterpret_cast<getter>(MediaClip_get_StartTimeInComposition), nullptr, nullptr, nullptr },
        { "trimmed_duration", reinterpret_cast<getter>(MediaClip_get_TrimmedDuration), nullptr, nullptr, nullptr },
        { "user_data", reinterpret_cast<getter>(MediaClip_get_UserData), nullptr, nullptr, nullptr },
        { "video_effect_definitions", reinterpret_cast<getter>(MediaClip_get_VideoEffectDefinitions), nullptr, nullptr, nullptr },
        { "audio_effect_definitions", reinterpret_cast<getter>(MediaClip_get_AudioEffectDefinitions), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_MediaClip[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_MediaClip) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_MediaClip) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_MediaClip) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_MediaClip) },
        { },
    };

    static PyType_Spec type_spec_MediaClip =
    {
        "_winsdk_Windows_Media_Editing.MediaClip",
        sizeof(py::wrapper::Windows::Media::Editing::MediaClip),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_MediaClip
    };

    // ----- MediaComposition class --------------------
    static constexpr const char* const type_name_MediaComposition = "MediaComposition";

    static PyObject* _new_MediaComposition(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds != nullptr)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Windows::Media::Editing::MediaComposition instance{  };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_MediaComposition(py::wrapper::Windows::Media::Editing::MediaComposition* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* MediaComposition_Clone(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"Clone", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.Clone());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_CreateDefaultEncodingProfile(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"CreateDefaultEncodingProfile", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.CreateDefaultEncodingProfile());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_GenerateMediaStreamSource(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"GenerateMediaStreamSource", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.GenerateMediaStreamSource());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"GenerateMediaStreamSource", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Media::MediaProperties::MediaEncodingProfile>(args, 0);

                return py::convert(self->obj.GenerateMediaStreamSource(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_GeneratePreviewMediaStreamSource(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"GeneratePreviewMediaStreamSource", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);
                auto param1 = py::convert_to<int32_t>(args, 1);

                return py::convert(self->obj.GeneratePreviewMediaStreamSource(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_GetThumbnailAsync(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 4)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"GetThumbnailAsync", 4))
            {
                py::set_arg_count_version_error(4);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(args, 0);
                auto param1 = py::convert_to<int32_t>(args, 1);
                auto param2 = py::convert_to<int32_t>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Media::Editing::VideoFramePrecision>(args, 3);

                return py::convert(self->obj.GetThumbnailAsync(param0, param1, param2, param3));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_GetThumbnailsAsync(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 4)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"GetThumbnailsAsync", 4))
            {
                py::set_arg_count_version_error(4);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::Windows::Foundation::TimeSpan>>(args, 0);
                auto param1 = py::convert_to<int32_t>(args, 1);
                auto param2 = py::convert_to<int32_t>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Media::Editing::VideoFramePrecision>(args, 3);

                return py::convert(self->obj.GetThumbnailsAsync(param0, param1, param2, param3));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_LoadAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"LoadAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::StorageFile>(args, 0);

                return py::convert(winrt::Windows::Media::Editing::MediaComposition::LoadAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_RenderToFileAsync(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"RenderToFileAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageFile>(args, 0);

                return py::convert(self->obj.RenderToFileAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"RenderToFileAsync", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageFile>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Media::Editing::MediaTrimmingPreference>(args, 1);

                return py::convert(self->obj.RenderToFileAsync(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"RenderToFileAsync", 3))
            {
                py::set_arg_count_version_error(3);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageFile>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Media::Editing::MediaTrimmingPreference>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Media::MediaProperties::MediaEncodingProfile>(args, 2);

                return py::convert(self->obj.RenderToFileAsync(param0, param1, param2));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_SaveAsync(py::wrapper::Windows::Media::Editing::MediaComposition* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaComposition", L"SaveAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageFile>(args, 0);

                return py::convert(self->obj.SaveAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaComposition_get_BackgroundAudioTracks(py::wrapper::Windows::Media::Editing::MediaComposition* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaComposition", L"BackgroundAudioTracks"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.BackgroundAudioTracks());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaComposition_get_Clips(py::wrapper::Windows::Media::Editing::MediaComposition* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaComposition", L"Clips"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Clips());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaComposition_get_Duration(py::wrapper::Windows::Media::Editing::MediaComposition* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaComposition", L"Duration"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Duration());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaComposition_get_UserData(py::wrapper::Windows::Media::Editing::MediaComposition* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaComposition", L"UserData"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.UserData());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaComposition_get_OverlayLayers(py::wrapper::Windows::Media::Editing::MediaComposition* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaComposition", L"OverlayLayers"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.OverlayLayers());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_MediaComposition(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::Editing::MediaComposition>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_MediaComposition(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::Editing::MediaComposition>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_MediaComposition[] = {
        { "clone", reinterpret_cast<PyCFunction>(MediaComposition_Clone), METH_VARARGS, nullptr },
        { "create_default_encoding_profile", reinterpret_cast<PyCFunction>(MediaComposition_CreateDefaultEncodingProfile), METH_VARARGS, nullptr },
        { "generate_media_stream_source", reinterpret_cast<PyCFunction>(MediaComposition_GenerateMediaStreamSource), METH_VARARGS, nullptr },
        { "generate_preview_media_stream_source", reinterpret_cast<PyCFunction>(MediaComposition_GeneratePreviewMediaStreamSource), METH_VARARGS, nullptr },
        { "get_thumbnail_async", reinterpret_cast<PyCFunction>(MediaComposition_GetThumbnailAsync), METH_VARARGS, nullptr },
        { "get_thumbnails_async", reinterpret_cast<PyCFunction>(MediaComposition_GetThumbnailsAsync), METH_VARARGS, nullptr },
        { "load_async", reinterpret_cast<PyCFunction>(MediaComposition_LoadAsync), METH_VARARGS | METH_STATIC, nullptr },
        { "render_to_file_async", reinterpret_cast<PyCFunction>(MediaComposition_RenderToFileAsync), METH_VARARGS, nullptr },
        { "save_async", reinterpret_cast<PyCFunction>(MediaComposition_SaveAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_MediaComposition, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_MediaComposition), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_MediaComposition[] = {
        { "background_audio_tracks", reinterpret_cast<getter>(MediaComposition_get_BackgroundAudioTracks), nullptr, nullptr, nullptr },
        { "clips", reinterpret_cast<getter>(MediaComposition_get_Clips), nullptr, nullptr, nullptr },
        { "duration", reinterpret_cast<getter>(MediaComposition_get_Duration), nullptr, nullptr, nullptr },
        { "user_data", reinterpret_cast<getter>(MediaComposition_get_UserData), nullptr, nullptr, nullptr },
        { "overlay_layers", reinterpret_cast<getter>(MediaComposition_get_OverlayLayers), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_MediaComposition[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_MediaComposition) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_MediaComposition) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_MediaComposition) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_MediaComposition) },
        { },
    };

    static PyType_Spec type_spec_MediaComposition =
    {
        "_winsdk_Windows_Media_Editing.MediaComposition",
        sizeof(py::wrapper::Windows::Media::Editing::MediaComposition),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_MediaComposition
    };

    // ----- MediaOverlay class --------------------
    static constexpr const char* const type_name_MediaOverlay = "MediaOverlay";

    static PyObject* _new_MediaOverlay(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds != nullptr)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Media::Editing::MediaClip>(args, 0);

                winrt::Windows::Media::Editing::MediaOverlay instance{ param0 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Media::Editing::MediaClip>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 1);
                auto param2 = py::convert_to<double>(args, 2);

                winrt::Windows::Media::Editing::MediaOverlay instance{ param0, param1, param2 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_MediaOverlay(py::wrapper::Windows::Media::Editing::MediaOverlay* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* MediaOverlay_Clone(py::wrapper::Windows::Media::Editing::MediaOverlay* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaOverlay", L"Clone", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.Clone());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaOverlay_get_Position(py::wrapper::Windows::Media::Editing::MediaOverlay* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"Position"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Position());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaOverlay_put_Position(py::wrapper::Windows::Media::Editing::MediaOverlay* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"Position"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::Rect>(arg);

            self->obj.Position(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaOverlay_get_Opacity(py::wrapper::Windows::Media::Editing::MediaOverlay* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"Opacity"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Opacity());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaOverlay_put_Opacity(py::wrapper::Windows::Media::Editing::MediaOverlay* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"Opacity"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<double>(arg);

            self->obj.Opacity(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaOverlay_get_Delay(py::wrapper::Windows::Media::Editing::MediaOverlay* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"Delay"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Delay());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaOverlay_put_Delay(py::wrapper::Windows::Media::Editing::MediaOverlay* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"Delay"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TimeSpan>(arg);

            self->obj.Delay(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaOverlay_get_AudioEnabled(py::wrapper::Windows::Media::Editing::MediaOverlay* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"AudioEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.AudioEnabled());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int MediaOverlay_put_AudioEnabled(py::wrapper::Windows::Media::Editing::MediaOverlay* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"AudioEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

            self->obj.AudioEnabled(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* MediaOverlay_get_Clip(py::wrapper::Windows::Media::Editing::MediaOverlay* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlay", L"Clip"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Clip());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_MediaOverlay(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::Editing::MediaOverlay>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_MediaOverlay(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::Editing::MediaOverlay>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_MediaOverlay[] = {
        { "clone", reinterpret_cast<PyCFunction>(MediaOverlay_Clone), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_MediaOverlay, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_MediaOverlay), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_MediaOverlay[] = {
        { "position", reinterpret_cast<getter>(MediaOverlay_get_Position), reinterpret_cast<setter>(MediaOverlay_put_Position), nullptr, nullptr },
        { "opacity", reinterpret_cast<getter>(MediaOverlay_get_Opacity), reinterpret_cast<setter>(MediaOverlay_put_Opacity), nullptr, nullptr },
        { "delay", reinterpret_cast<getter>(MediaOverlay_get_Delay), reinterpret_cast<setter>(MediaOverlay_put_Delay), nullptr, nullptr },
        { "audio_enabled", reinterpret_cast<getter>(MediaOverlay_get_AudioEnabled), reinterpret_cast<setter>(MediaOverlay_put_AudioEnabled), nullptr, nullptr },
        { "clip", reinterpret_cast<getter>(MediaOverlay_get_Clip), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_MediaOverlay[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_MediaOverlay) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_MediaOverlay) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_MediaOverlay) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_MediaOverlay) },
        { },
    };

    static PyType_Spec type_spec_MediaOverlay =
    {
        "_winsdk_Windows_Media_Editing.MediaOverlay",
        sizeof(py::wrapper::Windows::Media::Editing::MediaOverlay),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_MediaOverlay
    };

    // ----- MediaOverlayLayer class --------------------
    static constexpr const char* const type_name_MediaOverlayLayer = "MediaOverlayLayer";

    static PyObject* _new_MediaOverlayLayer(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds != nullptr)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Media::Effects::IVideoCompositorDefinition>(args, 0);

                winrt::Windows::Media::Editing::MediaOverlayLayer instance{ param0 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 0)
        {
            try
            {
                winrt::Windows::Media::Editing::MediaOverlayLayer instance{  };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_MediaOverlayLayer(py::wrapper::Windows::Media::Editing::MediaOverlayLayer* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* MediaOverlayLayer_Clone(py::wrapper::Windows::Media::Editing::MediaOverlayLayer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Media.Editing.MediaOverlayLayer", L"Clone", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.Clone());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* MediaOverlayLayer_get_CustomCompositorDefinition(py::wrapper::Windows::Media::Editing::MediaOverlayLayer* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlayLayer", L"CustomCompositorDefinition"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.CustomCompositorDefinition());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* MediaOverlayLayer_get_Overlays(py::wrapper::Windows::Media::Editing::MediaOverlayLayer* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Media.Editing.MediaOverlayLayer", L"Overlays"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Overlays());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_MediaOverlayLayer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Media::Editing::MediaOverlayLayer>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_MediaOverlayLayer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Media::Editing::MediaOverlayLayer>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_MediaOverlayLayer[] = {
        { "clone", reinterpret_cast<PyCFunction>(MediaOverlayLayer_Clone), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_MediaOverlayLayer, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_MediaOverlayLayer), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_MediaOverlayLayer[] = {
        { "custom_compositor_definition", reinterpret_cast<getter>(MediaOverlayLayer_get_CustomCompositorDefinition), nullptr, nullptr, nullptr },
        { "overlays", reinterpret_cast<getter>(MediaOverlayLayer_get_Overlays), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_MediaOverlayLayer[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_MediaOverlayLayer) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_MediaOverlayLayer) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_MediaOverlayLayer) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_MediaOverlayLayer) },
        { },
    };

    static PyType_Spec type_spec_MediaOverlayLayer =
    {
        "_winsdk_Windows_Media_Editing.MediaOverlayLayer",
        sizeof(py::wrapper::Windows::Media::Editing::MediaOverlayLayer),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_MediaOverlayLayer
    };

    // ----- Windows.Media.Editing Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::Media::Editing");

    static PyMethodDef module_methods[] = {
        {"_register_MediaTrimmingPreference", register_MediaTrimmingPreference, METH_O, "registers type"},
        {"_register_VideoFramePrecision", register_VideoFramePrecision, METH_O, "registers type"},
        {}};


    static int module_traverse(PyObject* module, visitproc visit, void* arg) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_VISIT(state->type_MediaTrimmingPreference);
        Py_VISIT(state->type_VideoFramePrecision);
        Py_VISIT(state->type_BackgroundAudioTrack);
        Py_VISIT(state->type_EmbeddedAudioTrack);
        Py_VISIT(state->type_MediaClip);
        Py_VISIT(state->type_MediaComposition);
        Py_VISIT(state->type_MediaOverlay);
        Py_VISIT(state->type_MediaOverlayLayer);

        return 0;
    }

    static int module_clear(PyObject* module) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_CLEAR(state->type_MediaTrimmingPreference);
        Py_CLEAR(state->type_VideoFramePrecision);
        Py_CLEAR(state->type_BackgroundAudioTrack);
        Py_CLEAR(state->type_EmbeddedAudioTrack);
        Py_CLEAR(state->type_MediaClip);
        Py_CLEAR(state->type_MediaComposition);
        Py_CLEAR(state->type_MediaOverlay);
        Py_CLEAR(state->type_MediaOverlayLayer);

        return 0;
    }


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_Media_Editing",
           module_doc,
           sizeof(module_state),
           module_methods,
           nullptr,
           module_traverse,
           module_clear,
           nullptr};

} // py::cpp::Windows::Media::Editing

PyMODINIT_FUNC PyInit__winsdk_Windows_Media_Editing(void) noexcept
{
    using namespace py::cpp::Windows::Media::Editing;

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_python_type<py::Object>();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle bases{PyTuple_Pack(1, object_type)};

    if (!bases)
    {
        return nullptr;
    }

    py::pyobj_handle collections_abc_module{PyImport_ImportModule("collections.abc")};

    if (!collections_abc_module)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "Sequence")};

    if (!sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_bases{PyTuple_Pack(2, object_type, sequence_type.get())};

    if (!sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableSequence")};

    if (!mutable_sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_bases{PyTuple_Pack(2, object_type, mutable_sequence_type.get())};

    if (!mutable_sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "Mapping")};

    if (!mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_bases{PyTuple_Pack(2, object_type, mapping_type.get())};

    if (!mapping_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableMapping")};

    if (!mutable_mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_bases{PyTuple_Pack(2, object_type, mutable_mapping_type.get())};

    if (!mutable_mapping_bases)
    {
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module.get()));
    assert(state);

    state->type_BackgroundAudioTrack = py::register_python_type(module.get(), type_name_BackgroundAudioTrack, &type_spec_BackgroundAudioTrack, bases.get(), nullptr);
    if (!state->type_BackgroundAudioTrack)
    {
        return nullptr;
    }

    state->type_EmbeddedAudioTrack = py::register_python_type(module.get(), type_name_EmbeddedAudioTrack, &type_spec_EmbeddedAudioTrack, bases.get(), nullptr);
    if (!state->type_EmbeddedAudioTrack)
    {
        return nullptr;
    }

    state->type_MediaClip = py::register_python_type(module.get(), type_name_MediaClip, &type_spec_MediaClip, bases.get(), nullptr);
    if (!state->type_MediaClip)
    {
        return nullptr;
    }

    state->type_MediaComposition = py::register_python_type(module.get(), type_name_MediaComposition, &type_spec_MediaComposition, bases.get(), nullptr);
    if (!state->type_MediaComposition)
    {
        return nullptr;
    }

    state->type_MediaOverlay = py::register_python_type(module.get(), type_name_MediaOverlay, &type_spec_MediaOverlay, bases.get(), nullptr);
    if (!state->type_MediaOverlay)
    {
        return nullptr;
    }

    state->type_MediaOverlayLayer = py::register_python_type(module.get(), type_name_MediaOverlayLayer, &type_spec_MediaOverlayLayer, bases.get(), nullptr);
    if (!state->type_MediaOverlayLayer)
    {
        return nullptr;
    }


    return module.detach();
}

PyObject* py::py_type<winrt::Windows::Media::Editing::MediaTrimmingPreference>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_MediaTrimmingPreference;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::MediaTrimmingPreference is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Media::Editing::VideoFramePrecision>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_VideoFramePrecision;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::VideoFramePrecision is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Media::Editing::BackgroundAudioTrack>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_BackgroundAudioTrack;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::BackgroundAudioTrack is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Media::Editing::EmbeddedAudioTrack>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_EmbeddedAudioTrack;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::EmbeddedAudioTrack is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Media::Editing::MediaClip>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_MediaClip;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::MediaClip is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Media::Editing::MediaComposition>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_MediaComposition;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::MediaComposition is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Media::Editing::MediaOverlay>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_MediaOverlay;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::MediaOverlay is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Media::Editing::MediaOverlayLayer>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Media::Editing;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Media::Editing");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_MediaOverlayLayer;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Media::Editing::MediaOverlayLayer is not registered");
        return nullptr;
    }

    return python_type;
}
