{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) An encoder for writing ancillary data to the 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.VideoVBIEncoder ( -- * Exported types VideoVBIEncoder(..) , noVideoVBIEncoder , -- * Methods -- ** addAncillary #method:addAncillary# #if ENABLE_OVERLOADING VideoVBIEncoderAddAncillaryMethodInfo , #endif videoVBIEncoderAddAncillary , -- ** copy #method:copy# #if ENABLE_OVERLOADING VideoVBIEncoderCopyMethodInfo , #endif videoVBIEncoderCopy , -- ** free #method:free# #if ENABLE_OVERLOADING VideoVBIEncoderFreeMethodInfo , #endif videoVBIEncoderFree , -- ** new #method:new# videoVBIEncoderNew , -- ** writeLine #method:writeLine# #if ENABLE_OVERLOADING VideoVBIEncoderWriteLineMethodInfo , #endif videoVBIEncoderWriteLine , ) 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 -- | Memory-managed wrapper type. newtype VideoVBIEncoder = VideoVBIEncoder (ManagedPtr VideoVBIEncoder) foreign import ccall "gst_video_vbi_encoder_get_type" c_gst_video_vbi_encoder_get_type :: IO GType instance BoxedObject VideoVBIEncoder where boxedType _ = c_gst_video_vbi_encoder_get_type -- | A convenience alias for `Nothing` :: `Maybe` `VideoVBIEncoder`. noVideoVBIEncoder :: Maybe VideoVBIEncoder noVideoVBIEncoder = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList VideoVBIEncoder type instance O.AttributeList VideoVBIEncoder = VideoVBIEncoderAttributeList type VideoVBIEncoderAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method VideoVBIEncoder::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 = "VideoVBIEncoder"})) -- throws : False -- Skip return : False foreign import ccall "gst_video_vbi_encoder_new" gst_video_vbi_encoder_new :: CUInt -> -- format : TInterface (Name {namespace = "GstVideo", name = "VideoFormat"}) Word32 -> -- pixel_width : TBasicType TUInt32 IO (Ptr VideoVBIEncoder) {- | Create a new 'GI.GstVideo.Structs.VideoVBIEncoder.VideoVBIEncoder' for the specified /@format@/ and /@pixelWidth@/. /Since: 1.16/ -} videoVBIEncoderNew :: (B.CallStack.HasCallStack, MonadIO m) => GstVideo.Enums.VideoFormat {- ^ /@format@/: a 'GI.GstVideo.Enums.VideoFormat' -} -> Word32 {- ^ /@pixelWidth@/: The width in pixel to use -} -> m VideoVBIEncoder {- ^ __Returns:__ The new 'GI.GstVideo.Structs.VideoVBIEncoder.VideoVBIEncoder' or 'Nothing' if the /@format@/ and\/or /@pixelWidth@/ is not supported. -} videoVBIEncoderNew format pixelWidth = liftIO $ do let format' = (fromIntegral . fromEnum) format result <- gst_video_vbi_encoder_new format' pixelWidth checkUnexpectedReturnNULL "videoVBIEncoderNew" result result' <- (wrapBoxed VideoVBIEncoder) result return result' #if ENABLE_OVERLOADING #endif -- method VideoVBIEncoder::add_ancillary -- method type : OrdinaryMethod -- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoVBIEncoder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "composite", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if composite ADF should be created, component otherwise", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "DID", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The Data Identifier", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "SDID_block_number", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The Secondary Data Identifier (if type 2) or the Data\n Block Number (if type 1)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) 5 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The user data content of the Ancillary packet.\n Does not contain the ADF, DID, SDID nor CS.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data_count", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The amount of data (in bytes) in @data (max 255 bytes)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [Arg {argCName = "data_count", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The amount of data (in bytes) in @data (max 255 bytes)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_video_vbi_encoder_add_ancillary" gst_video_vbi_encoder_add_ancillary :: Ptr VideoVBIEncoder -> -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}) CInt -> -- composite : TBasicType TBoolean Word8 -> -- DID : TBasicType TUInt8 Word8 -> -- SDID_block_number : TBasicType TUInt8 Ptr Word8 -> -- data : TCArray False (-1) 5 (TBasicType TUInt8) Word32 -> -- data_count : TBasicType TUInt IO CInt {- | Stores Video Ancillary data, according to SMPTE-291M specification. Note that the contents of the data are always read as 8bit data (i.e. do not contain the parity check bits). /Since: 1.16/ -} videoVBIEncoderAddAncillary :: (B.CallStack.HasCallStack, MonadIO m) => VideoVBIEncoder {- ^ /@encoder@/: a 'GI.GstVideo.Structs.VideoVBIEncoder.VideoVBIEncoder' -} -> Bool {- ^ /@composite@/: 'True' if composite ADF should be created, component otherwise -} -> Word8 {- ^ /@dID@/: The Data Identifier -} -> Word8 {- ^ /@sDIDBlockNumber@/: The Secondary Data Identifier (if type 2) or the Data Block Number (if type 1) -} -> ByteString {- ^ /@data@/: The user data content of the Ancillary packet. Does not contain the ADF, DID, SDID nor CS. -} -> m Bool {- ^ __Returns:__ 'True' if enough space was left in the current line, 'False' otherwise. -} videoVBIEncoderAddAncillary encoder composite dID sDIDBlockNumber data_ = liftIO $ do let dataCount = fromIntegral $ B.length data_ encoder' <- unsafeManagedPtrGetPtr encoder let composite' = (fromIntegral . fromEnum) composite data_' <- packByteString data_ result <- gst_video_vbi_encoder_add_ancillary encoder' composite' dID sDIDBlockNumber data_' dataCount let result' = (/= 0) result touchManagedPtr encoder freeMem data_' return result' #if ENABLE_OVERLOADING data VideoVBIEncoderAddAncillaryMethodInfo instance (signature ~ (Bool -> Word8 -> Word8 -> ByteString -> m Bool), MonadIO m) => O.MethodInfo VideoVBIEncoderAddAncillaryMethodInfo VideoVBIEncoder signature where overloadedMethod _ = videoVBIEncoderAddAncillary #endif -- method VideoVBIEncoder::copy -- method type : OrdinaryMethod -- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}), 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 = "VideoVBIEncoder"})) -- throws : False -- Skip return : False foreign import ccall "gst_video_vbi_encoder_copy" gst_video_vbi_encoder_copy :: Ptr VideoVBIEncoder -> -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}) IO (Ptr VideoVBIEncoder) {- | /No description available in the introspection data./ -} videoVBIEncoderCopy :: (B.CallStack.HasCallStack, MonadIO m) => VideoVBIEncoder -> m VideoVBIEncoder videoVBIEncoderCopy encoder = liftIO $ do encoder' <- unsafeManagedPtrGetPtr encoder result <- gst_video_vbi_encoder_copy encoder' checkUnexpectedReturnNULL "videoVBIEncoderCopy" result result' <- (wrapBoxed VideoVBIEncoder) result touchManagedPtr encoder return result' #if ENABLE_OVERLOADING data VideoVBIEncoderCopyMethodInfo instance (signature ~ (m VideoVBIEncoder), MonadIO m) => O.MethodInfo VideoVBIEncoderCopyMethodInfo VideoVBIEncoder signature where overloadedMethod _ = videoVBIEncoderCopy #endif -- method VideoVBIEncoder::free -- method type : OrdinaryMethod -- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstVideoVBIEncoder", 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_encoder_free" gst_video_vbi_encoder_free :: Ptr VideoVBIEncoder -> -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}) IO () {- | Frees the /@encoder@/. /Since: 1.16/ -} videoVBIEncoderFree :: (B.CallStack.HasCallStack, MonadIO m) => VideoVBIEncoder {- ^ /@encoder@/: a 'GI.GstVideo.Structs.VideoVBIEncoder.VideoVBIEncoder' -} -> m () videoVBIEncoderFree encoder = liftIO $ do encoder' <- unsafeManagedPtrGetPtr encoder gst_video_vbi_encoder_free encoder' touchManagedPtr encoder return () #if ENABLE_OVERLOADING data VideoVBIEncoderFreeMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo VideoVBIEncoderFreeMethodInfo VideoVBIEncoder signature where overloadedMethod _ = videoVBIEncoderFree #endif -- method VideoVBIEncoder::write_line -- method type : OrdinaryMethod -- Args : [Arg {argCName = "encoder", argType = TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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_encoder_write_line" gst_video_vbi_encoder_write_line :: Ptr VideoVBIEncoder -> -- encoder : TInterface (Name {namespace = "GstVideo", name = "VideoVBIEncoder"}) Word8 -> -- data : TBasicType TUInt8 IO () {- | /No description available in the introspection data./ -} videoVBIEncoderWriteLine :: (B.CallStack.HasCallStack, MonadIO m) => VideoVBIEncoder -> Word8 -> m () videoVBIEncoderWriteLine encoder data_ = liftIO $ do encoder' <- unsafeManagedPtrGetPtr encoder gst_video_vbi_encoder_write_line encoder' data_ touchManagedPtr encoder return () #if ENABLE_OVERLOADING data VideoVBIEncoderWriteLineMethodInfo instance (signature ~ (Word8 -> m ()), MonadIO m) => O.MethodInfo VideoVBIEncoderWriteLineMethodInfo VideoVBIEncoder signature where overloadedMethod _ = videoVBIEncoderWriteLine #endif #if ENABLE_OVERLOADING type family ResolveVideoVBIEncoderMethod (t :: Symbol) (o :: *) :: * where ResolveVideoVBIEncoderMethod "addAncillary" o = VideoVBIEncoderAddAncillaryMethodInfo ResolveVideoVBIEncoderMethod "copy" o = VideoVBIEncoderCopyMethodInfo ResolveVideoVBIEncoderMethod "free" o = VideoVBIEncoderFreeMethodInfo ResolveVideoVBIEncoderMethod "writeLine" o = VideoVBIEncoderWriteLineMethodInfo ResolveVideoVBIEncoderMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveVideoVBIEncoderMethod t VideoVBIEncoder, O.MethodInfo info VideoVBIEncoder p) => OL.IsLabel t (VideoVBIEncoder -> 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