{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) The interface allows unified access to control flipping and autocenter operation of video-sources or operators. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.GstVideo.Interfaces.VideoOrientation ( -- * Exported types VideoOrientation(..) , noVideoOrientation , IsVideoOrientation , -- * Methods -- ** getHcenter #method:getHcenter# #if ENABLE_OVERLOADING VideoOrientationGetHcenterMethodInfo , #endif videoOrientationGetHcenter , -- ** getHflip #method:getHflip# #if ENABLE_OVERLOADING VideoOrientationGetHflipMethodInfo , #endif videoOrientationGetHflip , -- ** getVcenter #method:getVcenter# #if ENABLE_OVERLOADING VideoOrientationGetVcenterMethodInfo , #endif videoOrientationGetVcenter , -- ** getVflip #method:getVflip# #if ENABLE_OVERLOADING VideoOrientationGetVflipMethodInfo , #endif videoOrientationGetVflip , -- ** setHcenter #method:setHcenter# #if ENABLE_OVERLOADING VideoOrientationSetHcenterMethodInfo , #endif videoOrientationSetHcenter , -- ** setHflip #method:setHflip# #if ENABLE_OVERLOADING VideoOrientationSetHflipMethodInfo , #endif videoOrientationSetHflip , -- ** setVcenter #method:setVcenter# #if ENABLE_OVERLOADING VideoOrientationSetVcenterMethodInfo , #endif videoOrientationSetVcenter , -- ** setVflip #method:setVflip# #if ENABLE_OVERLOADING VideoOrientationSetVflipMethodInfo , #endif videoOrientationSetVflip , ) 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 -- interface VideoOrientation -- | Memory-managed wrapper type. newtype VideoOrientation = VideoOrientation (ManagedPtr VideoOrientation) -- | A convenience alias for `Nothing` :: `Maybe` `VideoOrientation`. noVideoOrientation :: Maybe VideoOrientation noVideoOrientation = Nothing #if ENABLE_OVERLOADING type instance O.SignalList VideoOrientation = VideoOrientationSignalList type VideoOrientationSignalList = ('[ ] :: [(Symbol, *)]) #endif -- | Type class for types which implement `VideoOrientation`. class ManagedPtrNewtype a => IsVideoOrientation a instance IsVideoOrientation VideoOrientation -- XXX Wrapping a foreign struct/union with no known destructor or size, leak? instance WrappedPtr VideoOrientation where wrappedPtrCalloc = return nullPtr wrappedPtrCopy = return wrappedPtrFree = Nothing #if ENABLE_OVERLOADING type family ResolveVideoOrientationMethod (t :: Symbol) (o :: *) :: * where ResolveVideoOrientationMethod "getHcenter" o = VideoOrientationGetHcenterMethodInfo ResolveVideoOrientationMethod "getHflip" o = VideoOrientationGetHflipMethodInfo ResolveVideoOrientationMethod "getVcenter" o = VideoOrientationGetVcenterMethodInfo ResolveVideoOrientationMethod "getVflip" o = VideoOrientationGetVflipMethodInfo ResolveVideoOrientationMethod "setHcenter" o = VideoOrientationSetHcenterMethodInfo ResolveVideoOrientationMethod "setHflip" o = VideoOrientationSetHflipMethodInfo ResolveVideoOrientationMethod "setVcenter" o = VideoOrientationSetVcenterMethodInfo ResolveVideoOrientationMethod "setVflip" o = VideoOrientationSetVflipMethodInfo ResolveVideoOrientationMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveVideoOrientationMethod t VideoOrientation, O.MethodInfo info VideoOrientation p) => OL.IsLabel t (VideoOrientation -> 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 -- method VideoOrientation::get_hcenter -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "center", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_video_orientation_get_hcenter" gst_video_orientation_get_hcenter :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) Ptr Int32 -> -- center : TBasicType TInt IO CInt {- | Get the horizontal centering offset from the given object. -} videoOrientationGetHcenter :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> m ((Bool, Int32)) {- ^ __Returns:__ 'True' in case the element supports centering -} videoOrientationGetHcenter videoOrientation = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation center <- allocMem :: IO (Ptr Int32) result <- gst_video_orientation_get_hcenter videoOrientation' center let result' = (/= 0) result center' <- peek center touchManagedPtr videoOrientation freeMem center return (result', center') #if ENABLE_OVERLOADING data VideoOrientationGetHcenterMethodInfo instance (signature ~ (m ((Bool, Int32))), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationGetHcenterMethodInfo a signature where overloadedMethod _ = videoOrientationGetHcenter #endif -- method VideoOrientation::get_hflip -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flip", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_video_orientation_get_hflip" gst_video_orientation_get_hflip :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) Ptr CInt -> -- flip : TBasicType TBoolean IO CInt {- | Get the horizontal flipping state ('True' for flipped) from the given object. -} videoOrientationGetHflip :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> m ((Bool, Bool)) {- ^ __Returns:__ 'True' in case the element supports flipping -} videoOrientationGetHflip videoOrientation = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation flip <- allocMem :: IO (Ptr CInt) result <- gst_video_orientation_get_hflip videoOrientation' flip let result' = (/= 0) result flip' <- peek flip let flip'' = (/= 0) flip' touchManagedPtr videoOrientation freeMem flip return (result', flip'') #if ENABLE_OVERLOADING data VideoOrientationGetHflipMethodInfo instance (signature ~ (m ((Bool, Bool))), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationGetHflipMethodInfo a signature where overloadedMethod _ = videoOrientationGetHflip #endif -- method VideoOrientation::get_vcenter -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "center", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_video_orientation_get_vcenter" gst_video_orientation_get_vcenter :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) Ptr Int32 -> -- center : TBasicType TInt IO CInt {- | Get the vertical centering offset from the given object. -} videoOrientationGetVcenter :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> m ((Bool, Int32)) {- ^ __Returns:__ 'True' in case the element supports centering -} videoOrientationGetVcenter videoOrientation = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation center <- allocMem :: IO (Ptr Int32) result <- gst_video_orientation_get_vcenter videoOrientation' center let result' = (/= 0) result center' <- peek center touchManagedPtr videoOrientation freeMem center return (result', center') #if ENABLE_OVERLOADING data VideoOrientationGetVcenterMethodInfo instance (signature ~ (m ((Bool, Int32))), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationGetVcenterMethodInfo a signature where overloadedMethod _ = videoOrientationGetVcenter #endif -- method VideoOrientation::get_vflip -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flip", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_video_orientation_get_vflip" gst_video_orientation_get_vflip :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) Ptr CInt -> -- flip : TBasicType TBoolean IO CInt {- | Get the vertical flipping state ('True' for flipped) from the given object. -} videoOrientationGetVflip :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> m ((Bool, Bool)) {- ^ __Returns:__ 'True' in case the element supports flipping -} videoOrientationGetVflip videoOrientation = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation flip <- allocMem :: IO (Ptr CInt) result <- gst_video_orientation_get_vflip videoOrientation' flip let result' = (/= 0) result flip' <- peek flip let flip'' = (/= 0) flip' touchManagedPtr videoOrientation freeMem flip return (result', flip'') #if ENABLE_OVERLOADING data VideoOrientationGetVflipMethodInfo instance (signature ~ (m ((Bool, Bool))), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationGetVflipMethodInfo a signature where overloadedMethod _ = videoOrientationGetVflip #endif -- method VideoOrientation::set_hcenter -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "center", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "centering offset", 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_video_orientation_set_hcenter" gst_video_orientation_set_hcenter :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) Int32 -> -- center : TBasicType TInt IO CInt {- | Set the horizontal centering offset for the given object. -} videoOrientationSetHcenter :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> Int32 {- ^ /@center@/: centering offset -} -> m Bool {- ^ __Returns:__ 'True' in case the element supports centering -} videoOrientationSetHcenter videoOrientation center = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation result <- gst_video_orientation_set_hcenter videoOrientation' center let result' = (/= 0) result touchManagedPtr videoOrientation return result' #if ENABLE_OVERLOADING data VideoOrientationSetHcenterMethodInfo instance (signature ~ (Int32 -> m Bool), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationSetHcenterMethodInfo a signature where overloadedMethod _ = videoOrientationSetHcenter #endif -- method VideoOrientation::set_hflip -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flip", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "use flipping", 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_video_orientation_set_hflip" gst_video_orientation_set_hflip :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) CInt -> -- flip : TBasicType TBoolean IO CInt {- | Set the horizontal flipping state ('True' for flipped) for the given object. -} videoOrientationSetHflip :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> Bool {- ^ /@flip@/: use flipping -} -> m Bool {- ^ __Returns:__ 'True' in case the element supports flipping -} videoOrientationSetHflip videoOrientation flip = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation let flip' = (fromIntegral . fromEnum) flip result <- gst_video_orientation_set_hflip videoOrientation' flip' let result' = (/= 0) result touchManagedPtr videoOrientation return result' #if ENABLE_OVERLOADING data VideoOrientationSetHflipMethodInfo instance (signature ~ (Bool -> m Bool), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationSetHflipMethodInfo a signature where overloadedMethod _ = videoOrientationSetHflip #endif -- method VideoOrientation::set_vcenter -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "center", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "centering offset", 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_video_orientation_set_vcenter" gst_video_orientation_set_vcenter :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) Int32 -> -- center : TBasicType TInt IO CInt {- | Set the vertical centering offset for the given object. -} videoOrientationSetVcenter :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> Int32 {- ^ /@center@/: centering offset -} -> m Bool {- ^ __Returns:__ 'True' in case the element supports centering -} videoOrientationSetVcenter videoOrientation center = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation result <- gst_video_orientation_set_vcenter videoOrientation' center let result' = (/= 0) result touchManagedPtr videoOrientation return result' #if ENABLE_OVERLOADING data VideoOrientationSetVcenterMethodInfo instance (signature ~ (Int32 -> m Bool), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationSetVcenterMethodInfo a signature where overloadedMethod _ = videoOrientationSetVcenter #endif -- method VideoOrientation::set_vflip -- method type : OrdinaryMethod -- Args : [Arg {argCName = "video_orientation", argType = TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstVideoOrientation interface of a #GstElement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flip", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "use flipping", 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_video_orientation_set_vflip" gst_video_orientation_set_vflip :: Ptr VideoOrientation -> -- video_orientation : TInterface (Name {namespace = "GstVideo", name = "VideoOrientation"}) CInt -> -- flip : TBasicType TBoolean IO CInt {- | Set the vertical flipping state ('True' for flipped) for the given object. -} videoOrientationSetVflip :: (B.CallStack.HasCallStack, MonadIO m, IsVideoOrientation a) => a {- ^ /@videoOrientation@/: 'GI.GstVideo.Interfaces.VideoOrientation.VideoOrientation' interface of a 'GI.Gst.Objects.Element.Element' -} -> Bool {- ^ /@flip@/: use flipping -} -> m Bool {- ^ __Returns:__ 'True' in case the element supports flipping -} videoOrientationSetVflip videoOrientation flip = liftIO $ do videoOrientation' <- unsafeManagedPtrCastPtr videoOrientation let flip' = (fromIntegral . fromEnum) flip result <- gst_video_orientation_set_vflip videoOrientation' flip' let result' = (/= 0) result touchManagedPtr videoOrientation return result' #if ENABLE_OVERLOADING data VideoOrientationSetVflipMethodInfo instance (signature ~ (Bool -> m Bool), MonadIO m, IsVideoOrientation a) => O.MethodInfo VideoOrientationSetVflipMethodInfo a signature where overloadedMethod _ = videoOrientationSetVflip #endif