gi-gstvideo-0.1.6.13: GI/GstVideo/Structs/VideoFormatInfo.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)
Information for a video format.
-}
module GI.GstVideo.Structs.VideoFormatInfo
(
-- * Exported types
VideoFormatInfo(..) ,
newZeroVideoFormatInfo ,
noVideoFormatInfo ,
-- * Properties
-- ** Bits
videoFormatInfoReadBits ,
-- ** Description
videoFormatInfoReadDescription ,
-- ** Flags
videoFormatInfoReadFlags ,
-- ** Format
videoFormatInfoReadFormat ,
-- ** NComponents
videoFormatInfoReadNComponents ,
-- ** NPlanes
videoFormatInfoReadNPlanes ,
-- ** Name
videoFormatInfoReadName ,
-- ** PackLines
videoFormatInfoReadPackLines ,
-- ** TileHs
videoFormatInfoReadTileHs ,
-- ** TileMode
videoFormatInfoReadTileMode ,
-- ** TileWs
videoFormatInfoReadTileWs ,
-- ** UnpackFormat
videoFormatInfoReadUnpackFormat ,
) 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
newtype VideoFormatInfo = VideoFormatInfo (ForeignPtr VideoFormatInfo)
-- | Construct a `VideoFormatInfo` struct initialized to zero.
newZeroVideoFormatInfo :: MonadIO m => m VideoFormatInfo
newZeroVideoFormatInfo = liftIO $ callocBytes 232 >>= wrapPtr VideoFormatInfo
noVideoFormatInfo :: Maybe VideoFormatInfo
noVideoFormatInfo = Nothing
videoFormatInfoReadFormat :: VideoFormatInfo -> IO VideoFormat
videoFormatInfoReadFormat s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
videoFormatInfoReadName :: VideoFormatInfo -> IO T.Text
videoFormatInfoReadName s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
val' <- cstringToText val
return val'
videoFormatInfoReadDescription :: VideoFormatInfo -> IO T.Text
videoFormatInfoReadDescription s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
val' <- cstringToText val
return val'
videoFormatInfoReadFlags :: VideoFormatInfo -> IO [VideoFormatFlags]
videoFormatInfoReadFlags s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CUInt
let val' = wordToGFlags val
return val'
videoFormatInfoReadBits :: VideoFormatInfo -> IO Word32
videoFormatInfoReadBits s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 28) :: IO Word32
return val
videoFormatInfoReadNComponents :: VideoFormatInfo -> IO Word32
videoFormatInfoReadNComponents s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO Word32
return val
-- XXX Skipped getter for "VideoFormatInfo:shift" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TUInt32)"
-- XXX Skipped getter for "VideoFormatInfo:depth" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TUInt32)"
-- XXX Skipped getter for "VideoFormatInfo:pixel_stride" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TInt32)"
videoFormatInfoReadNPlanes :: VideoFormatInfo -> IO Word32
videoFormatInfoReadNPlanes s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 84) :: IO Word32
return val
-- XXX Skipped getter for "VideoFormatInfo:plane" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TUInt32)"
-- XXX Skipped getter for "VideoFormatInfo:poffset" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TUInt32)"
-- XXX Skipped getter for "VideoFormatInfo:w_sub" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TUInt32)"
-- XXX Skipped getter for "VideoFormatInfo:h_sub" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TUInt32)"
videoFormatInfoReadUnpackFormat :: VideoFormatInfo -> IO VideoFormat
videoFormatInfoReadUnpackFormat s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 152) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
-- XXX Skipped getter for "VideoFormatInfo:unpack_func" :: Not implemented: "Wrapping foreign callbacks is not supported yet"
videoFormatInfoReadPackLines :: VideoFormatInfo -> IO Int32
videoFormatInfoReadPackLines s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 168) :: IO Int32
return val
-- XXX Skipped getter for "VideoFormatInfo:pack_func" :: Not implemented: "Wrapping foreign callbacks is not supported yet"
videoFormatInfoReadTileMode :: VideoFormatInfo -> IO VideoTileMode
videoFormatInfoReadTileMode s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 184) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
videoFormatInfoReadTileWs :: VideoFormatInfo -> IO Word32
videoFormatInfoReadTileWs s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 188) :: IO Word32
return val
videoFormatInfoReadTileHs :: VideoFormatInfo -> IO Word32
videoFormatInfoReadTileHs s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 192) :: IO Word32
return val
-- XXX Skipped getter for "VideoFormatInfo:_gst_reserved" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TVoid)"
type family ResolveVideoFormatInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveVideoFormatInfoMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveVideoFormatInfoMethod t VideoFormatInfo, MethodInfo info VideoFormatInfo p) => IsLabelProxy t (VideoFormatInfo -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveVideoFormatInfoMethod t VideoFormatInfo, MethodInfo info VideoFormatInfo p) => IsLabel t (VideoFormatInfo -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif