Skip to main content

mfxFrameSurfaceInterface

Struct mfxFrameSurfaceInterface 

Source
#[repr(C)]
pub struct mfxFrameSurfaceInterface {
Show 14 fields pub Context: mfxHDL, pub Version: mfxStructVersion, pub reserved1: [mfxU16; 3], pub AddRef: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1) -> mfxStatus>, pub Release: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1) -> mfxStatus>, pub GetRefCounter: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, counter: *mut mfxU32) -> mfxStatus>, pub Map: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, flags: mfxU32) -> mfxStatus>, pub Unmap: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1) -> mfxStatus>, pub GetNativeHandle: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, resource: *mut mfxHDL, resource_type: *mut mfxResourceType) -> mfxStatus>, pub GetDeviceHandle: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, device_handle: *mut mfxHDL, device_type: *mut mfxHandleType) -> mfxStatus>, pub Synchronize: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, wait: mfxU32) -> mfxStatus>, pub OnComplete: Option<unsafe extern "C" fn(sts: mfxStatus)>, pub QueryInterface: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, guid: mfxGUID, iface: *mut mfxHDL) -> mfxStatus>, pub reserved2: [mfxHDL; 2],
}
Expand description

Specifies frame surface interface.

Fields§

§Context: mfxHDL

< The context of the memory interface. User should not touch (change, set, null) this pointer.

§Version: mfxStructVersion

< The version of the structure.

§reserved1: [mfxU16; 3]§AddRef: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1) -> mfxStatus>

@brief Increments the internal reference counter of the surface. The surface is not destroyed until the surface is released using the mfxFrameSurfaceInterface::Release function. mfxFrameSurfaceInterface::AddRef should be used each time a new link to the surface is created (for example, copy structure) for proper surface management.

@param[in] surface Valid surface.

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If surface is NULL. \n MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n MFX_ERR_UNKNOWN Any internal error.

§Release: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1) -> mfxStatus>

@brief Decrements the internal reference counter of the surface. mfxFrameSurfaceInterface::Release should be called after using the mfxFrameSurfaceInterface::AddRef function to add a surface or when allocation logic requires it. For example, call mfxFrameSurfaceInterface::Release to release a surface obtained with the GetSurfaceForXXX function.

@param[in] surface Valid surface.

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If surface is NULL. \n MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n MFX_ERR_UNDEFINED_BEHAVIOR If Reference Counter of surface is zero before call. \n MFX_ERR_UNKNOWN Any internal error.

§GetRefCounter: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, counter: *mut mfxU32) -> mfxStatus>

@brief Returns current reference counter of mfxFrameSurface1 structure.

@param[in] surface Valid surface. @param[out] counter Sets counter to the current reference counter value.

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If surface or counter is NULL. \n MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n MFX_ERR_UNKNOWN Any internal error.

§Map: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, flags: mfxU32) -> mfxStatus>

@brief Sets pointers of surface->Info.Data to actual pixel data, providing read-write access.

In case of video memory, the surface with data in video memory becomes mapped to system memory. An application can map a surface for read access with any value of mfxFrameSurface1::Data::Locked, but can map a surface for write access only when mfxFrameSurface1::Data::Locked equals to 0.

Note: A surface allows shared read access, but exclusive write access. Consider the following cases: @li Map with Write or Read|Write flags. A request during active another read or write access returns MFX_ERR_LOCK_MEMORY error immediately, without waiting. MFX_MAP_NOWAIT does not impact behavior. This type of request does not lead to any implicit synchronizations. @li Map with Read flag. A request during active write access will wait for resource to become free, or exits immediately with error if MFX_MAP_NOWAIT flag was set. This request may lead to the implicit synchronization (with same logic as Synchronize call) waiting for surface to become ready to use (all dependencies should be resolved and upstream components finished writing to this surface).

It is guaranteed that read access will be acquired right after synchronization without allowing another thread to acquire this surface for writing.

If MFX_MAP_NOWAIT was set and the surface is not ready yet (for example the surface has unresolved data dependencies or active processing), the read access request exits immediately with error.

Read-write access with MFX_MAP_READ_WRITE provides exclusive simultaneous reading and writing access.

@note Bitwise copying of mfxFrameSurface1 object between map / unmap calls may result in having dangling data pointers in copies.

@param[in] surface Valid surface. @param[out] flags Specify mapping mode. @param[out] surface->Info.Data Pointers set to actual pixel data.

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If surface is NULL. \n MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n MFX_ERR_UNSUPPORTED If flags are invalid. \n MFX_ERR_LOCK_MEMORY If user wants to map the surface for write and surface->Data.Locked does not equal to 0. \n MFX_ERR_UNKNOWN Any internal error.

§Unmap: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1) -> mfxStatus>

