/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.14.0
 *
 * Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
 * 
 * This file is part of PyQt5.
 * 
 * This file may be used under the terms of the GNU General Public License
 * version 3.0 as published by the Free Software Foundation and appearing in
 * the file LICENSE included in the packaging of this file.  Please review the
 * following information to ensure the GNU General Public License version 3.0
 * requirements will be met: http://www.gnu.org/copyleft/gpl.html.
 * 
 * If you do not wish to use this file under the terms of the GPL version 3.0
 * then you may purchase a commercial license.  For more information contact
 * info@riverbankcomputing.com.
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "sipAPIQtMultimedia.h"

#line 26 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtMultimedia/qabstractvideobuffer.sip"
#include <qabstractvideobuffer.h>
#line 29 "/build/pyqt5/src/PyQt5-5.15.11/build/QtMultimedia/sipQtMultimediaQAbstractVideoBuffer.cpp"

#line 26 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtCore/qvariant.sip"
#include <qvariant.h>
#line 33 "/build/pyqt5/src/PyQt5-5.15.11/build/QtMultimedia/sipQtMultimediaQAbstractVideoBuffer.cpp"


class sipQAbstractVideoBuffer : public ::QAbstractVideoBuffer
{
public:
    sipQAbstractVideoBuffer(::QAbstractVideoBuffer::HandleType);
    virtual ~sipQAbstractVideoBuffer();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    void release() SIP_OVERRIDE;
    ::QVariant handle() const SIP_OVERRIDE;
    void unmap() SIP_OVERRIDE;
    ::uchar* map(::QAbstractVideoBuffer::MapMode, int*, int*) SIP_OVERRIDE;
    ::QAbstractVideoBuffer::MapMode mapMode() const SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

private:
    sipQAbstractVideoBuffer(const sipQAbstractVideoBuffer &);
    sipQAbstractVideoBuffer &operator = (const sipQAbstractVideoBuffer &);

    char sipPyMethods[5];
};

sipQAbstractVideoBuffer::sipQAbstractVideoBuffer(::QAbstractVideoBuffer::HandleType a0): ::QAbstractVideoBuffer(a0), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipQAbstractVideoBuffer::~sipQAbstractVideoBuffer()
{
    sipInstanceDestroyedEx(&sipPySelf);
}

void sipQAbstractVideoBuffer::release()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[0], &sipPySelf, SIP_NULLPTR, sipName_release);

    if (!sipMeth)
    {
        ::QAbstractVideoBuffer::release();
        return;
    }

    extern void sipVH_QtMultimedia_2(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    sipVH_QtMultimedia_2(sipGILState, sipImportedVirtErrorHandlers_QtMultimedia_QtCore[0].iveh_handler, sipPySelf, sipMeth);
}

::QVariant sipQAbstractVideoBuffer::handle() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[1]), const_cast<sipSimpleWrapper **>(&sipPySelf), SIP_NULLPTR, sipName_handle);

    if (!sipMeth)
        return ::QAbstractVideoBuffer::handle();

    extern ::QVariant sipVH_QtMultimedia_3(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    return sipVH_QtMultimedia_3(sipGILState, sipImportedVirtErrorHandlers_QtMultimedia_QtCore[0].iveh_handler, sipPySelf, sipMeth);
}

void sipQAbstractVideoBuffer::unmap()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[2], &sipPySelf, sipName_QAbstractVideoBuffer, sipName_unmap);

    if (!sipMeth)
        return;

    extern void sipVH_QtMultimedia_2(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    sipVH_QtMultimedia_2(sipGILState, sipImportedVirtErrorHandlers_QtMultimedia_QtCore[0].iveh_handler, sipPySelf, sipMeth);
}

::uchar* sipQAbstractVideoBuffer::map(::QAbstractVideoBuffer::MapMode a0, int*a1, int*a2)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[3], &sipPySelf, sipName_QAbstractVideoBuffer, sipName_map);

    if (!sipMeth)
        return 0;

    extern ::uchar* sipVH_QtMultimedia_1(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::QAbstractVideoBuffer::MapMode, int*, int*, int);

    return sipVH_QtMultimedia_1(sipGILState, sipImportedVirtErrorHandlers_QtMultimedia_QtCore[0].iveh_handler, sipPySelf, sipMeth, a0, a1, a2, -1);
}

::QAbstractVideoBuffer::MapMode sipQAbstractVideoBuffer::mapMode() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[4]), const_cast<sipSimpleWrapper **>(&sipPySelf), sipName_QAbstractVideoBuffer, sipName_mapMode);

    if (!sipMeth)
        return ::QAbstractVideoBuffer::NotMapped;

    extern ::QAbstractVideoBuffer::MapMode sipVH_QtMultimedia_0(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    return sipVH_QtMultimedia_0(sipGILState, sipImportedVirtErrorHandlers_QtMultimedia_QtCore[0].iveh_handler, sipPySelf, sipMeth);
}


PyDoc_STRVAR(doc_QAbstractVideoBuffer_handleType, "handleType(self) -> QAbstractVideoBuffer.HandleType");

extern "C" {static PyObject *meth_QAbstractVideoBuffer_handleType(PyObject *, PyObject *);}
static PyObject *meth_QAbstractVideoBuffer_handleType(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const ::QAbstractVideoBuffer *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QAbstractVideoBuffer, &sipCpp))
        {
            ::QAbstractVideoBuffer::HandleType sipRes;

            sipRes = sipCpp->handleType();

            return sipConvertFromEnum(static_cast<int>(sipRes), sipType_QAbstractVideoBuffer_HandleType);
        }
    }

    sipNoMethod(sipParseErr, sipName_QAbstractVideoBuffer, sipName_handleType, doc_QAbstractVideoBuffer_handleType);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QAbstractVideoBuffer_mapMode, "mapMode(self) -> QAbstractVideoBuffer.MapMode");

extern "C" {static PyObject *meth_QAbstractVideoBuffer_mapMode(PyObject *, PyObject *);}
static PyObject *meth_QAbstractVideoBuffer_mapMode(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    PyObject *sipOrigSelf = sipSelf;

    {
        const ::QAbstractVideoBuffer *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QAbstractVideoBuffer, &sipCpp))
        {
            ::QAbstractVideoBuffer::MapMode sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_QAbstractVideoBuffer, sipName_mapMode);
                return SIP_NULLPTR;
            }

            sipRes = sipCpp->mapMode();

            return sipConvertFromEnum(static_cast<int>(sipRes), sipType_QAbstractVideoBuffer_MapMode);
        }
    }

    sipNoMethod(sipParseErr, sipName_QAbstractVideoBuffer, sipName_mapMode, doc_QAbstractVideoBuffer_mapMode);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QAbstractVideoBuffer_map, "map(self, mode: QAbstractVideoBuffer.MapMode) -> (PyQt5.sip.voidptr, Optional[int], Optional[int])");

extern "C" {static PyObject *meth_QAbstractVideoBuffer_map(PyObject *, PyObject *);}
static PyObject *meth_QAbstractVideoBuffer_map(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    PyObject *sipOrigSelf = sipSelf;

    {
        ::QAbstractVideoBuffer::MapMode a0;
        int a1;
        int a2;
        ::QAbstractVideoBuffer *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BE", &sipSelf, sipType_QAbstractVideoBuffer, &sipCpp, sipType_QAbstractVideoBuffer_MapMode, &a0))
        {
            PyObject * sipRes = SIP_NULLPTR;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_QAbstractVideoBuffer, sipName_map);
                return SIP_NULLPTR;
            }

#line 57 "/build/pyqt5/src/PyQt5-5.15.11/sip/QtMultimedia/qabstractvideobuffer.sip"
        uchar *mem;
        
        Py_BEGIN_ALLOW_THREADS
        mem = sipCpp->map(a0, &a1, &a2);
        Py_END_ALLOW_THREADS
        
        if (mem)
        {
            if (a0 & QAbstractVideoBuffer::WriteOnly)
                sipRes = sipConvertFromVoidPtrAndSize(mem, a1);
            else
                sipRes = sipConvertFromConstVoidPtrAndSize(mem, a1);
        }
        else
        {
            sipRes = Py_None;
            Py_INCREF(sipRes);
        }
#line 254 "/build/pyqt5/src/PyQt5-5.15.11/build/QtMultimedia/sipQtMultimediaQAbstractVideoBuffer.cpp"

            return sipBuildResult(0, "(Rii)", sipRes, a1, a2);
        }
    }

    sipNoMethod(sipParseErr, sipName_QAbstractVideoBuffer, sipName_map, doc_QAbstractVideoBuffer_map);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QAbstractVideoBuffer_unmap, "unmap(self)");

extern "C" {static PyObject *meth_QAbstractVideoBuffer_unmap(PyObject *, PyObject *);}
static PyObject *meth_QAbstractVideoBuffer_unmap(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    PyObject *sipOrigSelf = sipSelf;

    {
        ::QAbstractVideoBuffer *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QAbstractVideoBuffer, &sipCpp))
        {
            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_QAbstractVideoBuffer, sipName_unmap);
                return SIP_NULLPTR;
            }

            sipCpp->unmap();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QAbstractVideoBuffer, sipName_unmap, doc_QAbstractVideoBuffer_unmap);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QAbstractVideoBuffer_handle, "handle(self) -> Any");

extern "C" {static PyObject *meth_QAbstractVideoBuffer_handle(PyObject *, PyObject *);}
static PyObject *meth_QAbstractVideoBuffer_handle(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        const ::QAbstractVideoBuffer *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QAbstractVideoBuffer, &sipCpp))
        {
            ::QVariant*sipRes;

            sipRes = new ::QVariant((sipSelfWasArg ? sipCpp->::QAbstractVideoBuffer::handle() : sipCpp->handle()));

            return sipConvertFromNewType(sipRes, sipType_QVariant, SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_QAbstractVideoBuffer, sipName_handle, doc_QAbstractVideoBuffer_handle);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QAbstractVideoBuffer_release, "release(self)");

