{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Variant of 'GI.GstPbutils.Objects.EncodingProfile.EncodingProfile' for video streams, allows specifying the /@pass@/. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.GstPbutils.Objects.EncodingVideoProfile ( -- * Exported types EncodingVideoProfile(..) , IsEncodingVideoProfile , toEncodingVideoProfile , noEncodingVideoProfile , -- * Methods -- ** getPass #method:getPass# #if ENABLE_OVERLOADING EncodingVideoProfileGetPassMethodInfo , #endif encodingVideoProfileGetPass , -- ** getVariableframerate #method:getVariableframerate# #if ENABLE_OVERLOADING EncodingVideoProfileGetVariableframerateMethodInfo, #endif encodingVideoProfileGetVariableframerate, -- ** new #method:new# encodingVideoProfileNew , -- ** setPass #method:setPass# #if ENABLE_OVERLOADING EncodingVideoProfileSetPassMethodInfo , #endif encodingVideoProfileSetPass , -- ** setVariableframerate #method:setVariableframerate# #if ENABLE_OVERLOADING EncodingVideoProfileSetVariableframerateMethodInfo, #endif encodingVideoProfileSetVariableframerate, ) 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 qualified GI.GObject.Objects.Object as GObject.Object import qualified GI.Gst.Structs.Caps as Gst.Caps import {-# SOURCE #-} qualified GI.GstPbutils.Objects.EncodingProfile as GstPbutils.EncodingProfile -- | Memory-managed wrapper type. newtype EncodingVideoProfile = EncodingVideoProfile (ManagedPtr EncodingVideoProfile) foreign import ccall "gst_encoding_video_profile_get_type" c_gst_encoding_video_profile_get_type :: IO GType instance GObject EncodingVideoProfile where gobjectType = c_gst_encoding_video_profile_get_type -- | Type class for types which can be safely cast to `EncodingVideoProfile`, for instance with `toEncodingVideoProfile`. class (GObject o, O.IsDescendantOf EncodingVideoProfile o) => IsEncodingVideoProfile o instance (GObject o, O.IsDescendantOf EncodingVideoProfile o) => IsEncodingVideoProfile o instance O.HasParentTypes EncodingVideoProfile type instance O.ParentTypes EncodingVideoProfile = '[GstPbutils.EncodingProfile.EncodingProfile, GObject.Object.Object] -- | Cast to `EncodingVideoProfile`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toEncodingVideoProfile :: (MonadIO m, IsEncodingVideoProfile o) => o -> m EncodingVideoProfile toEncodingVideoProfile = liftIO . unsafeCastTo EncodingVideoProfile -- | A convenience alias for `Nothing` :: `Maybe` `EncodingVideoProfile`. noEncodingVideoProfile :: Maybe EncodingVideoProfile noEncodingVideoProfile = Nothing #if ENABLE_OVERLOADING type family ResolveEncodingVideoProfileMethod (t :: Symbol) (o :: *) :: * where ResolveEncodingVideoProfileMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveEncodingVideoProfileMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveEncodingVideoProfileMethod "copy" o = GstPbutils.EncodingProfile.EncodingProfileCopyMethodInfo ResolveEncodingVideoProfileMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveEncodingVideoProfileMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveEncodingVideoProfileMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolveEncodingVideoProfileMethod "isEnabled" o = GstPbutils.EncodingProfile.EncodingProfileIsEnabledMethodInfo ResolveEncodingVideoProfileMethod "isEqual" o = GstPbutils.EncodingProfile.EncodingProfileIsEqualMethodInfo ResolveEncodingVideoProfileMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveEncodingVideoProfileMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveEncodingVideoProfileMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveEncodingVideoProfileMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolveEncodingVideoProfileMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveEncodingVideoProfileMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveEncodingVideoProfileMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveEncodingVideoProfileMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveEncodingVideoProfileMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveEncodingVideoProfileMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolveEncodingVideoProfileMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveEncodingVideoProfileMethod "getAllowDynamicOutput" o = GstPbutils.EncodingProfile.EncodingProfileGetAllowDynamicOutputMethodInfo ResolveEncodingVideoProfileMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveEncodingVideoProfileMethod "getDescription" o = GstPbutils.EncodingProfile.EncodingProfileGetDescriptionMethodInfo ResolveEncodingVideoProfileMethod "getFileExtension" o = GstPbutils.EncodingProfile.EncodingProfileGetFileExtensionMethodInfo ResolveEncodingVideoProfileMethod "getFormat" o = GstPbutils.EncodingProfile.EncodingProfileGetFormatMethodInfo ResolveEncodingVideoProfileMethod "getInputCaps" o = GstPbutils.EncodingProfile.EncodingProfileGetInputCapsMethodInfo ResolveEncodingVideoProfileMethod "getName" o = GstPbutils.EncodingProfile.EncodingProfileGetNameMethodInfo ResolveEncodingVideoProfileMethod "getPass" o = EncodingVideoProfileGetPassMethodInfo ResolveEncodingVideoProfileMethod "getPresence" o = GstPbutils.EncodingProfile.EncodingProfileGetPresenceMethodInfo ResolveEncodingVideoProfileMethod "getPreset" o = GstPbutils.EncodingProfile.EncodingProfileGetPresetMethodInfo ResolveEncodingVideoProfileMethod "getPresetName" o = GstPbutils.EncodingProfile.EncodingProfileGetPresetNameMethodInfo ResolveEncodingVideoProfileMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveEncodingVideoProfileMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveEncodingVideoProfileMethod "getRestriction" o = GstPbutils.EncodingProfile.EncodingProfileGetRestrictionMethodInfo ResolveEncodingVideoProfileMethod "getTypeNick" o = GstPbutils.EncodingProfile.EncodingProfileGetTypeNickMethodInfo ResolveEncodingVideoProfileMethod "getVariableframerate" o = EncodingVideoProfileGetVariableframerateMethodInfo ResolveEncodingVideoProfileMethod "setAllowDynamicOutput" o = GstPbutils.EncodingProfile.EncodingProfileSetAllowDynamicOutputMethodInfo ResolveEncodingVideoProfileMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveEncodingVideoProfileMethod "setDescription" o = GstPbutils.EncodingProfile.EncodingProfileSetDescriptionMethodInfo ResolveEncodingVideoProfileMethod "setEnabled" o = GstPbutils.EncodingProfile.EncodingProfileSetEnabledMethodInfo ResolveEncodingVideoProfileMethod "setFormat" o = GstPbutils.EncodingProfile.EncodingProfileSetFormatMethodInfo ResolveEncodingVideoProfileMethod "setName" o = GstPbutils.EncodingProfile.EncodingProfileSetNameMethodInfo ResolveEncodingVideoProfileMethod "setPass" o = EncodingVideoProfileSetPassMethodInfo ResolveEncodingVideoProfileMethod "setPresence" o = GstPbutils.EncodingProfile.EncodingProfileSetPresenceMethodInfo ResolveEncodingVideoProfileMethod "setPreset" o = GstPbutils.EncodingProfile.EncodingProfileSetPresetMethodInfo ResolveEncodingVideoProfileMethod "setPresetName" o = GstPbutils.EncodingProfile.EncodingProfileSetPresetNameMethodInfo ResolveEncodingVideoProfileMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveEncodingVideoProfileMethod "setRestriction" o = GstPbutils.EncodingProfile.EncodingProfileSetRestrictionMethodInfo ResolveEncodingVideoProfileMethod "setVariableframerate" o = EncodingVideoProfileSetVariableframerateMethodInfo ResolveEncodingVideoProfileMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveEncodingVideoProfileMethod t EncodingVideoProfile, O.MethodInfo info EncodingVideoProfile p) => OL.IsLabel t (EncodingVideoProfile -> 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 #if ENABLE_OVERLOADING instance O.HasAttributeList EncodingVideoProfile type instance O.AttributeList EncodingVideoProfile = EncodingVideoProfileAttributeList type EncodingVideoProfileAttributeList = ('[ '("restrictionCaps", GstPbutils.EncodingProfile.EncodingProfileRestrictionCapsPropertyInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING #endif #if ENABLE_OVERLOADING type instance O.SignalList EncodingVideoProfile = EncodingVideoProfileSignalList type EncodingVideoProfileSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) #endif -- method EncodingVideoProfile::new -- method type : Constructor -- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCaps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "preset", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the preset(s) to use on the encoder, can be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "restriction", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GstCaps used to restrict the input to the encoder, can be\nNULL. See gst_encoding_profile_get_restriction() for more details.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "presence", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of time this stream must be used. 0 means any number of\n times (including never)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"})) -- throws : False -- Skip return : False foreign import ccall "gst_encoding_video_profile_new" gst_encoding_video_profile_new :: Ptr Gst.Caps.Caps -> -- format : TInterface (Name {namespace = "Gst", name = "Caps"}) CString -> -- preset : TBasicType TUTF8 Ptr Gst.Caps.Caps -> -- restriction : TInterface (Name {namespace = "Gst", name = "Caps"}) Word32 -> -- presence : TBasicType TUInt IO (Ptr EncodingVideoProfile) {- | Creates a new 'GI.GstPbutils.Objects.EncodingVideoProfile.EncodingVideoProfile' All provided allocatable arguments will be internally copied, so can be safely freed\/unreferenced after calling this method. If you wish to control the pass number (in case of multi-pass scenarios), please refer to the 'GI.GstPbutils.Objects.EncodingVideoProfile.encodingVideoProfileSetPass' documentation. If you wish to use\/force a constant framerate please refer to the 'GI.GstPbutils.Objects.EncodingVideoProfile.encodingVideoProfileSetVariableframerate' documentation. -} encodingVideoProfileNew :: (B.CallStack.HasCallStack, MonadIO m) => Gst.Caps.Caps {- ^ /@format@/: the 'GI.Gst.Structs.Caps.Caps' -} -> Maybe (T.Text) {- ^ /@preset@/: the preset(s) to use on the encoder, can be 'Nothing' -} -> Maybe (Gst.Caps.Caps) {- ^ /@restriction@/: the 'GI.Gst.Structs.Caps.Caps' used to restrict the input to the encoder, can be NULL. See 'GI.GstPbutils.Objects.EncodingProfile.encodingProfileGetRestriction' for more details. -} -> Word32 {- ^ /@presence@/: the number of time this stream must be used. 0 means any number of times (including never) -} -> m EncodingVideoProfile {- ^ __Returns:__ the newly created 'GI.GstPbutils.Objects.EncodingVideoProfile.EncodingVideoProfile'. -} encodingVideoProfileNew format preset restriction presence = liftIO $ do format' <- unsafeManagedPtrGetPtr format maybePreset <- case preset of Nothing -> return nullPtr Just jPreset -> do jPreset' <- textToCString jPreset return jPreset' maybeRestriction <- case restriction of Nothing -> return nullPtr Just jRestriction -> do jRestriction' <- unsafeManagedPtrGetPtr jRestriction return jRestriction' result <- gst_encoding_video_profile_new format' maybePreset maybeRestriction presence checkUnexpectedReturnNULL "encodingVideoProfileNew" result result' <- (wrapObject EncodingVideoProfile) result touchManagedPtr format whenJust restriction touchManagedPtr freeMem maybePreset return result' #if ENABLE_OVERLOADING #endif -- method EncodingVideoProfile::get_pass -- method type : OrdinaryMethod -- Args : [Arg {argCName = "prof", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingVideoProfile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "gst_encoding_video_profile_get_pass" gst_encoding_video_profile_get_pass :: Ptr EncodingVideoProfile -> -- prof : TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}) IO Word32 {- | Get the pass number if this is part of a multi-pass profile. -} encodingVideoProfileGetPass :: (B.CallStack.HasCallStack, MonadIO m, IsEncodingVideoProfile a) => a {- ^ /@prof@/: a 'GI.GstPbutils.Objects.EncodingVideoProfile.EncodingVideoProfile' -} -> m Word32 {- ^ __Returns:__ The pass number. Starts at 1 for multi-pass. 0 if this is not a multi-pass profile -} encodingVideoProfileGetPass prof = liftIO $ do prof' <- unsafeManagedPtrCastPtr prof result <- gst_encoding_video_profile_get_pass prof' touchManagedPtr prof return result #if ENABLE_OVERLOADING data EncodingVideoProfileGetPassMethodInfo instance (signature ~ (m Word32), MonadIO m, IsEncodingVideoProfile a) => O.MethodInfo EncodingVideoProfileGetPassMethodInfo a signature where overloadedMethod _ = encodingVideoProfileGetPass #endif -- method EncodingVideoProfile::get_variableframerate -- method type : OrdinaryMethod -- Args : [Arg {argCName = "prof", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingVideoProfile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_encoding_video_profile_get_variableframerate" gst_encoding_video_profile_get_variableframerate :: Ptr EncodingVideoProfile -> -- prof : TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}) IO CInt {- | /No description available in the introspection data./ -} encodingVideoProfileGetVariableframerate :: (B.CallStack.HasCallStack, MonadIO m, IsEncodingVideoProfile a) => a {- ^ /@prof@/: a 'GI.GstPbutils.Objects.EncodingVideoProfile.EncodingVideoProfile' -} -> m Bool {- ^ __Returns:__ Whether non-constant video framerate is allowed for encoding. -} encodingVideoProfileGetVariableframerate prof = liftIO $ do prof' <- unsafeManagedPtrCastPtr prof result <- gst_encoding_video_profile_get_variableframerate prof' let result' = (/= 0) result touchManagedPtr prof return result' #if ENABLE_OVERLOADING data EncodingVideoProfileGetVariableframerateMethodInfo instance (signature ~ (m Bool), MonadIO m, IsEncodingVideoProfile a) => O.MethodInfo EncodingVideoProfileGetVariableframerateMethodInfo a signature where overloadedMethod _ = encodingVideoProfileGetVariableframerate #endif -- method EncodingVideoProfile::set_pass -- method type : OrdinaryMethod -- Args : [Arg {argCName = "prof", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingVideoProfile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pass", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pass number for this profile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_encoding_video_profile_set_pass" gst_encoding_video_profile_set_pass :: Ptr EncodingVideoProfile -> -- prof : TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}) Word32 -> -- pass : TBasicType TUInt IO () {- | Sets the pass number of this video profile. The first pass profile should have this value set to 1. If this video profile isn\'t part of a multi-pass profile, you may set it to 0 (the default value). -} encodingVideoProfileSetPass :: (B.CallStack.HasCallStack, MonadIO m, IsEncodingVideoProfile a) => a {- ^ /@prof@/: a 'GI.GstPbutils.Objects.EncodingVideoProfile.EncodingVideoProfile' -} -> Word32 {- ^ /@pass@/: the pass number for this profile -} -> m () encodingVideoProfileSetPass prof pass = liftIO $ do prof' <- unsafeManagedPtrCastPtr prof gst_encoding_video_profile_set_pass prof' pass touchManagedPtr prof return () #if ENABLE_OVERLOADING data EncodingVideoProfileSetPassMethodInfo instance (signature ~ (Word32 -> m ()), MonadIO m, IsEncodingVideoProfile a) => O.MethodInfo EncodingVideoProfileSetPassMethodInfo a signature where overloadedMethod _ = encodingVideoProfileSetPass #endif -- method EncodingVideoProfile::set_variableframerate -- method type : OrdinaryMethod -- Args : [Arg {argCName = "prof", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingVideoProfile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "variableframerate", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a boolean", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_encoding_video_profile_set_variableframerate" gst_encoding_video_profile_set_variableframerate :: Ptr EncodingVideoProfile -> -- prof : TInterface (Name {namespace = "GstPbutils", name = "EncodingVideoProfile"}) CInt -> -- variableframerate : TBasicType TBoolean IO () {- | If set to 'True', then the incoming stream will be allowed to have non-constant framerate. If set to 'False' (default value), then the incoming stream will be normalized by dropping\/duplicating frames in order to produce a constance framerate. -} encodingVideoProfileSetVariableframerate :: (B.CallStack.HasCallStack, MonadIO m, IsEncodingVideoProfile a) => a {- ^ /@prof@/: a 'GI.GstPbutils.Objects.EncodingVideoProfile.EncodingVideoProfile' -} -> Bool {- ^ /@variableframerate@/: a boolean -} -> m () encodingVideoProfileSetVariableframerate prof variableframerate = liftIO $ do prof' <- unsafeManagedPtrCastPtr prof let variableframerate' = (fromIntegral . fromEnum) variableframerate gst_encoding_video_profile_set_variableframerate prof' variableframerate' touchManagedPtr prof return () #if ENABLE_OVERLOADING data EncodingVideoProfileSetVariableframerateMethodInfo instance (signature ~ (Bool -> m ()), MonadIO m, IsEncodingVideoProfile a) => O.MethodInfo EncodingVideoProfileSetVariableframerateMethodInfo a signature where overloadedMethod _ = encodingVideoProfileSetVariableframerate #endif