@brief Invalidates pointers of surface->Info.Data and sets them to NULL. In case of video memory, the underlying texture becomes unmapped after last reader or writer unmap.

@param[in] surface Valid surface. @param[out] surface->Info.Data Pointers set to NULL.

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If surface is NULL. \n MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n MFX_ERR_UNSUPPORTED If surface is already unmapped. \n MFX_ERR_UNKNOWN Any internal error.

§GetNativeHandle: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, resource: *mut mfxHDL, resource_type: *mut mfxResourceType) -> mfxStatus>

@brief Returns a native resource’s handle and type. The handle is returned as-is, meaning that the reference counter of base resources is not incremented. The native resource is not detached from surface and the library still owns the resource. User must not destroy the native resource or assume that the resource will be alive after mfxFrameSurfaceInterface::Release.

@param[in] surface Valid surface. @param[out] resource Pointer is set to the native handle of the resource. @param[out] resource_type Type of native resource. See mfxResourceType enumeration).

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If any of surface, resource or resource_type is NULL. \n MFX_ERR_INVALID_HANDLE If any of surface, resource or resource_type is not valid object (no native resource was allocated). \n MFX_ERR_UNSUPPORTED If surface is in system memory. \n MFX_ERR_UNKNOWN Any internal error.

§GetDeviceHandle: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, device_handle: *mut mfxHDL, device_type: *mut mfxHandleType) -> mfxStatus>

@brief Returns a device abstraction that was used to create that resource. The handle is returned as-is, meaning that the reference counter for the device abstraction is not incremented. The native resource is not detached from the surface and the library still has a reference to the resource. User must not destroy the device or assume that the device will be alive after mfxFrameSurfaceInterface::Release.

@param[in] surface Valid surface. @param[out] device_handle Pointer is set to the device which created the resource @param[out] device_type Type of device (see mfxHandleType enumeration).

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If any of surface, device_handle or device_type is NULL. \n MFX_ERR_INVALID_HANDLE If any of surface, resource or resource_type is not valid object (no native resource was allocated). \n MFX_ERR_UNSUPPORTED If surface is in system memory. \n MFX_ERR_UNKNOWN Any internal error.

§Synchronize: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, wait: mfxU32) -> mfxStatus>

@brief Guarantees readiness of both the data (pixels) and any frame’s meta information (for example corruption flags) after a function completes.

Instead of MFXVideoCORE_SyncOperation, users may directly call the mfxFrameSurfaceInterface::Synchronize function after the corresponding Decode or VPP function calls (MFXVideoDECODE_DecodeFrameAsync or MFXVideoVPP_RunFrameVPPAsync). The prerequisites to call the functions are:

@li The main processing functions return MFX_ERR_NONE. @li A valid mfxFrameSurface1 object.

@param[in] surface Valid surface. @param[out] wait Wait time in milliseconds.

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If surface is NULL. \n MFX_ERR_INVALID_HANDLE If any of surface is not valid object . \n MFX_WRN_IN_EXECUTION If the given timeout is expired and the surface is not ready. \n MFX_ERR_ABORTED If the specified asynchronous function aborted due to data dependency on a previous asynchronous function that did not complete. \n MFX_ERR_UNKNOWN Any internal error.

§OnComplete: Option<unsafe extern "C" fn(sts: mfxStatus)>

@brief The library calls the function after complete of associated video operation notifying the application that frame surface is ready.

@attention This is callback function and intended to be called by the library only.

@note The library calls this callback only when this surface is used as the output surface.

It is expected that the function is low-intrusive designed otherwise it may impact performance.

@param[in] sts The status of completed operation.

§QueryInterface: Option<unsafe extern "C" fn(surface: *mut mfxFrameSurface1, guid: mfxGUID, iface: *mut mfxHDL) -> mfxStatus>

@brief Returns an interface defined by the GUID. If the returned interface is a reference counted object the caller should release the obtained interface to avoid memory leaks.

@param[in] surface Valid surface. @param[in] guid GUID of the requested interface. @param[out] iface Interface.

@return MFX_ERR_NONE If no error. \n MFX_ERR_NULL_PTR If interface or surface is NULL. \n MFX_ERR_UNSUPPORTED If requested interface is not supported. \n MFX_ERR_NOT_IMPLEMENTED If requested interface is not implemented. \n MFX_ERR_NOT_INITIALIZED If requested interface is not available (not created or already deleted). \n MFX_ERR_UNKNOWN Any internal error.

§reserved2: [mfxHDL; 2]

Trait Implementations§

Source§

impl Clone for mfxFrameSurfaceInterface

Source§

fn clone(&self) -> mfxFrameSurfaceInterface

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for mfxFrameSurfaceInterface

Source§

impl Default for mfxFrameSurfaceInterface

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.