ohos-media-sys 0.1.0

Raw Bindings to the media framework on OpenHarmony
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(deprecated)]
#[allow(unused_imports)]
use crate::averrors::OH_AVErrCode;
#[allow(unused_imports)]
use crate::avimage_generator_base::OH_AVImageGenerator_QueryOptions;
use ohos_sys_opaque_types::OH_PixelmapNative;

/// Define OH_AVImageGenerator field.
///
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AVImageGenerator
///
/// Available since API-level: 18
#[cfg(feature = "api-18")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
#[repr(C)]
pub struct OH_AVImageGenerator {
    _unused: [u8; 0],
}
extern "C" {
    /// Create an image generator.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVImageGenerator
    ///
    /// # Returns
    ///
    /// * Returns a pointer to an OH_AVImageGenerator instance for success, nullptr for failure.
    /// Possible failure causes: HstEngineFactory failed to CreateAVMetadataHelperEngine.
    ///
    /// Available since API-level: 18
    #[cfg(feature = "api-18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
    pub fn OH_AVImageGenerator_Create() -> *mut OH_AVImageGenerator;
    /// Sets the media file descriptor source for the image generator.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVImageGenerator
    /// # Arguments
    ///
    /// * `generator` - Pointer to an OH_AVImageGenerator instance.
    ///
    /// * `fd` - Indicates the file descriptor of media source.
    ///
    /// * `offset` - Indicates the offset of media source in file descriptor.
    ///
    /// * `size` - Indicates the size of media source.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input generator is nullptr or input param is invalid.
    /// [`AV_ERR_OPERATE_NOT_PERMIT`] if operation not allowed.
    /// [`AV_ERR_NO_MEMORY`] if internal memory allocation failed.
    ///
    /// Available since API-level: 18
    #[cfg(feature = "api-18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
    pub fn OH_AVImageGenerator_SetFDSource(
        generator: *mut OH_AVImageGenerator,
        fd: i32,
        offset: i64,
        size: i64,
    ) -> OH_AVErrCode;
    /// Fetch an image at the specific time from a video resource.
    ///
    /// This function must be called after [`SetFDSource`].
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVImageGenerator
    /// # Arguments
    ///
    /// * `generator` - Pointer to an OH_AVImageGenerator instance.
    ///
    /// * `timeUs` - The time expected to fetch picture from the video resource. The unit is microsecond(us).
    ///
    /// * `options` - The time options about the relationship between the given timeUs and a key frame,
    /// see [`OH_AVImageGenerator_QueryOptions`].
    ///
    /// * `pixelMap` - The fetched output image from the video source. For details, see [`OH_PixelmapNative`].
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input generator is nullptr or input param is invalid.
    /// [`AV_ERR_OPERATE_NOT_PERMIT`] if operation not allowed.
    /// [`AV_ERR_UNSUPPORTED_FORMAT`] if format is unsupported.
    /// [`AV_ERR_NO_MEMORY`] if internal memory allocation failed.
    ///
    /// Available since API-level: 18
    #[cfg(feature = "api-18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
    pub fn OH_AVImageGenerator_FetchFrameByTime(
        generator: *mut OH_AVImageGenerator,
        timeUs: i64,
        options: OH_AVImageGenerator_QueryOptions,
        pixelMap: *mut *mut OH_PixelmapNative,
    ) -> OH_AVErrCode;
    /// Release the resource used for AVImageGenerator.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVImageGenerator
    /// # Arguments
    ///
    /// * `generator` - Pointer to an OH_AVImageGenerator instance.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input generator is nullptr or input param is invalid.
    ///
    /// Available since API-level: 18
    #[cfg(feature = "api-18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
    pub fn OH_AVImageGenerator_Release(generator: *mut OH_AVImageGenerator) -> OH_AVErrCode;
}