Exemplo n.º 1
0
        public static NSDictionary GetAttachments(this ICMAttachmentBearer target, CMAttachmentMode attachmentMode)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            var attachments = CMCopyDictionaryOfAttachments(IntPtr.Zero, target.Handle, attachmentMode);

            if (attachments == IntPtr.Zero)
            {
                return(null);
            }
            return(Runtime.GetNSObject <NSDictionary> (attachments, true));
        }
Exemplo n.º 2
0
        public static T GetAttachment <T> (this ICMAttachmentBearer target, string key, out CMAttachmentMode attachmentModeOut) where T : class, INativeObject
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            var nsKey  = NSString.CreateNative(key);
            var attchm = CMGetAttachment(target.Handle, nsKey, out attachmentModeOut);

            NSString.ReleaseNative(nsKey);
            if (attchm != IntPtr.Zero)
            {
                return(Runtime.GetINativeObject <T> (attchm, false));
            }
            return(default(T));
        }
Exemplo n.º 3
0
 extern static /* CFTypeRef */ IntPtr CMGetAttachment(/* CMAttachmentBearerRef */ IntPtr target, /* CFStringRef */ IntPtr key,
                                                      /* CMAttachmentMode */ out CMAttachmentMode attachmentModeOut);
Exemplo n.º 4
0
 public static void SetAttachments(this ICMAttachmentBearer target, NSDictionary theAttachments, CMAttachmentMode attachmentMode)
 {
     if (target == null)
     {
         throw new ArgumentNullException(nameof(target));
     }
     if (theAttachments == null)
     {
         throw new ArgumentNullException(nameof(theAttachments));
     }
     CMSetAttachments(target.Handle, theAttachments.Handle, attachmentMode);
 }
Exemplo n.º 5
0
 extern static /* CFDictionaryRef */ IntPtr CMCopyDictionaryOfAttachments(/* CFAllocatorRef */ IntPtr allocator, /* CMAttachmentBearerRef */ IntPtr target,
                                                                          /* CMAttachmentMode */ CMAttachmentMode attachmentMode);
Exemplo n.º 6
0
        public static void SetAttachment(this ICMAttachmentBearer target, string key, INativeObject value, CMAttachmentMode attachmentMode)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            var nsKey = NSString.CreateNative(key);

            CMSetAttachment(target.Handle, nsKey, value.Handle, attachmentMode);
            NSString.ReleaseNative(nsKey);
        }
Exemplo n.º 7
0
 extern static void CMSetAttachments(/* CMAttachmentBearerRef */ IntPtr target, /* CFDictionaryRef */ IntPtr theAttachments,
                                     /* CMAttachmentMode */ CMAttachmentMode attachmentMode);
Exemplo n.º 8
0
 extern static void CMSetAttachment(/* CMAttachmentBearerRef */ IntPtr target, /* CFStringRef */ IntPtr key, /* CFTypeRef */ IntPtr value,
                                    /* CMAttachmentMode */ CMAttachmentMode attachmentMode);
Exemplo n.º 9
0
 public static T GetAttachment <T> (this ICMAttachmentBearer target, CMSampleBufferAttachmentKey key, out CMAttachmentMode attachmentModeOut) where T : class, INativeObject
 {
     return(GetAttachment <T> (target, key.GetConstant(), out attachmentModeOut));
 }
Exemplo n.º 10
0
        // There is some API that needs a more strongly typed version of a NSDictionary
        // and there is no easy way to downcast from NSDictionary to NSDictionary<TKey, TValue>
        public static NSDictionary <TKey, TValue> GetAttachments <TKey, TValue> (this ICMAttachmentBearer target, CMAttachmentMode attachmentMode)
            where TKey : class, INativeObject
            where TValue : class, INativeObject
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            var attachments = CMCopyDictionaryOfAttachments(IntPtr.Zero, target.Handle, attachmentMode);

            if (attachments == IntPtr.Zero)
            {
                return(null);
            }

            return(Runtime.GetNSObject <NSDictionary <TKey, TValue> > (attachments, true));
        }
Exemplo n.º 11
0
 public static void SetAttachments(this ICMAttachmentBearer target, NSDictionary theAttachments, CMAttachmentMode attachmentMode)
 {
     if (target is null)
     {
         ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(target));
     }
     if (theAttachments is null)
     {
         ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(theAttachments));
     }
     CMSetAttachments(target.Handle, theAttachments.Handle, attachmentMode);
 }
Exemplo n.º 12
0
        public static void SetAttachment(this ICMAttachmentBearer target, string key, INativeObject value, CMAttachmentMode attachmentMode)
        {
            if (target is null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(target));
            }
            if (value is null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(value));
            }
            if (key is null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(key));
            }
            var nsKey = CFString.CreateNative(key);

            CMSetAttachment(target.Handle, nsKey, value.Handle, attachmentMode);
            CFString.ReleaseNative(nsKey);
        }