{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

Functions to create and handle overlay compositions on video buffers.

An overlay composition describes one or more overlay rectangles to be
blended on top of a video buffer.

This API serves two main purposes:

* it can be used to attach overlay information (subtitles or logos)
  to non-raw video buffers such as GL\/VAAPI\/VDPAU surfaces. The actual
  blending of the overlay can then be done by e.g. the video sink that
  processes these non-raw buffers.

* it can also be used to blend overlay rectangles on top of raw video
  buffers, thus consolidating blending functionality for raw video in
  one place.

Together, this allows existing overlay elements to easily handle raw
and non-raw video as input in without major changes (once the overlays
have been put into a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' object anyway) - for raw
video the overlay can just use the blending function to blend the data
on top of the video, and for surface buffers it can just attach them to
the buffer and let the sink render the overlays.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GstVideo.Structs.VideoOverlayComposition
    (

-- * Exported types
    VideoOverlayComposition(..)             ,
    noVideoOverlayComposition               ,


 -- * Methods
-- ** addRectangle #method:addRectangle#

#if ENABLE_OVERLOADING
    VideoOverlayCompositionAddRectangleMethodInfo,
#endif
    videoOverlayCompositionAddRectangle     ,


-- ** blend #method:blend#

#if ENABLE_OVERLOADING
    VideoOverlayCompositionBlendMethodInfo  ,
#endif
    videoOverlayCompositionBlend            ,


-- ** copy #method:copy#

#if ENABLE_OVERLOADING
    VideoOverlayCompositionCopyMethodInfo   ,
#endif
    videoOverlayCompositionCopy             ,


-- ** getRectangle #method:getRectangle#

#if ENABLE_OVERLOADING
    VideoOverlayCompositionGetRectangleMethodInfo,
#endif
    videoOverlayCompositionGetRectangle     ,


-- ** getSeqnum #method:getSeqnum#

#if ENABLE_OVERLOADING
    VideoOverlayCompositionGetSeqnumMethodInfo,
#endif
    videoOverlayCompositionGetSeqnum        ,


-- ** makeWritable #method:makeWritable#

#if ENABLE_OVERLOADING
    VideoOverlayCompositionMakeWritableMethodInfo,
#endif
    videoOverlayCompositionMakeWritable     ,


-- ** nRectangles #method:nRectangles#

#if ENABLE_OVERLOADING
    VideoOverlayCompositionNRectanglesMethodInfo,
#endif
    videoOverlayCompositionNRectangles      ,


-- ** new #method:new#

    videoOverlayCompositionNew              ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import {-# SOURCE #-} qualified GI.GstVideo.Structs.VideoFrame as GstVideo.VideoFrame
import {-# SOURCE #-} qualified GI.GstVideo.Structs.VideoOverlayRectangle as GstVideo.VideoOverlayRectangle

-- | Memory-managed wrapper type.
newtype VideoOverlayComposition = VideoOverlayComposition (ManagedPtr VideoOverlayComposition)
foreign import ccall "gst_video_overlay_composition_get_type" c_gst_video_overlay_composition_get_type ::
    IO GType

instance BoxedObject VideoOverlayComposition where
    boxedType _ = c_gst_video_overlay_composition_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `VideoOverlayComposition`.
noVideoOverlayComposition :: Maybe VideoOverlayComposition
noVideoOverlayComposition = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList VideoOverlayComposition
type instance O.AttributeList VideoOverlayComposition = VideoOverlayCompositionAttributeList
type VideoOverlayCompositionAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method VideoOverlayComposition::new
-- method type : Constructor
-- Args : [Arg {argCName = "rectangle", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayRectangle"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayRectangle to add to the\n    composition", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_new" gst_video_overlay_composition_new ::
    Ptr GstVideo.VideoOverlayRectangle.VideoOverlayRectangle -> -- rectangle : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayRectangle"})
    IO (Ptr VideoOverlayComposition)

{- |
Creates a new video overlay composition object to hold one or more
overlay rectangles.
-}
videoOverlayCompositionNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GstVideo.VideoOverlayRectangle.VideoOverlayRectangle
    {- ^ /@rectangle@/: a 'GI.GstVideo.Structs.VideoOverlayRectangle.VideoOverlayRectangle' to add to the
    composition -}
    -> m VideoOverlayComposition
    {- ^ __Returns:__ a new 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition'. Unref with
    @/gst_video_overlay_composition_unref()/@ when no longer needed. -}
videoOverlayCompositionNew rectangle = liftIO $ do
    rectangle' <- unsafeManagedPtrGetPtr rectangle
    result <- gst_video_overlay_composition_new rectangle'
    checkUnexpectedReturnNULL "videoOverlayCompositionNew" result
    result' <- (wrapBoxed VideoOverlayComposition) result
    touchManagedPtr rectangle
    return result'

#if ENABLE_OVERLOADING
#endif

-- method VideoOverlayComposition::add_rectangle
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "comp", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayComposition", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rectangle", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayRectangle"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayRectangle to add to the\n    composition", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_add_rectangle" gst_video_overlay_composition_add_rectangle ::
    Ptr VideoOverlayComposition ->          -- comp : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"})
    Ptr GstVideo.VideoOverlayRectangle.VideoOverlayRectangle -> -- rectangle : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayRectangle"})
    IO ()

{- |
Adds an overlay rectangle to an existing overlay composition object. This
must be done right after creating the overlay composition.
-}
videoOverlayCompositionAddRectangle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    VideoOverlayComposition
    {- ^ /@comp@/: a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' -}
    -> GstVideo.VideoOverlayRectangle.VideoOverlayRectangle
    {- ^ /@rectangle@/: a 'GI.GstVideo.Structs.VideoOverlayRectangle.VideoOverlayRectangle' to add to the
    composition -}
    -> m ()
videoOverlayCompositionAddRectangle comp rectangle = liftIO $ do
    comp' <- unsafeManagedPtrGetPtr comp
    rectangle' <- unsafeManagedPtrGetPtr rectangle
    gst_video_overlay_composition_add_rectangle comp' rectangle'
    touchManagedPtr comp
    touchManagedPtr rectangle
    return ()

#if ENABLE_OVERLOADING
data VideoOverlayCompositionAddRectangleMethodInfo
instance (signature ~ (GstVideo.VideoOverlayRectangle.VideoOverlayRectangle -> m ()), MonadIO m) => O.MethodInfo VideoOverlayCompositionAddRectangleMethodInfo VideoOverlayComposition signature where
    overloadedMethod _ = videoOverlayCompositionAddRectangle

#endif

-- method VideoOverlayComposition::blend
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "comp", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayComposition", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "video_buf", argType = TInterface (Name {namespace = "GstVideo", name = "VideoFrame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoFrame containing raw video data in a\n            supported format. It should be mapped using GST_MAP_READWRITE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_blend" gst_video_overlay_composition_blend ::
    Ptr VideoOverlayComposition ->          -- comp : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"})
    Ptr GstVideo.VideoFrame.VideoFrame ->   -- video_buf : TInterface (Name {namespace = "GstVideo", name = "VideoFrame"})
    IO CInt

{- |
Blends the overlay rectangles in /@comp@/ on top of the raw video data
contained in /@videoBuf@/. The data in /@videoBuf@/ must be writable and
mapped appropriately.

Since /@videoBuf@/ data is read and will be modified, it ought be
mapped with flag GST_MAP_READWRITE.
-}
videoOverlayCompositionBlend ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    VideoOverlayComposition
    {- ^ /@comp@/: a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' -}
    -> GstVideo.VideoFrame.VideoFrame
    {- ^ /@videoBuf@/: a 'GI.GstVideo.Structs.VideoFrame.VideoFrame' containing raw video data in a
            supported format. It should be mapped using GST_MAP_READWRITE -}
    -> m Bool
videoOverlayCompositionBlend comp videoBuf = liftIO $ do
    comp' <- unsafeManagedPtrGetPtr comp
    videoBuf' <- unsafeManagedPtrGetPtr videoBuf
    result <- gst_video_overlay_composition_blend comp' videoBuf'
    let result' = (/= 0) result
    touchManagedPtr comp
    touchManagedPtr videoBuf
    return result'

#if ENABLE_OVERLOADING
data VideoOverlayCompositionBlendMethodInfo
instance (signature ~ (GstVideo.VideoFrame.VideoFrame -> m Bool), MonadIO m) => O.MethodInfo VideoOverlayCompositionBlendMethodInfo VideoOverlayComposition signature where
    overloadedMethod _ = videoOverlayCompositionBlend

#endif

-- method VideoOverlayComposition::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "comp", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayComposition to copy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_copy" gst_video_overlay_composition_copy ::
    Ptr VideoOverlayComposition ->          -- comp : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"})
    IO (Ptr VideoOverlayComposition)

{- |
Makes a copy of /@comp@/ and all contained rectangles, so that it is possible
to modify the composition and contained rectangles (e.g. add additional
rectangles or change the render co-ordinates or render dimension). The
actual overlay pixel data buffers contained in the rectangles are not
copied.
-}
videoOverlayCompositionCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    VideoOverlayComposition
    {- ^ /@comp@/: a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' to copy -}
    -> m VideoOverlayComposition
    {- ^ __Returns:__ a new 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' equivalent
    to /@comp@/. -}
videoOverlayCompositionCopy comp = liftIO $ do
    comp' <- unsafeManagedPtrGetPtr comp
    result <- gst_video_overlay_composition_copy comp'
    checkUnexpectedReturnNULL "videoOverlayCompositionCopy" result
    result' <- (wrapBoxed VideoOverlayComposition) result
    touchManagedPtr comp
    return result'

#if ENABLE_OVERLOADING
data VideoOverlayCompositionCopyMethodInfo
instance (signature ~ (m VideoOverlayComposition), MonadIO m) => O.MethodInfo VideoOverlayCompositionCopyMethodInfo VideoOverlayComposition signature where
    overloadedMethod _ = videoOverlayCompositionCopy

#endif

-- method VideoOverlayComposition::get_rectangle
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "comp", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayComposition", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of the rectangle to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoOverlayRectangle"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_get_rectangle" gst_video_overlay_composition_get_rectangle ::
    Ptr VideoOverlayComposition ->          -- comp : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"})
    Word32 ->                               -- n : TBasicType TUInt
    IO (Ptr GstVideo.VideoOverlayRectangle.VideoOverlayRectangle)

{- |
Returns the /@n@/-th 'GI.GstVideo.Structs.VideoOverlayRectangle.VideoOverlayRectangle' contained in /@comp@/.
-}
videoOverlayCompositionGetRectangle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    VideoOverlayComposition
    {- ^ /@comp@/: a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' -}
    -> Word32
    {- ^ /@n@/: number of the rectangle to get -}
    -> m GstVideo.VideoOverlayRectangle.VideoOverlayRectangle
    {- ^ __Returns:__ the /@n@/-th rectangle, or NULL if /@n@/ is out of
    bounds. Will not return a new reference, the caller will need to
    obtain her own reference using @/gst_video_overlay_rectangle_ref()/@
    if needed. -}
videoOverlayCompositionGetRectangle comp n = liftIO $ do
    comp' <- unsafeManagedPtrGetPtr comp
    result <- gst_video_overlay_composition_get_rectangle comp' n
    checkUnexpectedReturnNULL "videoOverlayCompositionGetRectangle" result
    result' <- (newBoxed GstVideo.VideoOverlayRectangle.VideoOverlayRectangle) result
    touchManagedPtr comp
    return result'

#if ENABLE_OVERLOADING
data VideoOverlayCompositionGetRectangleMethodInfo
instance (signature ~ (Word32 -> m GstVideo.VideoOverlayRectangle.VideoOverlayRectangle), MonadIO m) => O.MethodInfo VideoOverlayCompositionGetRectangleMethodInfo VideoOverlayComposition signature where
    overloadedMethod _ = videoOverlayCompositionGetRectangle

#endif

-- method VideoOverlayComposition::get_seqnum
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "comp", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayComposition", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_get_seqnum" gst_video_overlay_composition_get_seqnum ::
    Ptr VideoOverlayComposition ->          -- comp : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"})
    IO Word32

{- |
Returns the sequence number of this composition. Sequence numbers are
monotonically increasing and unique for overlay compositions and rectangles
(meaning there will never be a rectangle with the same sequence number as
a composition).
-}
videoOverlayCompositionGetSeqnum ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    VideoOverlayComposition
    {- ^ /@comp@/: a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' -}
    -> m Word32
    {- ^ __Returns:__ the sequence number of /@comp@/ -}
videoOverlayCompositionGetSeqnum comp = liftIO $ do
    comp' <- unsafeManagedPtrGetPtr comp
    result <- gst_video_overlay_composition_get_seqnum comp'
    touchManagedPtr comp
    return result

#if ENABLE_OVERLOADING
data VideoOverlayCompositionGetSeqnumMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo VideoOverlayCompositionGetSeqnumMethodInfo VideoOverlayComposition signature where
    overloadedMethod _ = videoOverlayCompositionGetSeqnum

#endif

-- method VideoOverlayComposition::make_writable
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "comp", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayComposition to copy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_make_writable" gst_video_overlay_composition_make_writable ::
    Ptr VideoOverlayComposition ->          -- comp : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"})
    IO (Ptr VideoOverlayComposition)

{- |
Takes ownership of /@comp@/ and returns a version of /@comp@/ that is writable
(i.e. can be modified). Will either return /@comp@/ right away, or create a
new writable copy of /@comp@/ and unref /@comp@/ itself. All the contained
rectangles will also be copied, but the actual overlay pixel data buffers
contained in the rectangles are not copied.
-}
videoOverlayCompositionMakeWritable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    VideoOverlayComposition
    {- ^ /@comp@/: a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' to copy -}
    -> m VideoOverlayComposition
    {- ^ __Returns:__ a writable 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition'
    equivalent to /@comp@/. -}
videoOverlayCompositionMakeWritable comp = liftIO $ do
    comp' <- B.ManagedPtr.disownBoxed comp
    result <- gst_video_overlay_composition_make_writable comp'
    checkUnexpectedReturnNULL "videoOverlayCompositionMakeWritable" result
    result' <- (wrapBoxed VideoOverlayComposition) result
    touchManagedPtr comp
    return result'

#if ENABLE_OVERLOADING
data VideoOverlayCompositionMakeWritableMethodInfo
instance (signature ~ (m VideoOverlayComposition), MonadIO m) => O.MethodInfo VideoOverlayCompositionMakeWritableMethodInfo VideoOverlayComposition signature where
    overloadedMethod _ = videoOverlayCompositionMakeWritable

#endif

-- method VideoOverlayComposition::n_rectangles
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "comp", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoOverlayComposition", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_overlay_composition_n_rectangles" gst_video_overlay_composition_n_rectangles ::
    Ptr VideoOverlayComposition ->          -- comp : TInterface (Name {namespace = "GstVideo", name = "VideoOverlayComposition"})
    IO Word32

{- |
Returns the number of 'GI.GstVideo.Structs.VideoOverlayRectangle.VideoOverlayRectangle'\<!-- -->s contained in /@comp@/.
-}
videoOverlayCompositionNRectangles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    VideoOverlayComposition
    {- ^ /@comp@/: a 'GI.GstVideo.Structs.VideoOverlayComposition.VideoOverlayComposition' -}
    -> m Word32
    {- ^ __Returns:__ the number of rectangles -}
videoOverlayCompositionNRectangles comp = liftIO $ do
    comp' <- unsafeManagedPtrGetPtr comp
    result <- gst_video_overlay_composition_n_rectangles comp'
    touchManagedPtr comp
    return result

#if ENABLE_OVERLOADING
data VideoOverlayCompositionNRectanglesMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo VideoOverlayCompositionNRectanglesMethodInfo VideoOverlayComposition signature where
    overloadedMethod _ = videoOverlayCompositionNRectangles

#endif

#if ENABLE_OVERLOADING
type family ResolveVideoOverlayCompositionMethod (t :: Symbol) (o :: *) :: * where
    ResolveVideoOverlayCompositionMethod "addRectangle" o = VideoOverlayCompositionAddRectangleMethodInfo
    ResolveVideoOverlayCompositionMethod "blend" o = VideoOverlayCompositionBlendMethodInfo
    ResolveVideoOverlayCompositionMethod "copy" o = VideoOverlayCompositionCopyMethodInfo
    ResolveVideoOverlayCompositionMethod "makeWritable" o = VideoOverlayCompositionMakeWritableMethodInfo
    ResolveVideoOverlayCompositionMethod "nRectangles" o = VideoOverlayCompositionNRectanglesMethodInfo
    ResolveVideoOverlayCompositionMethod "getRectangle" o = VideoOverlayCompositionGetRectangleMethodInfo
    ResolveVideoOverlayCompositionMethod "getSeqnum" o = VideoOverlayCompositionGetSeqnumMethodInfo
    ResolveVideoOverlayCompositionMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveVideoOverlayCompositionMethod t VideoOverlayComposition, O.MethodInfo info VideoOverlayComposition p) => OL.IsLabel t (VideoOverlayComposition -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif