コード例 #1
0
ファイル: MFMediaTypeWrapper.cs プロジェクト: zhuowp/DirectN
        public HRESULT GetBlob(Guid guidKey, byte[] pBuf, int cbBufSize, IntPtr pcbBlobSize)
        {
            var hr = _type.GetBlob(guidKey, pBuf, cbBufSize, pcbBlobSize);

            Trace("guid: " + guidKey.ToName() + " buf: " + Conversions.ToHexa(pBuf, 64) + " size: " + cbBufSize + " len: " + pcbBlobSize + " hr: " + hr);
            return(hr);
        }
コード例 #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);
        }
コード例 #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);
        }