// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Runtime.InteropServices;
namespace SharpDX.MediaFoundation
{
public partial class AsyncResult
{
private object state;
private bool isStateVerified;
///
/// Gets the state object specified by the caller in the asynchronous Begin method. If the value is not null, the caller must dispose.
///
/// The state.
///
/// The caller of the asynchronous method specifies the state object, and can use it for any caller-defined purpose. The state object can be null. If the state object is null, GetState returns E_POINTER.
If you are implementing an asynchronous method, set the state object on the through the punkState parameter of the function.
This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:
- Windows?XP with Service Pack?2 (SP2) and later.
- 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.
///
/// bb970576
/// HRESULT IMFAsyncResult::GetState([Out] IUnknown** ppunkState)
/// IMFAsyncResult::GetState
public object State
{
get
{
if (!isStateVerified)
{
IntPtr statePtr;
GetState(out statePtr);
if (statePtr != IntPtr.Zero)
{
state = Marshal.GetObjectForIUnknown(statePtr);
Marshal.Release(statePtr);
}
isStateVerified = true;
}
return state;
}
}
///
/// Get or sets the status of the asynchronous operation.
///
/// The method returns an . Possible values include, but are not limited to, those in the following table.
| Return code | Description |
| The operation completed successfully. |
?
///
/// This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:
- Windows?XP with Service Pack?2 (SP2) and later.
- 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.
///
/// ms702095
/// HRESULT IMFAsyncResult::GetStatus()
/// IMFAsyncResult::GetStatus
public SharpDX.Result Status
{
get { return GetStatus(); }
set { SetStatus(value); }
}
///
/// Applies to: desktop apps | Metro style apps
Returns an object associated with the asynchronous operation. The type of object, if any, depends on the asynchronous method that was called.
///
/// Receives a reference to the object's interface. If no object is associated with the operation, this parameter receives the value null. If the value is not null, the caller must release the interface.
///
/// Typically, this object is used by the component that implements the asynchronous method. It provides a way for the function that invokes the callback to pass information to the asynchronous End... method that completes the operation.
If you are implementing an asynchronous method, you can set the object through the punkObject parameter of the function.
If the asynchronous result object's internal reference is null, the method returns E_POINTER.
This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:
- Windows?XP with Service Pack?2 (SP2) and later.
- 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.
///
/// bb970500
/// HRESULT IMFAsyncResult::GetObjectW([Out] IUnknown** ppObject)
/// IMFAsyncResult::GetObjectW
public IUnknown PrivateObject
{
get
{
GetObject(out IUnknown privateObject);
return privateObject;
}
}
}
}