gi-gstvideo-0.1.6.13: GI/GstVideo/Structs/VideoCodecState.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
Structure representing the state of an incoming or outgoing video
stream for encoders and decoders.
Decoders and encoders will receive such a state through their
respective @set_format vmethods.
Decoders and encoders can set the downstream state, by using the
@gst_video_decoder_set_output_state() or
@gst_video_encoder_set_output_state() methods.
-}
module GI.GstVideo.Structs.VideoCodecState
(
-- * Exported types
VideoCodecState(..) ,
newZeroVideoCodecState ,
noVideoCodecState ,
-- * Methods
-- ** videoCodecStateRef
VideoCodecStateRefMethodInfo ,
videoCodecStateRef ,
-- ** videoCodecStateUnref
VideoCodecStateUnrefMethodInfo ,
videoCodecStateUnref ,
-- * Properties
-- ** Caps
videoCodecStateReadCaps ,
-- ** CodecData
videoCodecStateReadCodecData ,
-- ** Info
videoCodecStateReadInfo ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.GstVideo.Types
import GI.GstVideo.Callbacks
import qualified GI.Gst as Gst
newtype VideoCodecState = VideoCodecState (ForeignPtr VideoCodecState)
foreign import ccall "gst_video_codec_state_get_type" c_gst_video_codec_state_get_type ::
IO GType
instance BoxedObject VideoCodecState where
boxedType _ = c_gst_video_codec_state_get_type
-- | Construct a `VideoCodecState` struct initialized to zero.
newZeroVideoCodecState :: MonadIO m => m VideoCodecState
newZeroVideoCodecState = liftIO $ callocBoxedBytes 304 >>= wrapBoxed VideoCodecState
noVideoCodecState :: Maybe VideoCodecState
noVideoCodecState = Nothing
videoCodecStateReadInfo :: VideoCodecState -> IO VideoInfo
videoCodecStateReadInfo s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr VideoInfo)
val' <- (newBoxed VideoInfo) val
return val'
videoCodecStateReadCaps :: VideoCodecState -> IO Gst.Caps
videoCodecStateReadCaps s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 128) :: IO (Ptr Gst.Caps)
val' <- (newBoxed Gst.Caps) val
return val'
videoCodecStateReadCodecData :: VideoCodecState -> IO Gst.Buffer
videoCodecStateReadCodecData s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 136) :: IO (Ptr Gst.Buffer)
val' <- (newBoxed Gst.Buffer) val
return val'
-- method VideoCodecState::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "GstVideo" "VideoCodecState", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "GstVideo" "VideoCodecState"
-- throws : False
-- Skip return : False
foreign import ccall "gst_video_codec_state_ref" gst_video_codec_state_ref ::
Ptr VideoCodecState -> -- _obj : TInterface "GstVideo" "VideoCodecState"
IO (Ptr VideoCodecState)
videoCodecStateRef ::
(MonadIO m) =>
VideoCodecState -- _obj
-> m VideoCodecState -- result
videoCodecStateRef _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- gst_video_codec_state_ref _obj'
checkUnexpectedReturnNULL "gst_video_codec_state_ref" result
result' <- (wrapBoxed VideoCodecState) result
touchManagedPtr _obj
return result'
data VideoCodecStateRefMethodInfo
instance (signature ~ (m VideoCodecState), MonadIO m) => MethodInfo VideoCodecStateRefMethodInfo VideoCodecState signature where
overloadedMethod _ = videoCodecStateRef
-- method VideoCodecState::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "GstVideo" "VideoCodecState", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gst_video_codec_state_unref" gst_video_codec_state_unref ::
Ptr VideoCodecState -> -- _obj : TInterface "GstVideo" "VideoCodecState"
IO ()
videoCodecStateUnref ::
(MonadIO m) =>
VideoCodecState -- _obj
-> m () -- result
videoCodecStateUnref _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
gst_video_codec_state_unref _obj'
touchManagedPtr _obj
return ()
data VideoCodecStateUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo VideoCodecStateUnrefMethodInfo VideoCodecState signature where
overloadedMethod _ = videoCodecStateUnref
type family ResolveVideoCodecStateMethod (t :: Symbol) (o :: *) :: * where
ResolveVideoCodecStateMethod "ref" o = VideoCodecStateRefMethodInfo
ResolveVideoCodecStateMethod "unref" o = VideoCodecStateUnrefMethodInfo
ResolveVideoCodecStateMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveVideoCodecStateMethod t VideoCodecState, MethodInfo info VideoCodecState p) => IsLabelProxy t (VideoCodecState -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveVideoCodecStateMethod t VideoCodecState, MethodInfo info VideoCodecState p) => IsLabel t (VideoCodecState -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif