gi-gstvideo-1.0.18: GI/GstVideo/Structs/VideoVBIParser.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
A parser for detecting and extracting /@gstVideoAncillary@/ data from
Vertical Blanking Interval lines of component signals.
/Since: 1.16/
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GstVideo.Structs.VideoVBIParser
(
-- * Exported types
VideoVBIParser(..) ,
noVideoVBIParser ,
-- * Methods
-- ** addLine #method:addLine#
#if ENABLE_OVERLOADING
VideoVBIParserAddLineMethodInfo ,
#endif
videoVBIParserAddLine ,
-- ** copy #method:copy#
#if ENABLE_OVERLOADING
VideoVBIParserCopyMethodInfo ,
#endif
videoVBIParserCopy ,
-- ** free #method:free#
#if ENABLE_OVERLOADING
VideoVBIParserFreeMethodInfo ,
#endif
videoVBIParserFree ,
-- ** getAncillary #method:getAncillary#
#if ENABLE_OVERLOADING
VideoVBIParserGetAncillaryMethodInfo ,
#endif
videoVBIParserGetAncillary ,
-- ** new #method:new#
videoVBIParserNew ,
) 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.Enums as GstVideo.Enums
import {-# SOURCE #-} qualified GI.GstVideo.Structs.VideoAncillary as GstVideo.VideoAncillary
-- | Memory-managed wrapper type.
newtype VideoVBIParser = VideoVBIParser (ManagedPtr VideoVBIParser)
foreign import ccall "gst_video_vbi_parser_get_type" c_gst_video_vbi_parser_get_type ::
IO GType
instance BoxedObject VideoVBIParser where
boxedType _ = c_gst_video_vbi_parser_get_type
-- | A convenience alias for `Nothing` :: `Maybe` `VideoVBIParser`.
noVideoVBIParser :: Maybe VideoVBIParser
noVideoVBIParser = Nothing
#if ENABLE_OVERLOADING
instance O.HasAttributeList VideoVBIParser
type instance O.AttributeList VideoVBIParser = VideoVBIParserAttributeList
type VideoVBIParserAttributeList = ('[ ] :: [(Symbol, *)])
#endif
-- method VideoVBIParser::new
-- method type : Constructor
-- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "GstVideo", name = "VideoFormat"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoFormat", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pixel_width", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The width in pixel to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_video_vbi_parser_new" gst_video_vbi_parser_new ::
CUInt -> -- format : TInterface (Name {namespace = "GstVideo", name = "VideoFormat"})
Word32 -> -- pixel_width : TBasicType TUInt32
IO (Ptr VideoVBIParser)
{- |
Create a new 'GI.GstVideo.Structs.VideoVBIParser.VideoVBIParser' for the specified /@format@/ and /@pixelWidth@/.
/Since: 1.16/
-}
videoVBIParserNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
GstVideo.Enums.VideoFormat
{- ^ /@format@/: a 'GI.GstVideo.Enums.VideoFormat' -}
-> Word32
{- ^ /@pixelWidth@/: The width in pixel to use -}
-> m VideoVBIParser
{- ^ __Returns:__ The new 'GI.GstVideo.Structs.VideoVBIParser.VideoVBIParser' or 'Nothing' if the /@format@/ and\/or /@pixelWidth@/
is not supported. -}
videoVBIParserNew format pixelWidth = liftIO $ do
let format' = (fromIntegral . fromEnum) format
result <- gst_video_vbi_parser_new format' pixelWidth
checkUnexpectedReturnNULL "videoVBIParserNew" result
result' <- (wrapBoxed VideoVBIParser) result
return result'
#if ENABLE_OVERLOADING
#endif
-- method VideoVBIParser::add_line
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "parser", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoVBIParser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The line of data to parse", 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_vbi_parser_add_line" gst_video_vbi_parser_add_line ::
Ptr VideoVBIParser -> -- parser : TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"})
Ptr Word8 -> -- data : TCArray False (-1) (-1) (TBasicType TUInt8)
IO ()
{- |
Provide a new line of data to the /@parser@/. Call 'GI.GstVideo.Structs.VideoVBIParser.videoVBIParserGetAncillary'
to get the Ancillary data that might be present on that line.
/Since: 1.16/
-}
videoVBIParserAddLine ::
(B.CallStack.HasCallStack, MonadIO m) =>
VideoVBIParser
{- ^ /@parser@/: a 'GI.GstVideo.Structs.VideoVBIParser.VideoVBIParser' -}
-> Ptr Word8
{- ^ /@data@/: The line of data to parse -}
-> m ()
videoVBIParserAddLine parser data_ = liftIO $ do
parser' <- unsafeManagedPtrGetPtr parser
gst_video_vbi_parser_add_line parser' data_
touchManagedPtr parser
return ()
#if ENABLE_OVERLOADING
data VideoVBIParserAddLineMethodInfo
instance (signature ~ (Ptr Word8 -> m ()), MonadIO m) => O.MethodInfo VideoVBIParserAddLineMethodInfo VideoVBIParser signature where
overloadedMethod _ = videoVBIParserAddLine
#endif
-- method VideoVBIParser::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "parser", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_video_vbi_parser_copy" gst_video_vbi_parser_copy ::
Ptr VideoVBIParser -> -- parser : TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"})
IO (Ptr VideoVBIParser)
{- |
/No description available in the introspection data./
-}
videoVBIParserCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
VideoVBIParser
-> m VideoVBIParser
videoVBIParserCopy parser = liftIO $ do
parser' <- unsafeManagedPtrGetPtr parser
result <- gst_video_vbi_parser_copy parser'
checkUnexpectedReturnNULL "videoVBIParserCopy" result
result' <- (wrapBoxed VideoVBIParser) result
touchManagedPtr parser
return result'
#if ENABLE_OVERLOADING
data VideoVBIParserCopyMethodInfo
instance (signature ~ (m VideoVBIParser), MonadIO m) => O.MethodInfo VideoVBIParserCopyMethodInfo VideoVBIParser signature where
overloadedMethod _ = videoVBIParserCopy
#endif
-- method VideoVBIParser::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "parser", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoVBIParser", 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_vbi_parser_free" gst_video_vbi_parser_free ::
Ptr VideoVBIParser -> -- parser : TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"})
IO ()
{- |
Frees the /@parser@/.
/Since: 1.16/
-}
videoVBIParserFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
VideoVBIParser
{- ^ /@parser@/: a 'GI.GstVideo.Structs.VideoVBIParser.VideoVBIParser' -}
-> m ()
videoVBIParserFree parser = liftIO $ do
parser' <- unsafeManagedPtrGetPtr parser
gst_video_vbi_parser_free parser'
touchManagedPtr parser
return ()
#if ENABLE_OVERLOADING
data VideoVBIParserFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo VideoVBIParserFreeMethodInfo VideoVBIParser signature where
overloadedMethod _ = videoVBIParserFree
#endif
-- method VideoVBIParser::get_ancillary
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "parser", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoVBIParser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "anc", argType = TInterface (Name {namespace = "GstVideo", name = "VideoAncillary"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoAncillary to start the eventual ancillary data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "VideoVBIParserResult"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_video_vbi_parser_get_ancillary" gst_video_vbi_parser_get_ancillary ::
Ptr VideoVBIParser -> -- parser : TInterface (Name {namespace = "GstVideo", name = "VideoVBIParser"})
Ptr GstVideo.VideoAncillary.VideoAncillary -> -- anc : TInterface (Name {namespace = "GstVideo", name = "VideoAncillary"})
IO CUInt
{- |
Parse the line provided previously by 'GI.GstVideo.Structs.VideoVBIParser.videoVBIParserAddLine'.
/Since: 1.16/
-}
videoVBIParserGetAncillary ::
(B.CallStack.HasCallStack, MonadIO m) =>
VideoVBIParser
{- ^ /@parser@/: a 'GI.GstVideo.Structs.VideoVBIParser.VideoVBIParser' -}
-> m ((GstVideo.Enums.VideoVBIParserResult, GstVideo.VideoAncillary.VideoAncillary))
{- ^ __Returns:__ 'GI.GstVideo.Enums.VideoVBIParserResultOk' if ancillary data was found and
/@anc@/ was filled. 'GI.GstVideo.Enums.VideoVBIParserResultDone' if there wasn\'t any
data. -}
videoVBIParserGetAncillary parser = liftIO $ do
parser' <- unsafeManagedPtrGetPtr parser
anc <- callocBytes 48 :: IO (Ptr GstVideo.VideoAncillary.VideoAncillary)
result <- gst_video_vbi_parser_get_ancillary parser' anc
let result' = (toEnum . fromIntegral) result
anc' <- (wrapPtr GstVideo.VideoAncillary.VideoAncillary) anc
touchManagedPtr parser
return (result', anc')
#if ENABLE_OVERLOADING
data VideoVBIParserGetAncillaryMethodInfo
instance (signature ~ (m ((GstVideo.Enums.VideoVBIParserResult, GstVideo.VideoAncillary.VideoAncillary))), MonadIO m) => O.MethodInfo VideoVBIParserGetAncillaryMethodInfo VideoVBIParser signature where
overloadedMethod _ = videoVBIParserGetAncillary
#endif
#if ENABLE_OVERLOADING
type family ResolveVideoVBIParserMethod (t :: Symbol) (o :: *) :: * where
ResolveVideoVBIParserMethod "addLine" o = VideoVBIParserAddLineMethodInfo
ResolveVideoVBIParserMethod "copy" o = VideoVBIParserCopyMethodInfo
ResolveVideoVBIParserMethod "free" o = VideoVBIParserFreeMethodInfo
ResolveVideoVBIParserMethod "getAncillary" o = VideoVBIParserGetAncillaryMethodInfo
ResolveVideoVBIParserMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveVideoVBIParserMethod t VideoVBIParser, O.MethodInfo info VideoVBIParser p) => OL.IsLabel t (VideoVBIParser -> 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