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::avformat::OH_AVFormat;
use ohos_sys_opaque_types::OH_PixelmapNative;

/// Define OH_AVMetadataExtractor field.
///
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AVMetadataExtractor
///
/// Available since API-level: 18
#[cfg(feature = "api-18")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
#[repr(C)]
pub struct OH_AVMetadataExtractor {
    _unused: [u8; 0],
}
extern "C" {
    /// Create a metadata extractor.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVMetadataExtractor
    ///
    /// # Returns
    ///
    /// * Returns a pointer to an OH_AVMetadataExtractor instance for success, nullptr for failure
    /// Possible failure causes: failed to HstEngineFactory::CreateAVMetadataHelperEngine.
    ///
    /// Available since API-level: 18
    #[cfg(feature = "api-18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
    pub fn OH_AVMetadataExtractor_Create() -> *mut OH_AVMetadataExtractor;
    /// Sets the media file descriptor source for the metadata extractor.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVMetadataExtractor
    /// # Arguments
    ///
    /// * `extractor` - Pointer to an OH_AVMetadataExtractor 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 extractor 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_AVMetadataExtractor_SetFDSource(
        extractor: *mut OH_AVMetadataExtractor,
        fd: i32,
        offset: i64,
        size: i64,
    ) -> OH_AVErrCode;
    /// Extract metadata info from the media source.
    /// This function must be called after [`SetFDSource`].
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVMetadataExtractor
    /// # Arguments
    ///
    /// * `extractor` - Pointer to an OH_AVMetadataExtractor instance.
    ///
    /// * `avMetadata` - Pointer to an [`OH_AVFormat`] instance, its content contains the fetched metadata info.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input extractor 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_AVMetadataExtractor_FetchMetadata(
        extractor: *mut OH_AVMetadataExtractor,
        avMetadata: *mut OH_AVFormat,
    ) -> OH_AVErrCode;
    /// Fetch album cover from the audio source.
    /// This function must be called after [`SetFDSource`].
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVMetadataExtractor
    /// # Arguments
    ///
    /// * `extractor` - Pointer to an OH_AVMetadataExtractor instance.
    ///
    /// * `pixelMap` - The fetched album cover from the audio source. For details, see [`OH_PixelmapNative`].
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input extractor 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_AVMetadataExtractor_FetchAlbumCover(
        extractor: *mut OH_AVMetadataExtractor,
        pixelMap: *mut *mut OH_PixelmapNative,
    ) -> OH_AVErrCode;
    /// Release the resource used for AVMetadataExtractor.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AVMetadataExtractor
    /// # Arguments
    ///
    /// * `extractor` - Pointer to an OH_AVMetadataExtractor instance.
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input extractor 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_AVMetadataExtractor_Release(extractor: *mut OH_AVMetadataExtractor) -> OH_AVErrCode;
}