module Media.Streaming.GStreamer.Core.Parse (
parseLaunch,
parseLaunchFromArgs,
parseBinFromDescription
) where
import Media.Streaming.GStreamer.Core.Types
import System.Glib.GError
import System.Glib.UTFString
import System.Glib.FFI
parseLaunch :: String
-> IO (Maybe Element, Maybe GError)
parseLaunch pipelineDescription =
withUTFString pipelineDescription $ \cPipelineDescription ->
alloca $ \gErrorPtr ->
do element <- gst_parse_launch cPipelineDescription (castPtr gErrorPtr) >>=
maybePeek takeObject
gError <- peek gErrorPtr >>= maybePeek peek
return (element, gError)
parseLaunchFromArgs :: [String]
-> IO (Maybe Element, Maybe GError)
parseLaunchFromArgs args =
withUTFStringArray0 args $ \cArgs ->
alloca $ \gErrorPtr ->
do element <- gst_parse_launchv (castPtr cArgs) (castPtr gErrorPtr) >>=
maybePeek takeObject
gError <- peek gErrorPtr >>= maybePeek peek
return (element, gError)
parseBinFromDescription :: String
-> Bool
-> IO (Maybe Element, Maybe GError)
parseBinFromDescription binDescription ghostUnconnectedPads =
withUTFString binDescription $ \cBinDescription ->
alloca $ \gErrorPtr ->
do element <- gst_parse_bin_from_description cBinDescription
(fromBool ghostUnconnectedPads)
(castPtr gErrorPtr) >>=
maybePeek takeObject
gError <- peek gErrorPtr >>= maybePeek peek
return (element, gError)
foreign import ccall safe "gst_parse_launch"
gst_parse_launch :: ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO (Ptr Element))))
foreign import ccall safe "gst_parse_launchv"
gst_parse_launchv :: ((Ptr (Ptr CChar)) -> ((Ptr (Ptr ())) -> (IO (Ptr Element))))
foreign import ccall safe "gst_parse_bin_from_description"
gst_parse_bin_from_description :: ((Ptr CChar) -> (CInt -> ((Ptr (Ptr ())) -> (IO (Ptr Element)))))