module Media.Streaming.GStreamer.Core.PadTemplate (
PadTemplate,
PadTemplateClass,
castToPadTemplate,
gTypePadTemplate,
PadPresence(..),
padTemplateNew,
padTemplateGetCaps,
padTemplateGetNameTemplate,
padTemplateGetDirection,
padTemplateGetPresence,
onPadTemplatePadCreated,
afterPadTemplatePadCreated
) where
import Control.Monad (liftM)
import Media.Streaming.GStreamer.Core.Types
import Media.Streaming.GStreamer.Core.Signals
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Signals
padTemplateNew :: String
-> PadDirection
-> PadPresence
-> Caps
-> IO PadTemplate
padTemplateNew nameTemplate direction presence caps =
withUTFString nameTemplate $ \cNameTemplate ->
giveCaps caps $ \caps' ->
(\arg1 arg2 arg3 (Caps arg4) -> withForeignPtr arg4 $ \argPtr4 ->gst_pad_template_new arg1 arg2 arg3 argPtr4) cNameTemplate
(fromIntegral $ fromEnum direction)
(fromIntegral $ fromEnum presence)
caps' >>=
takeObject
padTemplateGetCaps :: PadTemplateClass padTemplate
=> padTemplate
-> IO Caps
padTemplateGetCaps padTemplate =
(\(PadTemplate arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_pad_template_get_caps argPtr1) (toPadTemplate padTemplate) >>=
peekCaps
padTemplateGetNameTemplate :: PadTemplateClass padTemplate
=> padTemplate
-> IO String
padTemplateGetNameTemplate padTemplate =
withObject (toPadTemplate padTemplate) (\ptr -> do {peekByteOff ptr 40 ::IO (Ptr CChar)}) >>=
peekUTFString
padTemplateGetDirection :: PadTemplateClass padTemplate
=> padTemplate
-> IO PadDirection
padTemplateGetDirection padTemplate =
liftM (toEnum . fromIntegral) $
withObject (toPadTemplate padTemplate) (\ptr -> do {peekByteOff ptr 44 ::IO CInt})
padTemplateGetPresence :: PadTemplateClass padTemplate
=> padTemplate
-> IO PadPresence
padTemplateGetPresence padTemplate =
liftM (toEnum . fromIntegral) $
withObject (toPadTemplate padTemplate) (\ptr -> do {peekByteOff ptr 48 ::IO CInt})
onPadTemplatePadCreated, afterPadTemplatePadCreated :: PadTemplateClass padTemplateT
=> padTemplateT
-> (Pad -> IO ())
-> IO (ConnectId padTemplateT)
onPadTemplatePadCreated =
connect_OBJECT__NONE "pad-created" False
afterPadTemplatePadCreated =
connect_OBJECT__NONE "pad-created" True
foreign import ccall safe "gst_pad_template_new"
gst_pad_template_new :: ((Ptr CChar) -> (CInt -> (CInt -> ((Ptr Caps) -> (IO (Ptr PadTemplate))))))
foreign import ccall safe "gst_pad_template_get_caps"
gst_pad_template_get_caps :: ((Ptr PadTemplate) -> (IO (Ptr Caps)))