packages feed

gi-gst-0.1.6.13: GI/Gst/Structs/ProtectionMeta.hs


{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

Metadata type that holds information about a sample from a protection-protected
track, including the information needed to decrypt it (if it is encrypted).
-}

module GI.Gst.Structs.ProtectionMeta
    ( 

-- * Exported types
    ProtectionMeta(..)                      ,
    newZeroProtectionMeta                   ,
    noProtectionMeta                        ,


 -- * Methods
-- ** protectionMetaGetInfo
    protectionMetaGetInfo                   ,




 -- * Properties
-- ** Info
    protectionMetaReadInfo                  ,


-- ** Meta
    protectionMetaReadMeta                  ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gst.Types
import GI.Gst.Callbacks

newtype ProtectionMeta = ProtectionMeta (ForeignPtr ProtectionMeta)
-- | Construct a `ProtectionMeta` struct initialized to zero.
newZeroProtectionMeta :: MonadIO m => m ProtectionMeta
newZeroProtectionMeta = liftIO $ callocBytes 24 >>= wrapPtr ProtectionMeta

noProtectionMeta :: Maybe ProtectionMeta
noProtectionMeta = Nothing

protectionMetaReadMeta :: ProtectionMeta -> IO Meta
protectionMetaReadMeta s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (Ptr Meta)
    val' <- (newPtr 16 Meta) val
    return val'

protectionMetaReadInfo :: ProtectionMeta -> IO Structure
protectionMetaReadInfo s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO (Ptr Structure)
    val' <- (newBoxed Structure) val
    return val'

-- method ProtectionMeta::get_info
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : TInterface "Gst" "MetaInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gst_protection_meta_get_info" gst_protection_meta_get_info :: 
    IO (Ptr MetaInfo)


protectionMetaGetInfo ::
    (MonadIO m) =>
    m MetaInfo                              -- result
protectionMetaGetInfo  = liftIO $ do
    result <- gst_protection_meta_get_info
    checkUnexpectedReturnNULL "gst_protection_meta_get_info" result
    result' <- (newPtr 80 MetaInfo) result
    return result'

type family ResolveProtectionMetaMethod (t :: Symbol) (o :: *) :: * where
    ResolveProtectionMetaMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveProtectionMetaMethod t ProtectionMeta, MethodInfo info ProtectionMeta p) => IsLabelProxy t (ProtectionMeta -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveProtectionMetaMethod t ProtectionMeta, MethodInfo info ProtectionMeta p) => IsLabel t (ProtectionMeta -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif