コード例 #1
0
ファイル: ByteStream.cs プロジェクト: superowner/AudioSharp
 /// <summary>
 /// <p><strong>Applies to: </strong>desktop apps | Metro style apps</p><p> Begins an asynchronous write operation to the stream. </p>
 /// </summary>
 /// <param name="bRef"><dd> <p> Pointer to a buffer containing the data to write. </p> </dd></param>
 /// <param name="offset">The offset within the buffer to begin writing at.</param>
 /// <param name="count"><dd> <p> Size of the buffer in bytes. </p> </dd></param>
 /// <param name="callbackRef"><dd> <p> Pointer to the <strong><see cref="SharpDX.MediaFoundation.IAsyncCallback"/></strong> interface of a callback object. The caller must implement this interface. </p> </dd></param>
 /// <param name="context"><dd> <p> Pointer to the <strong><see cref="SharpDX.ComObject"/></strong> interface of a state object, defined by the caller. This parameter can be <strong><c>null</c></strong>. You can use this object to hold state information. The object is returned to the caller when the callback is invoked. </p> </dd></param>
 /// <returns><p>If this method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
 /// <remarks>
 /// <p> When all of the data has been written to the stream, the callback object's <strong><see cref="SharpDX.MediaFoundation.IAsyncCallback.Invoke"/></strong> method is called. At that point, the application should call <strong><see cref="SharpDX.MediaFoundation.IByteStream.EndWrite"/></strong> to complete the asynchronous request. </p><p> Do not reallocate, free, or write to the buffer while an asynchronous write is still pending. </p><p>This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:</p><ul> <li>Windows?XP with Service Pack?2 (SP2) and later.</li> <li>Windows?XP Media Center Edition?2005 with KB900325 (Windows?XP Media Center Edition?2005) and KB925766 (October 2006 Update Rollup for Windows?XP Media Center Edition) installed.</li> </ul>
 /// </remarks>
 /// <msdn-id>ms694005</msdn-id>
 /// <unmanaged>HRESULT IMFByteStream::BeginWrite([In, Buffer] const unsigned char* pb,[In] unsigned int cb,[In] IMFAsyncCallback* pCallback,[In] IUnknown* punkState)</unmanaged>
 /// <unmanaged-short>IMFByteStream::BeginWrite</unmanaged-short>
 public unsafe void BeginWrite(byte[] bRef, int offset, int count, SharpDX.MediaFoundation.IAsyncCallback callbackRef, object context)
 {
     fixed(void *ptr = &bRef[offset])
     BeginWrite__((System.IntPtr)ptr, count, AsyncCallbackShadow.ToIntPtr(callbackRef), context != null ? Marshal.GetIUnknownForObject(context) : IntPtr.Zero);
 }
コード例 #2
0
 /// <summary>
 /// <p><strong>Applies to: </strong>desktop apps | Metro style apps</p><p> </p><p>Begins an asynchronous request for the next event in the queue.</p>
 /// </summary>
 /// <param name="callback"><dd> <p>Pointer to the <strong><see cref="SharpDX.MediaFoundation.IAsyncCallback"/></strong> interface of a callback object. The client must implement this interface.</p> </dd></param>
 /// <param name="stateObject">A reference to a state object, defined by the caller. This parameter can be <strong><c>null</c></strong>. You can use this object to hold state information. The object is returned to the caller when the callback is invoked.</param>
 /// <remarks>
 /// <p>When a new event is available, the event generator calls the <strong><see cref="SharpDX.MediaFoundation.IAsyncCallback.Invoke"/></strong> method. The <strong>Invoke</strong> method should call <strong><see cref="SharpDX.MediaFoundation.MediaEventGenerator.EndGetEvent"/></strong> to get a reference to the <strong><see cref="SharpDX.MediaFoundation.MediaEvent"/></strong> interface, and use that interface to examine the event.</p><p>Do not call <strong>BeginGetEvent</strong> a second time before calling <strong>EndGetEvent</strong>. While the first call is still pending, additional calls to the same object will fail. Also, the <strong><see cref="SharpDX.MediaFoundation.MediaEventGenerator.GetEvent"/></strong> method fails if an asynchronous request is still pending.</p>
 /// </remarks>
 /// <msdn-id>ms701637</msdn-id>
 /// <unmanaged>HRESULT IMFMediaEventGenerator::BeginGetEvent([In] IMFAsyncCallback* pCallback,[In] void* punkState)</unmanaged>
 /// <unmanaged-short>IMFMediaEventGenerator::BeginGetEvent</unmanaged-short>
 public void BeginGetEvent(IAsyncCallback callback, object stateObject)
 {
     BeginGetEvent_(AsyncCallbackShadow.ToIntPtr(callback), stateObject == null ? IntPtr.Zero : Marshal.GetIUnknownForObject(stateObject));
 }