private static Result CloneImpl(IntPtr thisPtr, out IntPtr streamPointer) { streamPointer = IntPtr.Zero; Result result = Result.Ok; try { IStream stream = ((IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback).Clone(); streamPointer = ComStream.ToIntPtr(stream); } catch (SharpDXException ex) { result = ex.ResultCode; } catch (Exception ex) { result = (Result)Result.Fail.Code; } return(result); }
private static Result CloneImpl(IntPtr thisPtr, out IntPtr streamPointer) { streamPointer = IntPtr.Zero; var result = Result.Ok; try { var shadow = ToShadow <ComStreamShadow>(thisPtr); var callback = ((IStream)shadow.Callback); var clone = callback.Clone(); streamPointer = ComStream.ToIntPtr(clone); } catch (SharpDXException exception) { result = exception.ResultCode; } catch (Exception) { result = Result.Fail.Code; } return(result); }
/// <summary> /// Instantiates a new instance <see cref="ByteStream"/> from a <see cref="Stream"/>. /// </summary> /// <msdn-id>hh162754</msdn-id> /// <unmanaged>HRESULT MFCreateMFByteStreamOnStreamEx([In] IUnknown* punkStream,[Out] IMFByteStream** ppByteStream)</unmanaged> /// <unmanaged-short>MFCreateMFByteStreamOnStreamEx</unmanaged-short> public ByteStream(ComStream sourceStream) { this.comStream = sourceStream; IByteStream localStream; MediaFactory.CreateMFByteStreamOnStream(sourceStream.NativePointer, out localStream); NativePointer = ((ByteStream)localStream).NativePointer; }
public long CopyTo(IStream streamDest, long numberOfBytesToCopy, out long bytesWritten) { this.CopyTo_(ComStream.ToIntPtr(streamDest), numberOfBytesToCopy, out bytesWritten); return(bytesWritten); }