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

This base class is for video encoders turning raw video into
encoded video data.

GstVideoEncoder and subclass should cooperate as follows.

== Configuration

  * Initially, GstVideoEncoder calls /@start@/ when the encoder element
    is activated, which allows subclass to perform any global setup.
  * GstVideoEncoder calls /@setFormat@/ to inform subclass of the format
    of input video data that it is about to receive.  Subclass should
    setup for encoding and configure base class as appropriate
    (e.g. latency). While unlikely, it might be called more than once,
    if changing input parameters require reconfiguration.  Baseclass
    will ensure that processing of current configuration is finished.
  * GstVideoEncoder calls /@stop@/ at end of all processing.

== Data processing

    * Base class collects input data and metadata into a frame and hands
      this to subclass\' /@handleFrame@/.

    * If codec processing results in encoded data, subclass should call
      /@gstVideoEncoderFinishFrame@/ to have encoded data pushed
      downstream.

    * If implemented, baseclass calls subclass /@prePush@/ just prior to
      pushing to allow subclasses to modify some metadata on the buffer.
      If it returns GST_FLOW_OK, the buffer is pushed downstream.

    * GstVideoEncoderClass will handle both srcpad and sinkpad events.
      Sink events will be passed to subclass if /@event@/ callback has been
      provided.

== Shutdown phase

  * GstVideoEncoder class calls /@stop@/ to inform the subclass that data
    parsing will be stopped.

Subclass is responsible for providing pad template caps for
source and sink pads. The pads need to be named \"sink\" and \"src\". It should
also be able to provide fixed src pad caps in /@getcaps@/ by the time it calls
/@gstVideoEncoderFinishFrame@/.

Things that subclass need to take care of:

  * Provide pad templates
  * Provide source pad caps before pushing the first buffer
  * Accept data in /@handleFrame@/ and provide encoded results to
     /@gstVideoEncoderFinishFrame@/.


The 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder':@/qos/@ property will enable the Quality-of-Service
features of the encoder which gather statistics about the real-time
performance of the downstream elements. If enabled, subclasses can
use 'GI.GstVideo.Objects.VideoEncoder.videoEncoderGetMaxEncodeTime' to check if input frames
are already late and drop them right away to give a chance to the
pipeline to catch up.
-}

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

module GI.GstVideo.Objects.VideoEncoder
    (

-- * Exported types
    VideoEncoder(..)                        ,
    IsVideoEncoder                          ,
    toVideoEncoder                          ,
    noVideoEncoder                          ,


 -- * Methods
-- ** allocateOutputBuffer #method:allocateOutputBuffer#

#if ENABLE_OVERLOADING
    VideoEncoderAllocateOutputBufferMethodInfo,
#endif
    videoEncoderAllocateOutputBuffer        ,


-- ** allocateOutputFrame #method:allocateOutputFrame#

#if ENABLE_OVERLOADING
    VideoEncoderAllocateOutputFrameMethodInfo,
#endif
    videoEncoderAllocateOutputFrame         ,


-- ** finishFrame #method:finishFrame#

#if ENABLE_OVERLOADING
    VideoEncoderFinishFrameMethodInfo       ,
#endif
    videoEncoderFinishFrame                 ,


-- ** getAllocator #method:getAllocator#

#if ENABLE_OVERLOADING
    VideoEncoderGetAllocatorMethodInfo      ,
#endif
    videoEncoderGetAllocator                ,


-- ** getFrame #method:getFrame#

#if ENABLE_OVERLOADING
    VideoEncoderGetFrameMethodInfo          ,
#endif
    videoEncoderGetFrame                    ,


-- ** getFrames #method:getFrames#

#if ENABLE_OVERLOADING
    VideoEncoderGetFramesMethodInfo         ,
#endif
    videoEncoderGetFrames                   ,


-- ** getLatency #method:getLatency#

#if ENABLE_OVERLOADING
    VideoEncoderGetLatencyMethodInfo        ,
#endif
    videoEncoderGetLatency                  ,


-- ** getMaxEncodeTime #method:getMaxEncodeTime#

#if ENABLE_OVERLOADING
    VideoEncoderGetMaxEncodeTimeMethodInfo  ,
#endif
    videoEncoderGetMaxEncodeTime            ,


-- ** getOldestFrame #method:getOldestFrame#

#if ENABLE_OVERLOADING
    VideoEncoderGetOldestFrameMethodInfo    ,
#endif
    videoEncoderGetOldestFrame              ,


-- ** getOutputState #method:getOutputState#

#if ENABLE_OVERLOADING
    VideoEncoderGetOutputStateMethodInfo    ,
#endif
    videoEncoderGetOutputState              ,


-- ** isQosEnabled #method:isQosEnabled#

#if ENABLE_OVERLOADING
    VideoEncoderIsQosEnabledMethodInfo      ,
#endif
    videoEncoderIsQosEnabled                ,


-- ** mergeTags #method:mergeTags#

#if ENABLE_OVERLOADING
    VideoEncoderMergeTagsMethodInfo         ,
#endif
    videoEncoderMergeTags                   ,


-- ** negotiate #method:negotiate#

#if ENABLE_OVERLOADING
    VideoEncoderNegotiateMethodInfo         ,
#endif
    videoEncoderNegotiate                   ,


-- ** proxyGetcaps #method:proxyGetcaps#

#if ENABLE_OVERLOADING
    VideoEncoderProxyGetcapsMethodInfo      ,
#endif
    videoEncoderProxyGetcaps                ,


-- ** setHeaders #method:setHeaders#

#if ENABLE_OVERLOADING
    VideoEncoderSetHeadersMethodInfo        ,
#endif
    videoEncoderSetHeaders                  ,


-- ** setLatency #method:setLatency#

#if ENABLE_OVERLOADING
    VideoEncoderSetLatencyMethodInfo        ,
#endif
    videoEncoderSetLatency                  ,


-- ** setMinPts #method:setMinPts#

#if ENABLE_OVERLOADING
    VideoEncoderSetMinPtsMethodInfo         ,
#endif
    videoEncoderSetMinPts                   ,


-- ** setOutputState #method:setOutputState#

#if ENABLE_OVERLOADING
    VideoEncoderSetOutputStateMethodInfo    ,
#endif
    videoEncoderSetOutputState              ,


-- ** setQosEnabled #method:setQosEnabled#

#if ENABLE_OVERLOADING
    VideoEncoderSetQosEnabledMethodInfo     ,
#endif
    videoEncoderSetQosEnabled               ,




 -- * Properties
-- ** qos #attr:qos#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    VideoEncoderQosPropertyInfo             ,
#endif
    constructVideoEncoderQos                ,
    getVideoEncoderQos                      ,
    setVideoEncoderQos                      ,
#if ENABLE_OVERLOADING
    videoEncoderQos                         ,
#endif




    ) 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 qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gst.Enums as Gst.Enums
import qualified GI.Gst.Interfaces.Preset as Gst.Preset
import qualified GI.Gst.Objects.Allocator as Gst.Allocator
import qualified GI.Gst.Objects.Element as Gst.Element
import qualified GI.Gst.Objects.Object as Gst.Object
import qualified GI.Gst.Structs.AllocationParams as Gst.AllocationParams
import qualified GI.Gst.Structs.Buffer as Gst.Buffer
import qualified GI.Gst.Structs.Caps as Gst.Caps
import qualified GI.Gst.Structs.TagList as Gst.TagList
import {-# SOURCE #-} qualified GI.GstVideo.Structs.VideoCodecFrame as GstVideo.VideoCodecFrame
import {-# SOURCE #-} qualified GI.GstVideo.Structs.VideoCodecState as GstVideo.VideoCodecState

-- | Memory-managed wrapper type.
newtype VideoEncoder = VideoEncoder (ManagedPtr VideoEncoder)
foreign import ccall "gst_video_encoder_get_type"
    c_gst_video_encoder_get_type :: IO GType

instance GObject VideoEncoder where
    gobjectType = c_gst_video_encoder_get_type


-- | Type class for types which can be safely cast to `VideoEncoder`, for instance with `toVideoEncoder`.
class (GObject o, O.IsDescendantOf VideoEncoder o) => IsVideoEncoder o
instance (GObject o, O.IsDescendantOf VideoEncoder o) => IsVideoEncoder o

instance O.HasParentTypes VideoEncoder
type instance O.ParentTypes VideoEncoder = '[Gst.Element.Element, Gst.Object.Object, GObject.Object.Object, Gst.Preset.Preset]

-- | Cast to `VideoEncoder`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toVideoEncoder :: (MonadIO m, IsVideoEncoder o) => o -> m VideoEncoder
toVideoEncoder = liftIO . unsafeCastTo VideoEncoder

-- | A convenience alias for `Nothing` :: `Maybe` `VideoEncoder`.
noVideoEncoder :: Maybe VideoEncoder
noVideoEncoder = Nothing

#if ENABLE_OVERLOADING
type family ResolveVideoEncoderMethod (t :: Symbol) (o :: *) :: * where
    ResolveVideoEncoderMethod "abortState" o = Gst.Element.ElementAbortStateMethodInfo
    ResolveVideoEncoderMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveVideoEncoderMethod "addPad" o = Gst.Element.ElementAddPadMethodInfo
    ResolveVideoEncoderMethod "addPropertyDeepNotifyWatch" o = Gst.Element.ElementAddPropertyDeepNotifyWatchMethodInfo
    ResolveVideoEncoderMethod "addPropertyNotifyWatch" o = Gst.Element.ElementAddPropertyNotifyWatchMethodInfo
    ResolveVideoEncoderMethod "allocateOutputBuffer" o = VideoEncoderAllocateOutputBufferMethodInfo
    ResolveVideoEncoderMethod "allocateOutputFrame" o = VideoEncoderAllocateOutputFrameMethodInfo
    ResolveVideoEncoderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveVideoEncoderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveVideoEncoderMethod "callAsync" o = Gst.Element.ElementCallAsyncMethodInfo
    ResolveVideoEncoderMethod "changeState" o = Gst.Element.ElementChangeStateMethodInfo
    ResolveVideoEncoderMethod "continueState" o = Gst.Element.ElementContinueStateMethodInfo
    ResolveVideoEncoderMethod "createAllPads" o = Gst.Element.ElementCreateAllPadsMethodInfo
    ResolveVideoEncoderMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveVideoEncoderMethod "deletePreset" o = Gst.Preset.PresetDeletePresetMethodInfo
    ResolveVideoEncoderMethod "finishFrame" o = VideoEncoderFinishFrameMethodInfo
    ResolveVideoEncoderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveVideoEncoderMethod "foreachPad" o = Gst.Element.ElementForeachPadMethodInfo
    ResolveVideoEncoderMethod "foreachSinkPad" o = Gst.Element.ElementForeachSinkPadMethodInfo
    ResolveVideoEncoderMethod "foreachSrcPad" o = Gst.Element.ElementForeachSrcPadMethodInfo
    ResolveVideoEncoderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveVideoEncoderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveVideoEncoderMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveVideoEncoderMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveVideoEncoderMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveVideoEncoderMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveVideoEncoderMethod "isEditable" o = Gst.Preset.PresetIsEditableMethodInfo
    ResolveVideoEncoderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveVideoEncoderMethod "isLockedState" o = Gst.Element.ElementIsLockedStateMethodInfo
    ResolveVideoEncoderMethod "isQosEnabled" o = VideoEncoderIsQosEnabledMethodInfo
    ResolveVideoEncoderMethod "iteratePads" o = Gst.Element.ElementIteratePadsMethodInfo
    ResolveVideoEncoderMethod "iterateSinkPads" o = Gst.Element.ElementIterateSinkPadsMethodInfo
    ResolveVideoEncoderMethod "iterateSrcPads" o = Gst.Element.ElementIterateSrcPadsMethodInfo
    ResolveVideoEncoderMethod "link" o = Gst.Element.ElementLinkMethodInfo
    ResolveVideoEncoderMethod "linkFiltered" o = Gst.Element.ElementLinkFilteredMethodInfo
    ResolveVideoEncoderMethod "linkPads" o = Gst.Element.ElementLinkPadsMethodInfo
    ResolveVideoEncoderMethod "linkPadsFiltered" o = Gst.Element.ElementLinkPadsFilteredMethodInfo
    ResolveVideoEncoderMethod "linkPadsFull" o = Gst.Element.ElementLinkPadsFullMethodInfo
    ResolveVideoEncoderMethod "loadPreset" o = Gst.Preset.PresetLoadPresetMethodInfo
    ResolveVideoEncoderMethod "lostState" o = Gst.Element.ElementLostStateMethodInfo
    ResolveVideoEncoderMethod "mergeTags" o = VideoEncoderMergeTagsMethodInfo
    ResolveVideoEncoderMethod "messageFull" o = Gst.Element.ElementMessageFullMethodInfo
    ResolveVideoEncoderMethod "messageFullWithDetails" o = Gst.Element.ElementMessageFullWithDetailsMethodInfo
    ResolveVideoEncoderMethod "negotiate" o = VideoEncoderNegotiateMethodInfo
    ResolveVideoEncoderMethod "noMorePads" o = Gst.Element.ElementNoMorePadsMethodInfo
    ResolveVideoEncoderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveVideoEncoderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveVideoEncoderMethod "postMessage" o = Gst.Element.ElementPostMessageMethodInfo
    ResolveVideoEncoderMethod "provideClock" o = Gst.Element.ElementProvideClockMethodInfo
    ResolveVideoEncoderMethod "proxyGetcaps" o = VideoEncoderProxyGetcapsMethodInfo
    ResolveVideoEncoderMethod "query" o = Gst.Element.ElementQueryMethodInfo
    ResolveVideoEncoderMethod "queryConvert" o = Gst.Element.ElementQueryConvertMethodInfo
    ResolveVideoEncoderMethod "queryDuration" o = Gst.Element.ElementQueryDurationMethodInfo
    ResolveVideoEncoderMethod "queryPosition" o = Gst.Element.ElementQueryPositionMethodInfo
    ResolveVideoEncoderMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveVideoEncoderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveVideoEncoderMethod "releaseRequestPad" o = Gst.Element.ElementReleaseRequestPadMethodInfo
    ResolveVideoEncoderMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveVideoEncoderMethod "removePad" o = Gst.Element.ElementRemovePadMethodInfo
    ResolveVideoEncoderMethod "removePropertyNotifyWatch" o = Gst.Element.ElementRemovePropertyNotifyWatchMethodInfo
    ResolveVideoEncoderMethod "renamePreset" o = Gst.Preset.PresetRenamePresetMethodInfo
    ResolveVideoEncoderMethod "requestPad" o = Gst.Element.ElementRequestPadMethodInfo
    ResolveVideoEncoderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveVideoEncoderMethod "savePreset" o = Gst.Preset.PresetSavePresetMethodInfo
    ResolveVideoEncoderMethod "seek" o = Gst.Element.ElementSeekMethodInfo
    ResolveVideoEncoderMethod "seekSimple" o = Gst.Element.ElementSeekSimpleMethodInfo
    ResolveVideoEncoderMethod "sendEvent" o = Gst.Element.ElementSendEventMethodInfo
    ResolveVideoEncoderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveVideoEncoderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveVideoEncoderMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveVideoEncoderMethod "syncStateWithParent" o = Gst.Element.ElementSyncStateWithParentMethodInfo
    ResolveVideoEncoderMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveVideoEncoderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveVideoEncoderMethod "unlink" o = Gst.Element.ElementUnlinkMethodInfo
    ResolveVideoEncoderMethod "unlinkPads" o = Gst.Element.ElementUnlinkPadsMethodInfo
    ResolveVideoEncoderMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveVideoEncoderMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveVideoEncoderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveVideoEncoderMethod "getAllocator" o = VideoEncoderGetAllocatorMethodInfo
    ResolveVideoEncoderMethod "getBaseTime" o = Gst.Element.ElementGetBaseTimeMethodInfo
    ResolveVideoEncoderMethod "getBus" o = Gst.Element.ElementGetBusMethodInfo
    ResolveVideoEncoderMethod "getClock" o = Gst.Element.ElementGetClockMethodInfo
    ResolveVideoEncoderMethod "getCompatiblePad" o = Gst.Element.ElementGetCompatiblePadMethodInfo
    ResolveVideoEncoderMethod "getCompatiblePadTemplate" o = Gst.Element.ElementGetCompatiblePadTemplateMethodInfo
    ResolveVideoEncoderMethod "getContext" o = Gst.Element.ElementGetContextMethodInfo
    ResolveVideoEncoderMethod "getContextUnlocked" o = Gst.Element.ElementGetContextUnlockedMethodInfo
    ResolveVideoEncoderMethod "getContexts" o = Gst.Element.ElementGetContextsMethodInfo
    ResolveVideoEncoderMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveVideoEncoderMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveVideoEncoderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveVideoEncoderMethod "getFactory" o = Gst.Element.ElementGetFactoryMethodInfo
    ResolveVideoEncoderMethod "getFrame" o = VideoEncoderGetFrameMethodInfo
    ResolveVideoEncoderMethod "getFrames" o = VideoEncoderGetFramesMethodInfo
    ResolveVideoEncoderMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveVideoEncoderMethod "getLatency" o = VideoEncoderGetLatencyMethodInfo
    ResolveVideoEncoderMethod "getMaxEncodeTime" o = VideoEncoderGetMaxEncodeTimeMethodInfo
    ResolveVideoEncoderMethod "getMeta" o = Gst.Preset.PresetGetMetaMethodInfo
    ResolveVideoEncoderMethod "getMetadata" o = Gst.Element.ElementGetMetadataMethodInfo
    ResolveVideoEncoderMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveVideoEncoderMethod "getOldestFrame" o = VideoEncoderGetOldestFrameMethodInfo
    ResolveVideoEncoderMethod "getOutputState" o = VideoEncoderGetOutputStateMethodInfo
    ResolveVideoEncoderMethod "getPadTemplate" o = Gst.Element.ElementGetPadTemplateMethodInfo
    ResolveVideoEncoderMethod "getPadTemplateList" o = Gst.Element.ElementGetPadTemplateListMethodInfo
    ResolveVideoEncoderMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveVideoEncoderMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveVideoEncoderMethod "getPresetNames" o = Gst.Preset.PresetGetPresetNamesMethodInfo
    ResolveVideoEncoderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveVideoEncoderMethod "getPropertyNames" o = Gst.Preset.PresetGetPropertyNamesMethodInfo
    ResolveVideoEncoderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveVideoEncoderMethod "getRequestPad" o = Gst.Element.ElementGetRequestPadMethodInfo
    ResolveVideoEncoderMethod "getStartTime" o = Gst.Element.ElementGetStartTimeMethodInfo
    ResolveVideoEncoderMethod "getState" o = Gst.Element.ElementGetStateMethodInfo
    ResolveVideoEncoderMethod "getStaticPad" o = Gst.Element.ElementGetStaticPadMethodInfo
    ResolveVideoEncoderMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveVideoEncoderMethod "setBaseTime" o = Gst.Element.ElementSetBaseTimeMethodInfo
    ResolveVideoEncoderMethod "setBus" o = Gst.Element.ElementSetBusMethodInfo
    ResolveVideoEncoderMethod "setClock" o = Gst.Element.ElementSetClockMethodInfo
    ResolveVideoEncoderMethod "setContext" o = Gst.Element.ElementSetContextMethodInfo
    ResolveVideoEncoderMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveVideoEncoderMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveVideoEncoderMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveVideoEncoderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveVideoEncoderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveVideoEncoderMethod "setHeaders" o = VideoEncoderSetHeadersMethodInfo
    ResolveVideoEncoderMethod "setLatency" o = VideoEncoderSetLatencyMethodInfo
    ResolveVideoEncoderMethod "setLockedState" o = Gst.Element.ElementSetLockedStateMethodInfo
    ResolveVideoEncoderMethod "setMeta" o = Gst.Preset.PresetSetMetaMethodInfo
    ResolveVideoEncoderMethod "setMinPts" o = VideoEncoderSetMinPtsMethodInfo
    ResolveVideoEncoderMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveVideoEncoderMethod "setOutputState" o = VideoEncoderSetOutputStateMethodInfo
    ResolveVideoEncoderMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveVideoEncoderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveVideoEncoderMethod "setQosEnabled" o = VideoEncoderSetQosEnabledMethodInfo
    ResolveVideoEncoderMethod "setStartTime" o = Gst.Element.ElementSetStartTimeMethodInfo
    ResolveVideoEncoderMethod "setState" o = Gst.Element.ElementSetStateMethodInfo
    ResolveVideoEncoderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveVideoEncoderMethod t VideoEncoder, O.MethodInfo info VideoEncoder p) => OL.IsLabel t (VideoEncoder -> 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

-- VVV Prop "qos"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@qos@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' videoEncoder #qos
@
-}
getVideoEncoderQos :: (MonadIO m, IsVideoEncoder o) => o -> m Bool
getVideoEncoderQos obj = liftIO $ B.Properties.getObjectPropertyBool obj "qos"

{- |
Set the value of the “@qos@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' videoEncoder [ #qos 'Data.GI.Base.Attributes.:=' value ]
@
-}
setVideoEncoderQos :: (MonadIO m, IsVideoEncoder o) => o -> Bool -> m ()
setVideoEncoderQos obj val = liftIO $ B.Properties.setObjectPropertyBool obj "qos" val

{- |
Construct a `GValueConstruct` with valid value for the “@qos@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructVideoEncoderQos :: (IsVideoEncoder o) => Bool -> IO (GValueConstruct o)
constructVideoEncoderQos val = B.Properties.constructObjectPropertyBool "qos" val

#if ENABLE_OVERLOADING
data VideoEncoderQosPropertyInfo
instance AttrInfo VideoEncoderQosPropertyInfo where
    type AttrAllowedOps VideoEncoderQosPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint VideoEncoderQosPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint VideoEncoderQosPropertyInfo = IsVideoEncoder
    type AttrGetType VideoEncoderQosPropertyInfo = Bool
    type AttrLabel VideoEncoderQosPropertyInfo = "qos"
    type AttrOrigin VideoEncoderQosPropertyInfo = VideoEncoder
    attrGet _ = getVideoEncoderQos
    attrSet _ = setVideoEncoderQos
    attrConstruct _ = constructVideoEncoderQos
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList VideoEncoder
type instance O.AttributeList VideoEncoder = VideoEncoderAttributeList
type VideoEncoderAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("qos", VideoEncoderQosPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
videoEncoderQos :: AttrLabelProxy "qos"
videoEncoderQos = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList VideoEncoder = VideoEncoderSignalList
type VideoEncoderSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("noMorePads", Gst.Element.ElementNoMorePadsSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("padAdded", Gst.Element.ElementPadAddedSignalInfo), '("padRemoved", Gst.Element.ElementPadRemovedSignalInfo)] :: [(Symbol, *)])

#endif

-- method VideoEncoder::allocate_output_buffer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size of the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Buffer"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_allocate_output_buffer" gst_video_encoder_allocate_output_buffer ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Word64 ->                               -- size : TBasicType TUInt64
    IO (Ptr Gst.Buffer.Buffer)

{- |
Helper function that allocates a buffer to hold an encoded video frame
for /@encoder@/\'s current 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState'.
-}
videoEncoderAllocateOutputBuffer ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> Word64
    {- ^ /@size@/: size of the buffer -}
    -> m Gst.Buffer.Buffer
    {- ^ __Returns:__ allocated buffer -}
videoEncoderAllocateOutputBuffer encoder size = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    result <- gst_video_encoder_allocate_output_buffer encoder' size
    checkUnexpectedReturnNULL "videoEncoderAllocateOutputBuffer" result
    result' <- (wrapBoxed Gst.Buffer.Buffer) result
    touchManagedPtr encoder
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderAllocateOutputBufferMethodInfo
instance (signature ~ (Word64 -> m Gst.Buffer.Buffer), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderAllocateOutputBufferMethodInfo a signature where
    overloadedMethod _ = videoEncoderAllocateOutputBuffer

#endif

-- method VideoEncoder::allocate_output_frame
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "frame", argType = TInterface (Name {namespace = "GstVideo", name = "VideoCodecFrame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoCodecFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size of the buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_allocate_output_frame" gst_video_encoder_allocate_output_frame ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr GstVideo.VideoCodecFrame.VideoCodecFrame -> -- frame : TInterface (Name {namespace = "GstVideo", name = "VideoCodecFrame"})
    Word64 ->                               -- size : TBasicType TUInt64
    IO CInt

{- |
Helper function that allocates a buffer to hold an encoded video frame for /@encoder@/\'s
current 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState'.  Subclass should already have configured video
state and set src pad caps.

The buffer allocated here is owned by the frame and you should only
keep references to the frame, not the buffer.
-}
videoEncoderAllocateOutputFrame ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> GstVideo.VideoCodecFrame.VideoCodecFrame
    {- ^ /@frame@/: a 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame' -}
    -> Word64
    {- ^ /@size@/: size of the buffer -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ 'GI.Gst.Enums.FlowReturnOk' if an output buffer could be allocated -}
videoEncoderAllocateOutputFrame encoder frame size = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    frame' <- unsafeManagedPtrGetPtr frame
    result <- gst_video_encoder_allocate_output_frame encoder' frame' size
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr encoder
    touchManagedPtr frame
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderAllocateOutputFrameMethodInfo
instance (signature ~ (GstVideo.VideoCodecFrame.VideoCodecFrame -> Word64 -> m Gst.Enums.FlowReturn), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderAllocateOutputFrameMethodInfo a signature where
    overloadedMethod _ = videoEncoderAllocateOutputFrame

#endif

-- method VideoEncoder::finish_frame
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "frame", argType = TInterface (Name {namespace = "GstVideo", name = "VideoCodecFrame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an encoded #GstVideoCodecFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "FlowReturn"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_finish_frame" gst_video_encoder_finish_frame ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr GstVideo.VideoCodecFrame.VideoCodecFrame -> -- frame : TInterface (Name {namespace = "GstVideo", name = "VideoCodecFrame"})
    IO CInt

{- |
/@frame@/ must have a valid encoded data buffer, whose metadata fields
are then appropriately set according to frame data or no buffer at
all if the frame should be dropped.
It is subsequently pushed downstream or provided to /@prePush@/.
In any case, the frame is considered finished and released.

After calling this function the output buffer of the frame is to be
considered read-only. This function will also change the metadata
of the buffer.
-}
videoEncoderFinishFrame ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> GstVideo.VideoCodecFrame.VideoCodecFrame
    {- ^ /@frame@/: an encoded 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame' -}
    -> m Gst.Enums.FlowReturn
    {- ^ __Returns:__ a 'GI.Gst.Enums.FlowReturn' resulting from sending data downstream -}
videoEncoderFinishFrame encoder frame = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    frame' <- B.ManagedPtr.disownBoxed frame
    result <- gst_video_encoder_finish_frame encoder' frame'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr encoder
    touchManagedPtr frame
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderFinishFrameMethodInfo
instance (signature ~ (GstVideo.VideoCodecFrame.VideoCodecFrame -> m Gst.Enums.FlowReturn), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderFinishFrameMethodInfo a signature where
    overloadedMethod _ = videoEncoderFinishFrame

#endif

-- method VideoEncoder::get_allocator
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allocator", argType = TInterface (Name {namespace = "Gst", name = "Allocator"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstAllocator\nused", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "AllocationParams"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the\n#GstAllocationParams of @allocator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_get_allocator" gst_video_encoder_get_allocator ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr (Ptr Gst.Allocator.Allocator) ->    -- allocator : TInterface (Name {namespace = "Gst", name = "Allocator"})
    Ptr Gst.AllocationParams.AllocationParams -> -- params : TInterface (Name {namespace = "Gst", name = "AllocationParams"})
    IO ()

{- |
Lets 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' sub-classes to know the memory /@allocator@/
used by the base class and its /@params@/.

Unref the /@allocator@/ after use it.
-}
videoEncoderGetAllocator ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> m ((Gst.Allocator.Allocator, Gst.AllocationParams.AllocationParams))
videoEncoderGetAllocator encoder = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    allocator <- allocMem :: IO (Ptr (Ptr Gst.Allocator.Allocator))
    params <- callocBoxedBytes 64 :: IO (Ptr Gst.AllocationParams.AllocationParams)
    gst_video_encoder_get_allocator encoder' allocator params
    allocator' <- peek allocator
    allocator'' <- (wrapObject Gst.Allocator.Allocator) allocator'
    params' <- (wrapBoxed Gst.AllocationParams.AllocationParams) params
    touchManagedPtr encoder
    freeMem allocator
    return (allocator'', params')

#if ENABLE_OVERLOADING
data VideoEncoderGetAllocatorMethodInfo
instance (signature ~ (m ((Gst.Allocator.Allocator, Gst.AllocationParams.AllocationParams))), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderGetAllocatorMethodInfo a signature where
    overloadedMethod _ = videoEncoderGetAllocator

#endif

-- method VideoEncoder::get_frame
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "frame_number", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "system_frame_number of a frame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoCodecFrame"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_get_frame" gst_video_encoder_get_frame ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Int32 ->                                -- frame_number : TBasicType TInt
    IO (Ptr GstVideo.VideoCodecFrame.VideoCodecFrame)

{- |
Get a pending unfinished 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame'
-}
videoEncoderGetFrame ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> Int32
    {- ^ /@frameNumber@/: system_frame_number of a frame -}
    -> m GstVideo.VideoCodecFrame.VideoCodecFrame
    {- ^ __Returns:__ pending unfinished 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame' identified by /@frameNumber@/. -}
videoEncoderGetFrame encoder frameNumber = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    result <- gst_video_encoder_get_frame encoder' frameNumber
    checkUnexpectedReturnNULL "videoEncoderGetFrame" result
    result' <- (wrapBoxed GstVideo.VideoCodecFrame.VideoCodecFrame) result
    touchManagedPtr encoder
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderGetFrameMethodInfo
instance (signature ~ (Int32 -> m GstVideo.VideoCodecFrame.VideoCodecFrame), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderGetFrameMethodInfo a signature where
    overloadedMethod _ = videoEncoderGetFrame

#endif

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

foreign import ccall "gst_video_encoder_get_frames" gst_video_encoder_get_frames ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    IO (Ptr (GList (Ptr GstVideo.VideoCodecFrame.VideoCodecFrame)))

{- |
Get all pending unfinished 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame'
-}
videoEncoderGetFrames ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> m [GstVideo.VideoCodecFrame.VideoCodecFrame]
    {- ^ __Returns:__ pending unfinished 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame'. -}
videoEncoderGetFrames encoder = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    result <- gst_video_encoder_get_frames encoder'
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed GstVideo.VideoCodecFrame.VideoCodecFrame) result'
    g_list_free result
    touchManagedPtr encoder
    return result''

#if ENABLE_OVERLOADING
data VideoEncoderGetFramesMethodInfo
instance (signature ~ (m [GstVideo.VideoCodecFrame.VideoCodecFrame]), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderGetFramesMethodInfo a signature where
    overloadedMethod _ = videoEncoderGetFrames

#endif

-- method VideoEncoder::get_latency
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_latency", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "address of variable in which to store the\n    configured minimum latency, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "max_latency", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "address of variable in which to store the\n    configured maximum latency, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_get_latency" gst_video_encoder_get_latency ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr Word64 ->                           -- min_latency : TBasicType TUInt64
    Ptr Word64 ->                           -- max_latency : TBasicType TUInt64
    IO ()

{- |
Query the configured encoding latency. Results will be returned via
/@minLatency@/ and /@maxLatency@/.
-}
videoEncoderGetLatency ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> m ((Word64, Word64))
videoEncoderGetLatency encoder = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    minLatency <- allocMem :: IO (Ptr Word64)
    maxLatency <- allocMem :: IO (Ptr Word64)
    gst_video_encoder_get_latency encoder' minLatency maxLatency
    minLatency' <- peek minLatency
    maxLatency' <- peek maxLatency
    touchManagedPtr encoder
    freeMem minLatency
    freeMem maxLatency
    return (minLatency', maxLatency')

#if ENABLE_OVERLOADING
data VideoEncoderGetLatencyMethodInfo
instance (signature ~ (m ((Word64, Word64))), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderGetLatencyMethodInfo a signature where
    overloadedMethod _ = videoEncoderGetLatency

#endif

-- method VideoEncoder::get_max_encode_time
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "frame", argType = TInterface (Name {namespace = "GstVideo", name = "VideoCodecFrame"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoCodecFrame", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_get_max_encode_time" gst_video_encoder_get_max_encode_time ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr GstVideo.VideoCodecFrame.VideoCodecFrame -> -- frame : TInterface (Name {namespace = "GstVideo", name = "VideoCodecFrame"})
    IO Int64

{- |
Determines maximum possible encoding time for /@frame@/ that will
allow it to encode and arrive in time (as determined by QoS events).
In particular, a negative result means encoding in time is no longer possible
and should therefore occur as soon\/skippy as possible.

If no QoS events have been received from downstream, or if
'GI.GstVideo.Objects.VideoEncoder.VideoEncoder':@/qos/@ is disabled this function returns 'GI.GLib.Constants.MAXINT64'.

/Since: 1.14/
-}
videoEncoderGetMaxEncodeTime ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> GstVideo.VideoCodecFrame.VideoCodecFrame
    {- ^ /@frame@/: a 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame' -}
    -> m Int64
    {- ^ __Returns:__ max decoding time. -}
videoEncoderGetMaxEncodeTime encoder frame = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    frame' <- unsafeManagedPtrGetPtr frame
    result <- gst_video_encoder_get_max_encode_time encoder' frame'
    touchManagedPtr encoder
    touchManagedPtr frame
    return result

#if ENABLE_OVERLOADING
data VideoEncoderGetMaxEncodeTimeMethodInfo
instance (signature ~ (GstVideo.VideoCodecFrame.VideoCodecFrame -> m Int64), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderGetMaxEncodeTimeMethodInfo a signature where
    overloadedMethod _ = videoEncoderGetMaxEncodeTime

#endif

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

foreign import ccall "gst_video_encoder_get_oldest_frame" gst_video_encoder_get_oldest_frame ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    IO (Ptr GstVideo.VideoCodecFrame.VideoCodecFrame)

{- |
Get the oldest unfinished pending 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame'
-}
videoEncoderGetOldestFrame ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> m GstVideo.VideoCodecFrame.VideoCodecFrame
    {- ^ __Returns:__ oldest unfinished pending 'GI.GstVideo.Structs.VideoCodecFrame.VideoCodecFrame' -}
videoEncoderGetOldestFrame encoder = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    result <- gst_video_encoder_get_oldest_frame encoder'
    checkUnexpectedReturnNULL "videoEncoderGetOldestFrame" result
    result' <- (wrapBoxed GstVideo.VideoCodecFrame.VideoCodecFrame) result
    touchManagedPtr encoder
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderGetOldestFrameMethodInfo
instance (signature ~ (m GstVideo.VideoCodecFrame.VideoCodecFrame), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderGetOldestFrameMethodInfo a signature where
    overloadedMethod _ = videoEncoderGetOldestFrame

#endif

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

foreign import ccall "gst_video_encoder_get_output_state" gst_video_encoder_get_output_state ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    IO (Ptr GstVideo.VideoCodecState.VideoCodecState)

{- |
Get the current 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState'
-}
videoEncoderGetOutputState ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> m GstVideo.VideoCodecState.VideoCodecState
    {- ^ __Returns:__ 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState' describing format of video data. -}
videoEncoderGetOutputState encoder = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    result <- gst_video_encoder_get_output_state encoder'
    checkUnexpectedReturnNULL "videoEncoderGetOutputState" result
    result' <- (wrapBoxed GstVideo.VideoCodecState.VideoCodecState) result
    touchManagedPtr encoder
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderGetOutputStateMethodInfo
instance (signature ~ (m GstVideo.VideoCodecState.VideoCodecState), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderGetOutputStateMethodInfo a signature where
    overloadedMethod _ = videoEncoderGetOutputState

#endif

-- method VideoEncoder::is_qos_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the encoder", 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_encoder_is_qos_enabled" gst_video_encoder_is_qos_enabled ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    IO CInt

{- |
Checks if /@encoder@/ is currently configured to handle Quality-of-Service
events from downstream.

/Since: 1.14/
-}
videoEncoderIsQosEnabled ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: the encoder -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the encoder is configured to perform Quality-of-Service. -}
videoEncoderIsQosEnabled encoder = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    result <- gst_video_encoder_is_qos_enabled encoder'
    let result' = (/= 0) result
    touchManagedPtr encoder
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderIsQosEnabledMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderIsQosEnabledMethodInfo a signature where
    overloadedMethod _ = videoEncoderIsQosEnabled

#endif

-- method VideoEncoder::merge_tags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tags", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstTagList to merge, or NULL to unset\n    previously-set tags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "TagMergeMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstTagMergeMode to use, usually #GST_TAG_MERGE_REPLACE", 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_encoder_merge_tags" gst_video_encoder_merge_tags ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr Gst.TagList.TagList ->              -- tags : TInterface (Name {namespace = "Gst", name = "TagList"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "TagMergeMode"})
    IO ()

{- |
Sets the video encoder tags and how they should be merged with any
upstream stream tags. This will override any tags previously-set
with 'GI.GstVideo.Objects.VideoEncoder.videoEncoderMergeTags'.

Note that this is provided for convenience, and the subclass is
not required to use this and can still do tag handling on its own.

MT safe.
-}
videoEncoderMergeTags ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> Maybe (Gst.TagList.TagList)
    {- ^ /@tags@/: a 'GI.Gst.Structs.TagList.TagList' to merge, or NULL to unset
    previously-set tags -}
    -> Gst.Enums.TagMergeMode
    {- ^ /@mode@/: the 'GI.Gst.Enums.TagMergeMode' to use, usually @/GST_TAG_MERGE_REPLACE/@ -}
    -> m ()
videoEncoderMergeTags encoder tags mode = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    maybeTags <- case tags of
        Nothing -> return nullPtr
        Just jTags -> do
            jTags' <- unsafeManagedPtrGetPtr jTags
            return jTags'
    let mode' = (fromIntegral . fromEnum) mode
    gst_video_encoder_merge_tags encoder' maybeTags mode'
    touchManagedPtr encoder
    whenJust tags touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data VideoEncoderMergeTagsMethodInfo
instance (signature ~ (Maybe (Gst.TagList.TagList) -> Gst.Enums.TagMergeMode -> m ()), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderMergeTagsMethodInfo a signature where
    overloadedMethod _ = videoEncoderMergeTags

#endif

-- method VideoEncoder::negotiate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", 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_encoder_negotiate" gst_video_encoder_negotiate ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    IO CInt

{- |
Negotiate with downstream elements to currently configured 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState'.
Unmark GST_PAD_FLAG_NEED_RECONFIGURE in any case. But mark it again if
negotiate fails.
-}
videoEncoderNegotiate ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the negotiation succeeded, else 'False'. -}
videoEncoderNegotiate encoder = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    result <- gst_video_encoder_negotiate encoder'
    let result' = (/= 0) result
    touchManagedPtr encoder
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderNegotiateMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderNegotiateMethodInfo a signature where
    overloadedMethod _ = videoEncoderNegotiate

#endif

-- method VideoEncoder::proxy_getcaps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "enc", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "initial caps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "filter caps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_proxy_getcaps" gst_video_encoder_proxy_getcaps ::
    Ptr VideoEncoder ->                     -- enc : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr Gst.Caps.Caps ->                    -- filter : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO (Ptr Gst.Caps.Caps)

{- |
Returns caps that express /@caps@/ (or sink template caps if /@caps@/ == NULL)
restricted to resolution\/format\/... combinations supported by downstream
elements (e.g. muxers).
-}
videoEncoderProxyGetcaps ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@enc@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> Maybe (Gst.Caps.Caps)
    {- ^ /@caps@/: initial caps -}
    -> Maybe (Gst.Caps.Caps)
    {- ^ /@filter@/: filter caps -}
    -> m Gst.Caps.Caps
    {- ^ __Returns:__ a 'GI.Gst.Structs.Caps.Caps' owned by caller -}
videoEncoderProxyGetcaps enc caps filter = liftIO $ do
    enc' <- unsafeManagedPtrCastPtr enc
    maybeCaps <- case caps of
        Nothing -> return nullPtr
        Just jCaps -> do
            jCaps' <- unsafeManagedPtrGetPtr jCaps
            return jCaps'
    maybeFilter <- case filter of
        Nothing -> return nullPtr
        Just jFilter -> do
            jFilter' <- unsafeManagedPtrGetPtr jFilter
            return jFilter'
    result <- gst_video_encoder_proxy_getcaps enc' maybeCaps maybeFilter
    checkUnexpectedReturnNULL "videoEncoderProxyGetcaps" result
    result' <- (wrapBoxed Gst.Caps.Caps) result
    touchManagedPtr enc
    whenJust caps touchManagedPtr
    whenJust filter touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderProxyGetcapsMethodInfo
instance (signature ~ (Maybe (Gst.Caps.Caps) -> Maybe (Gst.Caps.Caps) -> m Gst.Caps.Caps), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderProxyGetcapsMethodInfo a signature where
    overloadedMethod _ = videoEncoderProxyGetcaps

#endif

-- method VideoEncoder::set_headers
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "headers", argType = TGList (TInterface (Name {namespace = "Gst", name = "Buffer"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a list of #GstBuffer containing the codec header", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_set_headers" gst_video_encoder_set_headers ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr (GList (Ptr Gst.Buffer.Buffer)) ->  -- headers : TGList (TInterface (Name {namespace = "Gst", name = "Buffer"}))
    IO ()

{- |
Set the codec headers to be sent downstream whenever requested.
-}
videoEncoderSetHeaders ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> [Gst.Buffer.Buffer]
    {- ^ /@headers@/: a list of 'GI.Gst.Structs.Buffer.Buffer' containing the codec header -}
    -> m ()
videoEncoderSetHeaders encoder headers = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    headers' <- mapM B.ManagedPtr.disownBoxed headers
    headers'' <- packGList headers'
    gst_video_encoder_set_headers encoder' headers''
    touchManagedPtr encoder
    mapM_ touchManagedPtr headers
    return ()

#if ENABLE_OVERLOADING
data VideoEncoderSetHeadersMethodInfo
instance (signature ~ ([Gst.Buffer.Buffer] -> m ()), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderSetHeadersMethodInfo a signature where
    overloadedMethod _ = videoEncoderSetHeaders

#endif

-- method VideoEncoder::set_latency
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_latency", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "minimum latency", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_latency", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "maximum latency", 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_encoder_set_latency" gst_video_encoder_set_latency ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Word64 ->                               -- min_latency : TBasicType TUInt64
    Word64 ->                               -- max_latency : TBasicType TUInt64
    IO ()

{- |
Informs baseclass of encoding latency.
-}
videoEncoderSetLatency ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> Word64
    {- ^ /@minLatency@/: minimum latency -}
    -> Word64
    {- ^ /@maxLatency@/: maximum latency -}
    -> m ()
videoEncoderSetLatency encoder minLatency maxLatency = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    gst_video_encoder_set_latency encoder' minLatency maxLatency
    touchManagedPtr encoder
    return ()

#if ENABLE_OVERLOADING
data VideoEncoderSetLatencyMethodInfo
instance (signature ~ (Word64 -> Word64 -> m ()), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderSetLatencyMethodInfo a signature where
    overloadedMethod _ = videoEncoderSetLatency

#endif

-- method VideoEncoder::set_min_pts
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_pts", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "minimal PTS that will be passed to handle_frame", 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_encoder_set_min_pts" gst_video_encoder_set_min_pts ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Word64 ->                               -- min_pts : TBasicType TUInt64
    IO ()

{- |
Request minimal value for PTS passed to handle_frame.

For streams with reordered frames this can be used to ensure that there
is enough time to accomodate first DTS, which may be less than first PTS

Since 1.6
-}
videoEncoderSetMinPts ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> Word64
    {- ^ /@minPts@/: minimal PTS that will be passed to handle_frame -}
    -> m ()
videoEncoderSetMinPts encoder minPts = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    gst_video_encoder_set_min_pts encoder' minPts
    touchManagedPtr encoder
    return ()

#if ENABLE_OVERLOADING
data VideoEncoderSetMinPtsMethodInfo
instance (signature ~ (Word64 -> m ()), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderSetMinPtsMethodInfo a signature where
    overloadedMethod _ = videoEncoderSetMinPts

#endif

-- method VideoEncoder::set_output_state
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCaps to use for the output", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "reference", argType = TInterface (Name {namespace = "GstVideo", name = "VideoCodecState"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "An optional reference @GstVideoCodecState", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoCodecState"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_encoder_set_output_state" gst_video_encoder_set_output_state ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr GstVideo.VideoCodecState.VideoCodecState -> -- reference : TInterface (Name {namespace = "GstVideo", name = "VideoCodecState"})
    IO (Ptr GstVideo.VideoCodecState.VideoCodecState)

{- |
Creates a new 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState' with the specified caps as the output state
for the encoder.
Any previously set output state on /@encoder@/ will be replaced by the newly
created one.

The specified /@caps@/ should not contain any resolution, pixel-aspect-ratio,
framerate, codec-data, .... Those should be specified instead in the returned
'GI.GstVideo.Structs.VideoCodecState.VideoCodecState'.

If the subclass wishes to copy over existing fields (like pixel aspect ratio,
or framerate) from an existing 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState', it can be provided as a
/@reference@/.

If the subclass wishes to override some fields from the output state (like
pixel-aspect-ratio or framerate) it can do so on the returned 'GI.GstVideo.Structs.VideoCodecState.VideoCodecState'.

The new output state will only take effect (set on pads and buffers) starting
from the next call to @/gst_video_encoder_finish_frame/@().
-}
videoEncoderSetOutputState ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: a 'GI.GstVideo.Objects.VideoEncoder.VideoEncoder' -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: the 'GI.Gst.Structs.Caps.Caps' to use for the output -}
    -> Maybe (GstVideo.VideoCodecState.VideoCodecState)
    {- ^ /@reference@/: An optional reference /@gstVideoCodecState@/ -}
    -> m GstVideo.VideoCodecState.VideoCodecState
    {- ^ __Returns:__ the newly configured output state. -}
videoEncoderSetOutputState encoder caps reference = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    caps' <- B.ManagedPtr.disownBoxed caps
    maybeReference <- case reference of
        Nothing -> return nullPtr
        Just jReference -> do
            jReference' <- unsafeManagedPtrGetPtr jReference
            return jReference'
    result <- gst_video_encoder_set_output_state encoder' caps' maybeReference
    checkUnexpectedReturnNULL "videoEncoderSetOutputState" result
    result' <- (wrapBoxed GstVideo.VideoCodecState.VideoCodecState) result
    touchManagedPtr encoder
    touchManagedPtr caps
    whenJust reference touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
data VideoEncoderSetOutputStateMethodInfo
instance (signature ~ (Gst.Caps.Caps -> Maybe (GstVideo.VideoCodecState.VideoCodecState) -> m GstVideo.VideoCodecState.VideoCodecState), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderSetOutputStateMethodInfo a signature where
    overloadedMethod _ = videoEncoderSetOutputState

#endif

-- method VideoEncoder::set_qos_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the encoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new qos value.", 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_encoder_set_qos_enabled" gst_video_encoder_set_qos_enabled ::
    Ptr VideoEncoder ->                     -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoEncoder"})
    CInt ->                                 -- enabled : TBasicType TBoolean
    IO ()

{- |
Configures /@encoder@/ to handle Quality-of-Service events from downstream.

/Since: 1.14/
-}
videoEncoderSetQosEnabled ::
    (B.CallStack.HasCallStack, MonadIO m, IsVideoEncoder a) =>
    a
    {- ^ /@encoder@/: the encoder -}
    -> Bool
    {- ^ /@enabled@/: the new qos value. -}
    -> m ()
videoEncoderSetQosEnabled encoder enabled = liftIO $ do
    encoder' <- unsafeManagedPtrCastPtr encoder
    let enabled' = (fromIntegral . fromEnum) enabled
    gst_video_encoder_set_qos_enabled encoder' enabled'
    touchManagedPtr encoder
    return ()

#if ENABLE_OVERLOADING
data VideoEncoderSetQosEnabledMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsVideoEncoder a) => O.MethodInfo VideoEncoderSetQosEnabledMethodInfo a signature where
    overloadedMethod _ = videoEncoderSetQosEnabled

#endif