extern "C" {static PyObject *meth_QAbstractVideoBuffer_release(PyObject *, PyObject *);}
static PyObject *meth_QAbstractVideoBuffer_release(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        ::QAbstractVideoBuffer *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QAbstractVideoBuffer, &sipCpp))
        {
            (sipSelfWasArg ? sipCpp->::QAbstractVideoBuffer::release() : sipCpp->release());

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_QAbstractVideoBuffer, sipName_release, doc_QAbstractVideoBuffer_release);

    return SIP_NULLPTR;
}


/* Call the instance's destructor. */
extern "C" {static void release_QAbstractVideoBuffer(void *, int);}
static void release_QAbstractVideoBuffer(void *sipCppV, int sipState)
{
    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipQAbstractVideoBuffer *>(sipCppV);
    else
        delete reinterpret_cast< ::QAbstractVideoBuffer *>(sipCppV);
}


extern "C" {static void dealloc_QAbstractVideoBuffer(sipSimpleWrapper *);}
static void dealloc_QAbstractVideoBuffer(sipSimpleWrapper *sipSelf)
{
    if (sipIsDerivedClass(sipSelf))
        reinterpret_cast<sipQAbstractVideoBuffer *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;

    if (sipIsOwnedByPython(sipSelf))
    {
        release_QAbstractVideoBuffer(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
    }
}


extern "C" {static void *init_type_QAbstractVideoBuffer(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_QAbstractVideoBuffer(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
    sipQAbstractVideoBuffer *sipCpp = SIP_NULLPTR;

    {
        ::QAbstractVideoBuffer::HandleType a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "E", sipType_QAbstractVideoBuffer_HandleType, &a0))
        {
            sipCpp = new sipQAbstractVideoBuffer(a0);

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_QAbstractVideoBuffer[] = {
    {sipName_handle, meth_QAbstractVideoBuffer_handle, METH_VARARGS, doc_QAbstractVideoBuffer_handle},
    {sipName_handleType, meth_QAbstractVideoBuffer_handleType, METH_VARARGS, doc_QAbstractVideoBuffer_handleType},
    {sipName_map, meth_QAbstractVideoBuffer_map, METH_VARARGS, doc_QAbstractVideoBuffer_map},
    {sipName_mapMode, meth_QAbstractVideoBuffer_mapMode, METH_VARARGS, doc_QAbstractVideoBuffer_mapMode},
    {sipName_release, meth_QAbstractVideoBuffer_release, METH_VARARGS, doc_QAbstractVideoBuffer_release},
    {sipName_unmap, meth_QAbstractVideoBuffer_unmap, METH_VARARGS, doc_QAbstractVideoBuffer_unmap}
};

static sipEnumMemberDef enummembers_QAbstractVideoBuffer[] = {
    {sipName_CoreImageHandle, static_cast<int>(::QAbstractVideoBuffer::CoreImageHandle), 1},
    {sipName_EGLImageHandle, static_cast<int>(::QAbstractVideoBuffer::EGLImageHandle), 1},
    {sipName_GLTextureHandle, static_cast<int>(::QAbstractVideoBuffer::GLTextureHandle), 1},
    {sipName_NoHandle, static_cast<int>(::QAbstractVideoBuffer::NoHandle), 1},
    {sipName_NotMapped, static_cast<int>(::QAbstractVideoBuffer::NotMapped), 2},
    {sipName_QPixmapHandle, static_cast<int>(::QAbstractVideoBuffer::QPixmapHandle), 1},
    {sipName_ReadOnly, static_cast<int>(::QAbstractVideoBuffer::ReadOnly), 2},
    {sipName_ReadWrite, static_cast<int>(::QAbstractVideoBuffer::ReadWrite), 2},
    {sipName_UserHandle, static_cast<int>(::QAbstractVideoBuffer::UserHandle), 1},
    {sipName_WriteOnly, static_cast<int>(::QAbstractVideoBuffer::WriteOnly), 2},
    {sipName_XvShmImageHandle, static_cast<int>(::QAbstractVideoBuffer::XvShmImageHandle), 1},
};

PyDoc_STRVAR(doc_QAbstractVideoBuffer, "\1QAbstractVideoBuffer(type: QAbstractVideoBuffer.HandleType)");


static pyqt5ClassPluginDef plugin_QAbstractVideoBuffer = {
    SIP_NULLPTR,
    0,
    SIP_NULLPTR,
    SIP_NULLPTR
};


sipClassTypeDef sipTypeDef_QtMultimedia_QAbstractVideoBuffer = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_ABSTRACT|SIP_TYPE_SUPER_INIT|SIP_TYPE_LIMITED_API|SIP_TYPE_CLASS,
        sipNameNr_QAbstractVideoBuffer,
        SIP_NULLPTR,
        &plugin_QAbstractVideoBuffer,
    },
    {
        sipNameNr_QAbstractVideoBuffer,
        {0, 0, 1},
        6, methods_QAbstractVideoBuffer,
        11, enummembers_QAbstractVideoBuffer,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_QAbstractVideoBuffer,
    -1,
    sipNameNr_sip_simplewrapper,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_QAbstractVideoBuffer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_QAbstractVideoBuffer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_QAbstractVideoBuffer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::QAbstractVideoBuffer),
};
