Exemplo n.º 1
0
        public HRESULT GetBlobSize(Guid guidKey, out uint pcbBlobSize)
        {
            var hr = _type.GetBlobSize(guidKey, out pcbBlobSize);

            Trace("guid: " + guidKey.ToName() + " size: " + pcbBlobSize + " hr: " + hr);
            return(hr);
        }
Exemplo n.º 2
0
        public static byte[] GetBlob(this IMFMediaType input, Guid key)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if (input.GetBlobSize(key, out var size).IsError || size == 0)
            {
                return(null);
            }

            var bytes = new byte[(int)size];

            input.GetBlob(key, bytes, (int)size, IntPtr.Zero).ThrowOnError();
            return(bytes);
        }
Exemplo n.º 3
0
        public static byte[] GetBlob(this IMFMediaType obj, Guid key)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if (obj.GetBlobSize(key, out var size).IsError || size == 0)
            {
                return(null);
            }

            var bytes = new byte[(int)size];

            obj.GetBlob(key, bytes, size, ref size).ThrowOnError();
            return(bytes);
        }