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)]
use crate::avbuffer_info::OH_AVCodecBufferAttr;
#[allow(unused_imports)]
use crate::averrors::OH_AVErrCode;
use crate::avformat::OH_AVFormat;
use ohos_sys_opaque_types::OH_NativeBuffer;

/// Forward declaration of OH_AVBuffer.
///
///
/// Available since API-level: 11
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
#[repr(C)]
pub struct OH_AVBuffer {
    _unused: [u8; 0],
}
extern "C" {
    /// Create an OH_AVBuffer instance, It should be noted that the life cycle of the OH_AVBuffer instance pointed
    /// to by the return value * needs to be manually released by [`OH_AVBuffer_Destroy`].
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `capacity` - the buffer's capacity, bytes
    ///
    /// # Returns
    ///
    /// * Returns a pointer to an OH_AVBuffer instance if the execution is successful, otherwise returns nullptr.
    /// Possible failure causes: 1. capacity <= 0. 2. create allocator failed. 3. create OH_AVBuffer failed.
    /// 4. created buffer memory is nullptr. 5. created buffer memory's addr is nullptr. 6. failed to new OH_AVBuffer.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_Create(capacity: i32) -> *mut OH_AVBuffer;
    /// Clear the internal resources of the buffer and destroy the buffer instance.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input buffer is nullptr or buffer's magic error.
    /// [`AV_ERR_OPERATE_NOT_PERMIT`] if input buffer is not user created.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_Destroy(buffer: *mut OH_AVBuffer) -> OH_AVErrCode;
    /// Get the buffer's attribute.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// * `attr` - Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to
    /// [`OH_AVCodecBufferAttr`]
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input buffer is nullptr, buffer's magic error,
    /// input buffer's buffer is nulllptr or attr is nullptr.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_GetBufferAttr(
        buffer: *mut OH_AVBuffer,
        attr: *mut OH_AVCodecBufferAttr,
    ) -> OH_AVErrCode;
    /// Set the buffer's attribute.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// * `attr` - Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to
    /// [`OH_AVCodecBufferAttr`]
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input buffer is nullptr, buffer's magic error,
    /// input buffer's buffer is nulllptr, attr is nullptr, the size or offset of input buffer's memory is invalid.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_SetBufferAttr(
        buffer: *mut OH_AVBuffer,
        attr: *const OH_AVCodecBufferAttr,
    ) -> OH_AVErrCode;
    /// Get the buffer's parameter. It should be noted that the life cycle of the OH_AVFormat instance pointed to
    /// by the return value * needs to be manually released by [`OH_AVFormat_Destroy`].
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// # Returns
    ///
    /// * Returns Encapsulate OH_AVFormat structure instance pointer if the execution is successful,
    /// otherwise returns nullptr. Possible failure causes: 1. input buffer is nullptr. 2. buffer's magic error.
    /// 3. input buffer's buffer is nulllptr. 4. buffer's meta is nullptr.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_GetParameter(buffer: *mut OH_AVBuffer) -> *mut OH_AVFormat;
    /// Set the buffer's parameter.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// * `format` - Encapsulate OH_AVFormat structure instance pointer
    ///
    /// # Returns
    ///
    /// * Function result code.
    /// [`AV_ERR_OK`] if the execution is successful.
    /// [`AV_ERR_INVALID_VAL`] if input buffer is nullptr, buffer's magic error,
    /// input buffer's buffer is nulllptr, input format is nullptr or input meta is nullptr.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_SetParameter(
        buffer: *mut OH_AVBuffer,
        format: *const OH_AVFormat,
    ) -> OH_AVErrCode;
    /// Get the buffer's virtual address.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// # Returns
    ///
    /// * the buffer's virtual address if the buffer is valid, otherwise nullptr
    /// Possible failure causes: 1. input buffer is nullptr. 2. buffer's magic error.
    /// 3. input buffer's buffer is nulllptr. 4. buffer's memory is nullptr.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_GetAddr(buffer: *mut OH_AVBuffer) -> *mut u8;
    /// Get the buffer's capacity
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// # Returns
    ///
    /// * the buffer's capacity if the buffer is valid, otherwise -1
    /// Possible failure causes: 1. input buffer is nullptr. 2. buffer's magic error.
    /// 3. input buffer's buffer is nulllptr. 4. buffer's memory is nullptr.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_GetCapacity(buffer: *mut OH_AVBuffer) -> i32;
    /// Get the OH_NativeBuffer instance pointer,It should be noted that the life cycle of the OH_AVBuffer
    /// instance pointed to by the return value * needs to be manually released by [`OH_NativeBuffer_Unreference`].
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.Core
    /// # Arguments
    ///
    /// * `buffer` - Encapsulate OH_AVBuffer structure instance pointer
    ///
    /// # Returns
    ///
    /// * Returns Encapsulate OH_NativeBuffer structure instance pointer is successful, otherwise returns nullptr
    /// Possible failure causes: 1. input buffer is nullptr. 2. buffer's magic error.
    /// 3. input buffer's buffer is nulllptr. 4. buffer's memory is nullptr. 5. surfaceBuffer is nullptr.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_AVBuffer_GetNativeBuffer(buffer: *mut OH_AVBuffer) -> *mut OH_NativeBuffer;
}