#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GstBase.Functions
(
typeFindHelper ,
typeFindHelperForBuffer ,
typeFindHelperForBufferWithExtension ,
typeFindHelperForData ,
typeFindHelperForDataWithExtension ,
typeFindHelperForExtension ,
typeFindHelperGetRange ,
typeFindHelperGetRangeFull ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 qualified GHC.Records as R
import qualified GI.Gst.Enums as Gst.Enums
import qualified GI.Gst.Objects.Object as Gst.Object
import qualified GI.Gst.Objects.Pad as Gst.Pad
import qualified GI.Gst.Structs.Buffer as Gst.Buffer
import qualified GI.Gst.Structs.Caps as Gst.Caps
import qualified GI.GstBase.Callbacks as GstBase.Callbacks
foreign import ccall "gst_type_find_helper_get_range_full" gst_type_find_helper_get_range_full ::
Ptr Gst.Object.Object ->
Ptr Gst.Object.Object ->
FunPtr GstBase.Callbacks.C_TypeFindHelperGetRangeFunction ->
Word64 ->
CString ->
Ptr (Ptr Gst.Caps.Caps) ->
Ptr CUInt ->
IO CInt
typeFindHelperGetRangeFull ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Object.IsObject b) =>
a
-> Maybe (b)
-> GstBase.Callbacks.TypeFindHelperGetRangeFunction
-> Word64
-> Maybe (T.Text)
-> m ((Gst.Enums.FlowReturn, Gst.Caps.Caps, Gst.Enums.TypeFindProbability))
typeFindHelperGetRangeFull :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsObject a, IsObject b) =>
a
-> Maybe b
-> TypeFindHelperGetRangeFunction
-> Word64
-> Maybe Text
-> m (FlowReturn, Caps, TypeFindProbability)
typeFindHelperGetRangeFull a
obj Maybe b
parent TypeFindHelperGetRangeFunction
func Word64
size Maybe Text
extension = IO (FlowReturn, Caps, TypeFindProbability)
-> m (FlowReturn, Caps, TypeFindProbability)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (FlowReturn, Caps, TypeFindProbability)
-> m (FlowReturn, Caps, TypeFindProbability))
-> IO (FlowReturn, Caps, TypeFindProbability)
-> m (FlowReturn, Caps, TypeFindProbability)
forall a b. (a -> b) -> a -> b
$ do
Ptr Object
obj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
obj
Ptr Object
maybeParent <- case Maybe b
parent of
Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just b
jParent -> do
Ptr Object
jParent' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jParent
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jParent'
FunPtr C_TypeFindHelperGetRangeFunction
func' <- C_TypeFindHelperGetRangeFunction
-> IO (FunPtr C_TypeFindHelperGetRangeFunction)
GstBase.Callbacks.mk_TypeFindHelperGetRangeFunction (Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
-> TypeFindHelperGetRangeFunction
-> C_TypeFindHelperGetRangeFunction
GstBase.Callbacks.wrap_TypeFindHelperGetRangeFunction Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
forall a. Maybe a
Nothing TypeFindHelperGetRangeFunction
func)
Ptr CChar
maybeExtension <- case Maybe Text
extension of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jExtension -> do
Ptr CChar
jExtension' <- Text -> IO (Ptr CChar)
textToCString Text
jExtension
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jExtension'
Ptr (Ptr Caps)
caps <- IO (Ptr (Ptr Caps))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gst.Caps.Caps))
Ptr CUInt
prob <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
CInt
result <- Ptr Object
-> Ptr Object
-> FunPtr C_TypeFindHelperGetRangeFunction
-> Word64
-> Ptr CChar
-> Ptr (Ptr Caps)
-> Ptr CUInt
-> IO CInt
gst_type_find_helper_get_range_full Ptr Object
obj' Ptr Object
maybeParent FunPtr C_TypeFindHelperGetRangeFunction
func' Word64
size Ptr CChar
maybeExtension Ptr (Ptr Caps)
caps Ptr CUInt
prob
let result' :: FlowReturn
result' = (Int -> FlowReturn
forall a. Enum a => Int -> a
toEnum (Int -> FlowReturn) -> (CInt -> Int) -> CInt -> FlowReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
result
Ptr Caps
caps' <- Ptr (Ptr Caps) -> IO (Ptr Caps)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Caps)
caps
Caps
caps'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
caps'
CUInt
prob' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
prob
let prob'' :: TypeFindProbability
prob'' = (Int -> TypeFindProbability
forall a. Enum a => Int -> a
toEnum (Int -> TypeFindProbability)
-> (CUInt -> Int) -> CUInt -> TypeFindProbability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
prob'
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_TypeFindHelperGetRangeFunction -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_TypeFindHelperGetRangeFunction
func'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
obj
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
parent b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeExtension
Ptr (Ptr Caps) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Caps)
caps
Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
prob
(FlowReturn, Caps, TypeFindProbability)
-> IO (FlowReturn, Caps, TypeFindProbability)
forall (m :: * -> *) a. Monad m => a -> m a
return (FlowReturn
result', Caps
caps'', TypeFindProbability
prob'')
foreign import ccall "gst_type_find_helper_get_range" gst_type_find_helper_get_range ::
Ptr Gst.Object.Object ->
Ptr Gst.Object.Object ->
FunPtr GstBase.Callbacks.C_TypeFindHelperGetRangeFunction ->
Word64 ->
CString ->
Ptr CUInt ->
IO (Ptr Gst.Caps.Caps)
typeFindHelperGetRange ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Object.IsObject b) =>
a
-> Maybe (b)
-> GstBase.Callbacks.TypeFindHelperGetRangeFunction
-> Word64
-> Maybe (T.Text)
-> m ((Maybe Gst.Caps.Caps, Gst.Enums.TypeFindProbability))
typeFindHelperGetRange :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsObject a, IsObject b) =>
a
-> Maybe b
-> TypeFindHelperGetRangeFunction
-> Word64
-> Maybe Text
-> m (Maybe Caps, TypeFindProbability)
typeFindHelperGetRange a
obj Maybe b
parent TypeFindHelperGetRangeFunction
func Word64
size Maybe Text
extension = IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability))
-> IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall a b. (a -> b) -> a -> b
$ do
Ptr Object
obj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
obj
Ptr Object
maybeParent <- case Maybe b
parent of
Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just b
jParent -> do
Ptr Object
jParent' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jParent
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jParent'
FunPtr C_TypeFindHelperGetRangeFunction
func' <- C_TypeFindHelperGetRangeFunction
-> IO (FunPtr C_TypeFindHelperGetRangeFunction)
GstBase.Callbacks.mk_TypeFindHelperGetRangeFunction (Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
-> TypeFindHelperGetRangeFunction
-> C_TypeFindHelperGetRangeFunction
GstBase.Callbacks.wrap_TypeFindHelperGetRangeFunction Maybe (Ptr (FunPtr C_TypeFindHelperGetRangeFunction))
forall a. Maybe a
Nothing TypeFindHelperGetRangeFunction
func)
Ptr CChar
maybeExtension <- case Maybe Text
extension of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jExtension -> do
Ptr CChar
jExtension' <- Text -> IO (Ptr CChar)
textToCString Text
jExtension
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jExtension'
Ptr CUInt
prob <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
Ptr Caps
result <- Ptr Object
-> Ptr Object
-> FunPtr C_TypeFindHelperGetRangeFunction
-> Word64
-> Ptr CChar
-> Ptr CUInt
-> IO (Ptr Caps)
gst_type_find_helper_get_range Ptr Object
obj' Ptr Object
maybeParent FunPtr C_TypeFindHelperGetRangeFunction
func' Word64
size Ptr CChar
maybeExtension Ptr CUInt
prob
Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
CUInt
prob' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
prob
let prob'' :: TypeFindProbability
prob'' = (Int -> TypeFindProbability
forall a. Enum a => Int -> a
toEnum (Int -> TypeFindProbability)
-> (CUInt -> Int) -> CUInt -> TypeFindProbability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
prob'
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_TypeFindHelperGetRangeFunction -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_TypeFindHelperGetRangeFunction
func'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
obj
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
parent b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeExtension
Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
prob
(Maybe Caps, TypeFindProbability)
-> IO (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Caps
maybeResult, TypeFindProbability
prob'')
foreign import ccall "gst_type_find_helper_for_extension" gst_type_find_helper_for_extension ::
Ptr Gst.Object.Object ->
CString ->
IO (Ptr Gst.Caps.Caps)
typeFindHelperForExtension ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
Maybe (a)
-> T.Text
-> m (Maybe Gst.Caps.Caps)
typeFindHelperForExtension :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a -> Text -> m (Maybe Caps)
typeFindHelperForExtension Maybe a
obj Text
extension = IO (Maybe Caps) -> m (Maybe Caps)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps) -> m (Maybe Caps))
-> IO (Maybe Caps) -> m (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ do
Ptr Object
maybeObj <- case Maybe a
obj of
Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just a
jObj -> do
Ptr Object
jObj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObj
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObj'
Ptr CChar
extension' <- Text -> IO (Ptr CChar)
textToCString Text
extension
Ptr Caps
result <- Ptr Object -> Ptr CChar -> IO (Ptr Caps)
gst_type_find_helper_for_extension Ptr Object
maybeObj Ptr CChar
extension'
Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
obj a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
extension'
Maybe Caps -> IO (Maybe Caps)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Caps
maybeResult
foreign import ccall "gst_type_find_helper_for_data_with_extension" gst_type_find_helper_for_data_with_extension ::
Ptr Gst.Object.Object ->
Ptr Word8 ->
Word64 ->
CString ->
Ptr CUInt ->
IO (Ptr Gst.Caps.Caps)
typeFindHelperForDataWithExtension ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
Maybe (a)
-> ByteString
-> Maybe (T.Text)
-> m ((Maybe Gst.Caps.Caps, Gst.Enums.TypeFindProbability))
typeFindHelperForDataWithExtension :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a
-> ByteString -> Maybe Text -> m (Maybe Caps, TypeFindProbability)
typeFindHelperForDataWithExtension Maybe a
obj ByteString
data_ Maybe Text
extension = IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability))
-> IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall a b. (a -> b) -> a -> b
$ do
let size :: Word64
size = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
data_
Ptr Object
maybeObj <- case Maybe a
obj of
Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just a
jObj -> do
Ptr Object
jObj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObj
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObj'
Ptr Word8
data_' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
data_
Ptr CChar
maybeExtension <- case Maybe Text
extension of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jExtension -> do
Ptr CChar
jExtension' <- Text -> IO (Ptr CChar)
textToCString Text
jExtension
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jExtension'
Ptr CUInt
prob <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
Ptr Caps
result <- Ptr Object
-> Ptr Word8 -> Word64 -> Ptr CChar -> Ptr CUInt -> IO (Ptr Caps)
gst_type_find_helper_for_data_with_extension Ptr Object
maybeObj Ptr Word8
data_' Word64
size Ptr CChar
maybeExtension Ptr CUInt
prob
Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
CUInt
prob' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
prob
let prob'' :: TypeFindProbability
prob'' = (Int -> TypeFindProbability
forall a. Enum a => Int -> a
toEnum (Int -> TypeFindProbability)
-> (CUInt -> Int) -> CUInt -> TypeFindProbability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
prob'
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
obj a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
data_'
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeExtension
Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
prob
(Maybe Caps, TypeFindProbability)
-> IO (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Caps
maybeResult, TypeFindProbability
prob'')
foreign import ccall "gst_type_find_helper_for_data" gst_type_find_helper_for_data ::
Ptr Gst.Object.Object ->
Ptr Word8 ->
Word64 ->
Ptr CUInt ->
IO (Ptr Gst.Caps.Caps)
typeFindHelperForData ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
Maybe (a)
-> ByteString
-> m ((Maybe Gst.Caps.Caps, Gst.Enums.TypeFindProbability))
typeFindHelperForData :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a -> ByteString -> m (Maybe Caps, TypeFindProbability)
typeFindHelperForData Maybe a
obj ByteString
data_ = IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability))
-> IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall a b. (a -> b) -> a -> b
$ do
let size :: Word64
size = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
data_
Ptr Object
maybeObj <- case Maybe a
obj of
Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just a
jObj -> do
Ptr Object
jObj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObj
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObj'
Ptr Word8
data_' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
data_
Ptr CUInt
prob <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
Ptr Caps
result <- Ptr Object -> Ptr Word8 -> Word64 -> Ptr CUInt -> IO (Ptr Caps)
gst_type_find_helper_for_data Ptr Object
maybeObj Ptr Word8
data_' Word64
size Ptr CUInt
prob
Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
CUInt
prob' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
prob
let prob'' :: TypeFindProbability
prob'' = (Int -> TypeFindProbability
forall a. Enum a => Int -> a
toEnum (Int -> TypeFindProbability)
-> (CUInt -> Int) -> CUInt -> TypeFindProbability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
prob'
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
obj a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
data_'
Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
prob
(Maybe Caps, TypeFindProbability)
-> IO (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Caps
maybeResult, TypeFindProbability
prob'')
foreign import ccall "gst_type_find_helper_for_buffer_with_extension" gst_type_find_helper_for_buffer_with_extension ::
Ptr Gst.Object.Object ->
Ptr Gst.Buffer.Buffer ->
CString ->
Ptr CUInt ->
IO (Ptr Gst.Caps.Caps)
typeFindHelperForBufferWithExtension ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
Maybe (a)
-> Gst.Buffer.Buffer
-> Maybe (T.Text)
-> m ((Maybe Gst.Caps.Caps, Gst.Enums.TypeFindProbability))
typeFindHelperForBufferWithExtension :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a
-> Buffer -> Maybe Text -> m (Maybe Caps, TypeFindProbability)
typeFindHelperForBufferWithExtension Maybe a
obj Buffer
buf Maybe Text
extension = IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability))
-> IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall a b. (a -> b) -> a -> b
$ do
Ptr Object
maybeObj <- case Maybe a
obj of
Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just a
jObj -> do
Ptr Object
jObj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObj
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObj'
Ptr Buffer
buf' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buf
Ptr CChar
maybeExtension <- case Maybe Text
extension of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jExtension -> do
Ptr CChar
jExtension' <- Text -> IO (Ptr CChar)
textToCString Text
jExtension
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jExtension'
Ptr CUInt
prob <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
Ptr Caps
result <- Ptr Object -> Ptr Buffer -> Ptr CChar -> Ptr CUInt -> IO (Ptr Caps)
gst_type_find_helper_for_buffer_with_extension Ptr Object
maybeObj Ptr Buffer
buf' Ptr CChar
maybeExtension Ptr CUInt
prob
Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
CUInt
prob' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
prob
let prob'' :: TypeFindProbability
prob'' = (Int -> TypeFindProbability
forall a. Enum a => Int -> a
toEnum (Int -> TypeFindProbability)
-> (CUInt -> Int) -> CUInt -> TypeFindProbability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
prob'
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
obj a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buf
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeExtension
Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
prob
(Maybe Caps, TypeFindProbability)
-> IO (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Caps
maybeResult, TypeFindProbability
prob'')
foreign import ccall "gst_type_find_helper_for_buffer" gst_type_find_helper_for_buffer ::
Ptr Gst.Object.Object ->
Ptr Gst.Buffer.Buffer ->
Ptr CUInt ->
IO (Ptr Gst.Caps.Caps)
typeFindHelperForBuffer ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
Maybe (a)
-> Gst.Buffer.Buffer
-> m ((Maybe Gst.Caps.Caps, Gst.Enums.TypeFindProbability))
typeFindHelperForBuffer :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a -> Buffer -> m (Maybe Caps, TypeFindProbability)
typeFindHelperForBuffer Maybe a
obj Buffer
buf = IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability))
-> IO (Maybe Caps, TypeFindProbability)
-> m (Maybe Caps, TypeFindProbability)
forall a b. (a -> b) -> a -> b
$ do
Ptr Object
maybeObj <- case Maybe a
obj of
Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just a
jObj -> do
Ptr Object
jObj' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObj
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObj'
Ptr Buffer
buf' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buf
Ptr CUInt
prob <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
Ptr Caps
result <- Ptr Object -> Ptr Buffer -> Ptr CUInt -> IO (Ptr Caps)
gst_type_find_helper_for_buffer Ptr Object
maybeObj Ptr Buffer
buf' Ptr CUInt
prob
Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
CUInt
prob' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
prob
let prob'' :: TypeFindProbability
prob'' = (Int -> TypeFindProbability
forall a. Enum a => Int -> a
toEnum (Int -> TypeFindProbability)
-> (CUInt -> Int) -> CUInt -> TypeFindProbability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
prob'
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
obj a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buf
Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
prob
(Maybe Caps, TypeFindProbability)
-> IO (Maybe Caps, TypeFindProbability)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Caps
maybeResult, TypeFindProbability
prob'')
foreign import ccall "gst_type_find_helper" gst_type_find_helper ::
Ptr Gst.Pad.Pad ->
Word64 ->
IO (Ptr Gst.Caps.Caps)
typeFindHelper ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Pad.IsPad a) =>
a
-> Word64
-> m (Maybe Gst.Caps.Caps)
typeFindHelper :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsPad a) =>
a -> Word64 -> m (Maybe Caps)
typeFindHelper a
src Word64
size = IO (Maybe Caps) -> m (Maybe Caps)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps) -> m (Maybe Caps))
-> IO (Maybe Caps) -> m (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ do
Ptr Pad
src' <- a -> IO (Ptr Pad)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
src
Ptr Caps
result <- Ptr Pad -> Word64 -> IO (Ptr Caps)
gst_type_find_helper Ptr Pad
src' Word64
size
Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
src
Maybe Caps -> IO (Maybe Caps)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Caps
maybeResult