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::avbuffer_info::OH_AVCodecBufferAttr;
#[allow(unused_imports)]
use crate::avcodec_base::{OH_AVCodec, OH_AVCodecAsyncCallback};
#[allow(unused_imports)]
use crate::averrors::OH_AVErrCode;
#[allow(unused_imports)]
use crate::avformat::OH_AVFormat;

extern "C" {
    /// Creates an audio encoder instance from the mime type, this interface is recommended in most cases.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `mime` - mime type description string, refer to [`AVCODEC_MIME_TYPE`]
    ///
    /// # Returns
    ///
    /// * Returns a Pointer to an OH_AVCodec instance
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_CreateByMime
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_CreateByMime(mime: *const ::core::ffi::c_char) -> *mut OH_AVCodec;
    /// Create an audio encoder instance through the audio encoder name.
    /// The premise of using this interface is to know the exact name of the encoder.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `name` - Audio encoder name
    ///
    /// # Returns
    ///
    /// * Returns a Pointer to an OH_AVCodec instance
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_CreateByName
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_CreateByName(name: *const ::core::ffi::c_char) -> *mut OH_AVCodec;
    /// Clear the internal resources of the encoder and destroy the encoder instance
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_Destroy
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_Destroy(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Set the asynchronous callback function so that your application can respond to
    /// the events generated by the audio encoder. This interface must be called before Prepare is called.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `callback` - A collection of all callback functions, see [`OH_AVCodecAsyncCallback`]
    ///
    /// * `userData` - User specific data
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_RegisterCallback
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_SetCallback(
        codec: *mut OH_AVCodec,
        callback: OH_AVCodecAsyncCallback,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AVErrCode;
    /// To configure the audio encoder, typically, you need to configure the description information of
    /// the encoded audio track. This interface must be called before Prepare is called.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `format` - OH_AVFormat handle pointer
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_Configure
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_Configure(
        codec: *mut OH_AVCodec,
        format: *mut OH_AVFormat,
    ) -> OH_AVErrCode;
    /// To prepare the internal resources of the encoder,
    /// the Configure interface must be called before calling this interface.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_Prepare
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_Prepare(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Start the encoder, this interface must be called after the Prepare is successful.
    /// After being successfully started, the encoder will start reporting NeedInputData events.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_Start
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_Start(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Stop the encoder. After stopping, you can re-enter the Started state through Start.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_Stop
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_Stop(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Clear the input and output data buffered in the encoder. After this interface is called,
    /// all the Buffer indexes previously reported through the asynchronous callback will be invalidated,
    /// make sure not to access the Buffers corresponding to these indexes.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_Flush
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_Flush(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Reset the encoder. To continue coding, you need to call the Configure interface
    /// again to configure the encoder instance.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_Reset
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_Reset(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Get the description information of the output data of the encoder, refer to [`OH_AVFormat`] for details.
    /// 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 the caller.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription,
    /// or destroyed with OH_AVCodec;
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_GetOutputDescription
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_GetOutputDescription(codec: *mut OH_AVCodec) -> *mut OH_AVFormat;
    /// Set dynamic parameters to the encoder. Note: This interface can only be called after the encoder is started.
    /// At the same time, incorrect parameter settings may cause the encoding to fail.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `format` - OH_AVFormat handle pointer
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_SetParameter
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_SetParameter(
        codec: *mut OH_AVCodec,
        format: *mut OH_AVFormat,
    ) -> OH_AVErrCode;
    /// Submit the input buffer filled with data to the audio encoder. The [`OH_AVCodecOnNeedInputData`]
    /// callback will report the available input buffer and the corresponding index value. Once the buffer with the
    /// specified index is submitted to the audio encoder, the buffer cannot be accessed again until the
    /// callback is received again reporting that the buffer with the same index is available
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - Enter the index value corresponding to the Buffer
    ///
    /// * `attr` - Information describing the data contained in the Buffer
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_PushInputBuffer
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_PushInputData(
        codec: *mut OH_AVCodec,
        index: u32,
        attr: OH_AVCodecBufferAttr,
    ) -> OH_AVErrCode;
    /// Return the processed output Buffer to the encoder.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - The index value corresponding to the output Buffer
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_FreeOutputBuffer
    ///
    /// Available since API-level: 9
    ///
    /// Version: 1.0
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_FreeOutputData(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
    /// Check whether the current codec instance is valid. It can be used fault recovery or app
    /// switchback from the background
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `isValid` - Output Parameter. A pointer to a boolean instance, it is true if the codec instance is valid,
    /// false if the codec instance is invalid
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
    ///
    /// **Deprecated** since 11
    /// OH_AudioCodec_IsValid
    ///
    /// Available since API-level: 10
    #[deprecated(since = "11")]
    pub fn OH_AudioEncoder_IsValid(codec: *mut OH_AVCodec, isValid: *mut bool) -> OH_AVErrCode;
}