{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The interface allows unified access to control flipping and rotation
-- operations of video-sources or operators.
-- 
-- /Since: 1.10/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.GstVideo.Interfaces.VideoDirection
    ( 

-- * Exported types
    VideoDirection(..)                      ,
    IsVideoDirection                        ,
    toVideoDirection                        ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveVideoDirectionMethod             ,
#endif




 -- * Properties
-- ** videoDirection #attr:videoDirection#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    VideoDirectionVideoDirectionPropertyInfo,
#endif
    constructVideoDirectionVideoDirection   ,
    getVideoDirectionVideoDirection         ,
    setVideoDirectionVideoDirection         ,
#if defined(ENABLE_OVERLOADING)
    videoDirectionVideoDirection            ,
#endif




    ) 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.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.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 {-# SOURCE #-} qualified GI.GstVideo.Enums as GstVideo.Enums

-- interface VideoDirection 
-- | Memory-managed wrapper type.
newtype VideoDirection = VideoDirection (SP.ManagedPtr VideoDirection)
    deriving (VideoDirection -> VideoDirection -> Bool
(VideoDirection -> VideoDirection -> Bool)
-> (VideoDirection -> VideoDirection -> Bool) -> Eq VideoDirection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VideoDirection -> VideoDirection -> Bool
$c/= :: VideoDirection -> VideoDirection -> Bool
== :: VideoDirection -> VideoDirection -> Bool
$c== :: VideoDirection -> VideoDirection -> Bool
Eq)

instance SP.ManagedPtrNewtype VideoDirection where
    toManagedPtr :: VideoDirection -> ManagedPtr VideoDirection
toManagedPtr (VideoDirection ManagedPtr VideoDirection
p) = ManagedPtr VideoDirection
p

foreign import ccall "gst_video_direction_get_type"
    c_gst_video_direction_get_type :: IO B.Types.GType

instance B.Types.TypedObject VideoDirection where
    glibType :: IO GType
glibType = IO GType
c_gst_video_direction_get_type

instance B.Types.GObject VideoDirection

-- | Convert 'VideoDirection' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue VideoDirection where
    toGValue :: VideoDirection -> IO GValue
toGValue VideoDirection
o = do
        GType
gtype <- IO GType
c_gst_video_direction_get_type
        VideoDirection -> (Ptr VideoDirection -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr VideoDirection
o (GType
-> (GValue -> Ptr VideoDirection -> IO ())
-> Ptr VideoDirection
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr VideoDirection -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO VideoDirection
fromGValue GValue
gv = do
        Ptr VideoDirection
ptr <- GValue -> IO (Ptr VideoDirection)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr VideoDirection)
        (ManagedPtr VideoDirection -> VideoDirection)
-> Ptr VideoDirection -> IO VideoDirection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr VideoDirection -> VideoDirection
VideoDirection Ptr VideoDirection
ptr
        
    

-- | Type class for types which can be safely cast to `VideoDirection`, for instance with `toVideoDirection`.
class (SP.GObject o, O.IsDescendantOf VideoDirection o) => IsVideoDirection o
instance (SP.GObject o, O.IsDescendantOf VideoDirection o) => IsVideoDirection o

instance O.HasParentTypes VideoDirection
type instance O.ParentTypes VideoDirection = '[GObject.Object.Object]

-- | Cast to `VideoDirection`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toVideoDirection :: (MonadIO m, IsVideoDirection o) => o -> m VideoDirection
toVideoDirection :: o -> m VideoDirection
toVideoDirection = IO VideoDirection -> m VideoDirection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO VideoDirection -> m VideoDirection)
-> (o -> IO VideoDirection) -> o -> m VideoDirection
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr VideoDirection -> VideoDirection)
-> o -> IO VideoDirection
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr VideoDirection -> VideoDirection
VideoDirection

-- VVV Prop "video-direction"
   -- Type: TInterface (Name {namespace = "GstVideo", name = "VideoOrientationMethod"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@video-direction@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' videoDirection #videoDirection
-- @
getVideoDirectionVideoDirection :: (MonadIO m, IsVideoDirection o) => o -> m GstVideo.Enums.VideoOrientationMethod
getVideoDirectionVideoDirection :: o -> m VideoOrientationMethod
getVideoDirectionVideoDirection o
obj = IO VideoOrientationMethod -> m VideoOrientationMethod
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO VideoOrientationMethod -> m VideoOrientationMethod)
-> IO VideoOrientationMethod -> m VideoOrientationMethod
forall a b. (a -> b) -> a -> b
$ o -> String -> IO VideoOrientationMethod
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"video-direction"

-- | Set the value of the “@video-direction@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' videoDirection [ #videoDirection 'Data.GI.Base.Attributes.:=' value ]
-- @
setVideoDirectionVideoDirection :: (MonadIO m, IsVideoDirection o) => o -> GstVideo.Enums.VideoOrientationMethod -> m ()
setVideoDirectionVideoDirection :: o -> VideoOrientationMethod -> m ()
setVideoDirectionVideoDirection o
obj VideoOrientationMethod
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> VideoOrientationMethod -> IO ()
forall a b.
(GObject a, Enum b, BoxedEnum b) =>
a -> String -> b -> IO ()
B.Properties.setObjectPropertyEnum o
obj String
"video-direction" VideoOrientationMethod
val

-- | Construct a `GValueConstruct` with valid value for the “@video-direction@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructVideoDirectionVideoDirection :: (IsVideoDirection o, MIO.MonadIO m) => GstVideo.Enums.VideoOrientationMethod -> m (GValueConstruct o)
constructVideoDirectionVideoDirection :: VideoOrientationMethod -> m (GValueConstruct o)
constructVideoDirectionVideoDirection VideoOrientationMethod
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> VideoOrientationMethod -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum String
"video-direction" VideoOrientationMethod
val

#if defined(ENABLE_OVERLOADING)
data VideoDirectionVideoDirectionPropertyInfo
instance AttrInfo VideoDirectionVideoDirectionPropertyInfo where
    type AttrAllowedOps VideoDirectionVideoDirectionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint VideoDirectionVideoDirectionPropertyInfo = IsVideoDirection
    type AttrSetTypeConstraint VideoDirectionVideoDirectionPropertyInfo = (~) GstVideo.Enums.VideoOrientationMethod
    type AttrTransferTypeConstraint VideoDirectionVideoDirectionPropertyInfo = (~) GstVideo.Enums.VideoOrientationMethod
    type AttrTransferType VideoDirectionVideoDirectionPropertyInfo = GstVideo.Enums.VideoOrientationMethod
    type AttrGetType VideoDirectionVideoDirectionPropertyInfo = GstVideo.Enums.VideoOrientationMethod
    type AttrLabel VideoDirectionVideoDirectionPropertyInfo = "video-direction"
    type AttrOrigin VideoDirectionVideoDirectionPropertyInfo = VideoDirection
    attrGet = getVideoDirectionVideoDirection
    attrSet = setVideoDirectionVideoDirection
    attrTransfer _ v = do
        return v
    attrConstruct = constructVideoDirectionVideoDirection
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList VideoDirection
type instance O.AttributeList VideoDirection = VideoDirectionAttributeList
type VideoDirectionAttributeList = ('[ '("videoDirection", VideoDirectionVideoDirectionPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
videoDirectionVideoDirection :: AttrLabelProxy "videoDirection"
videoDirectionVideoDirection = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveVideoDirectionMethod (t :: Symbol) (o :: *) :: * where
    ResolveVideoDirectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveVideoDirectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveVideoDirectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveVideoDirectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveVideoDirectionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveVideoDirectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveVideoDirectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveVideoDirectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveVideoDirectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveVideoDirectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveVideoDirectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveVideoDirectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveVideoDirectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveVideoDirectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveVideoDirectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveVideoDirectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveVideoDirectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveVideoDirectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveVideoDirectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveVideoDirectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveVideoDirectionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveVideoDirectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveVideoDirectionMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveVideoDirectionMethod t VideoDirection, O.MethodInfo info VideoDirection p) => OL.IsLabel t (VideoDirection -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList VideoDirection = VideoDirectionSignalList
type VideoDirectionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif