AVSource支持自定义数据源NDK接口

Signed-off-by: wangyan <wangyan431@huawei.com>
This commit is contained in:
wangyan 2024-03-25 18:24:08 +08:00
parent 1d53a5e45d
commit deeb33a09c
No known key found for this signature in database
GPG Key ID: 9D5003D69B198947
2 changed files with 40 additions and 0 deletions

View File

@ -150,6 +150,37 @@ typedef struct OH_AVCodecCallback {
OH_AVCodecOnNewOutputBuffer onNewOutputBuffer;
} OH_AVCodecCallback;
/**
* @brief The function pointer will be called to get sequenced media data.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @param data The buffer to fill.
* @param length Length of data to read.
* @param offset Start offset to read.
* @return Actual length of data read to the buffer.
* @since 12
*/
typedef int32_t (*OH_AVDataSourceReadAt)(OH_AVBuffer *data, int32_t length, int64_t offset);
/**
* @brief User customized data source.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 12
*/
typedef struct OH_AVDataSource {
/**
* @brief Total size of the data source.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 12
*/
int64_t size;
/**
* @brief Data callback of the data source.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 12
*/
OH_AVDataSourceReadAt readAt;
} OH_AVDataSource;
/**
* @brief Enumerates the MIME types of audio and video codecs
* @syscap SystemCapability.Multimedia.Media.CodecBase

View File

@ -27,6 +27,15 @@ extern "C" {
typedef struct OH_AVSource OH_AVSource;
/**
* @brief Creates an OH_AVSource instance that models the media with data source.
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param dataSource User customized media resource.
* @return Returns a pointer to an OH_AVSource instance
* @since 12
*/
OH_AVSource *OH_AVSource_CreateWithDataSource(OH_AVDataSource *dataSource);
/**
* @brief Creates an OH_AVSource instance that models the media at the URI.
* @syscap SystemCapability.Multimedia.Media.Spliter