Merge branch 'master' of gitee.com:openharmony/interface_sdk_c into master

Signed-off-by: 003 <zhanglitao11@huawei.com>
This commit is contained in:
003 2024-01-03 12:52:31 +00:00 committed by Gitee
commit e0b6c1e274
50 changed files with 2689 additions and 455 deletions

View File

@ -145,5 +145,6 @@
{"name": "napi_async_destroy"},
{"name": "napi_open_callback_scope"},
{"name": "napi_close_callback_scope"},
{"name": "node_api_get_module_file_name"}
{"name": "node_api_get_module_file_name"},
{"name": "napi_coerce_to_native_binding_object"}
]

View File

@ -79,6 +79,9 @@ NAPI_INNER_EXTERN napi_status napi_adjust_external_memory(napi_env env,
extern "C" {
#endif
typedef void* (*napi_native_binding_detach_callback)(napi_env env, void* native_object, void* hint);
typedef napi_value (*napi_native_binding_attach_callback)(napi_env env, void* native_object, void* hint);
NAPI_EXTERN napi_status napi_run_script_path(napi_env env, const char* path, napi_value* result);
NAPI_EXTERN napi_status napi_queue_async_work_with_qos(napi_env env, napi_async_work work, napi_qos_t qos);
NAPI_EXTERN napi_status napi_load_module(napi_env env, const char* path, napi_value* result);
@ -119,6 +122,12 @@ NAPI_EXTERN napi_status napi_create_object_with_named_properties(napi_env env,
size_t property_count,
const char** keys,
const napi_value* values);
NAPI_EXTERN napi_status napi_coerce_to_native_binding_object(napi_env env,
napi_value js_object,
napi_native_binding_detach_callback detach_cb,
napi_native_binding_attach_callback attach_cb,
void* native_object,
void* hint);
#ifdef __cplusplus
}

View File

@ -14,12 +14,17 @@
# limitations under the License.
import re
import os
import subprocess
from typedef.check.check import ApiResultInfo, ErrorMessage, ErrorType, LogType, ErrorLevel
def check_syntax(file_path):
cmd_list = ['clang', r'-I sysroot\ndk_musl_include_files', '-std=c99']
cmd_list = ['clang']
if os.path.exists(r'.\sysroot'):
args = ['-I{}'.format(dir_path) for dir_path, _, _ in os.walk(r'.\sysroot')]
cmd_list.extend(args)
cmd_list.append('-std=c99')
result_list = []
command = cmd_list + [file_path]
run_result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

View File

@ -71,59 +71,6 @@ def processing_no_child(cursor, data): # 处理没有子节点的节点
data["integer_value"] = token.spelling # 获取整型变量值
def get_complex_def(tokens_new, count_token, tokens, data):
count = 1
logo = 0
logo_com = 0
count_com = 0
for token_2 in tokens_new:
if token_2.spelling == ')':
break
else:
count += 1
if count != count_token:
for token in tokens_new[count:]:
if token.spelling == '{' or token.spelling == '(' or token.spelling == '##':
logo = 1
if count_token == count:
pass
elif logo == 1: # 获取复合型宏定义宏名
logo_com = logo
count_com = count + 1
tokens_name = tokens[:count + 1]
data["name"] = ''.join([token.spelling for token in tokens_name])
return logo_com, count_com
def processing_complex_def(tokens, data): # 处理复合型宏
tokens_new = tokens[1:] # 跳过正常宏名
logo_com = 0 # 记录复合型,复合型文本也得根据这个
count_com = 0
count_token = len(tokens_new) # value ()
for token in tokens_new:
if token.kind.name == 'KEYWORD':
break
if token.kind.name == 'IDENTIFIER':
logo_com, count_com = get_complex_def(tokens_new, count_token, tokens, data)
get_def_text(tokens, data, logo_com, count_com) # 获取宏文本
def get_def_text(tokens, data, logo_compose, count_compose): # 获取宏文本
if logo_compose == 1:
marco_expansion = ''.join([token.spelling for token in tokens[count_compose:]]) # 获取宏文本,有就记录,没有不管
if marco_expansion:
data["text"] = marco_expansion
else:
pass
else:
marco_expansion = ''.join([token.spelling for token in tokens[1:]]) # 获取宏文本,有就记录,没有不管
if marco_expansion:
data["text"] = marco_expansion
else:
pass
def get_token(cursor):
tokens = []
for token in cursor.get_tokens():
@ -187,38 +134,29 @@ def processing_enum(cursor, data): # 获取枚举值
def processing_def(cursor, data): # 处理宏定义
if data['node_content']['content']:
split_data = data['node_content']['content'].split()
split_data_three = data['node_content']['content'].split('\t')
if len(split_data) == 2:
pattern = r'\((.*?), (.*?)\)'
if re.search(pattern, data['node_content']['content']):
data['name'] = data['node_content']['content']
else:
data['name'] = split_data[0]
data['text'] = split_data[1]
elif len(split_data_three) == 2:
data['name'] = split_data_three[0]
data['text'] = split_data_three[1]
else:
marco_ext = cursor.extent
tokens = cursor.translation_unit.get_tokens(extent=marco_ext) # 找到对应的宏定义位置
tokens = list(tokens) # Generator转为list
processing_complex_def(tokens, data) # 获取宏名和宏文本
else:
print('mar_define error, its content is none')
data["type"] = "def_no_type"
judgment_def_func(data)
def judgment_def_func(data):
data['is_def_func'] = False
if '(' in data['name'] and ')' in data['name']:
data['is_def_func'] = True
index = data['name'].index('(')
data['def_func_name'] = data['name'][:index]
data['def_func_param'] = data['name'][index:]
data['name'] = cursor.spelling
name_len = len(data['name'])
str1_len = len(data['node_content']['content'])
text = ''
if name_len != str1_len:
if data['node_content']['content']:
if data['node_content']['content'][name_len] == '(':
right_index = data['node_content']['content'].index(')')
param = data['node_content']['content'][name_len:right_index + 1]
text = data['node_content']['content'][right_index + 1:]
data['is_def_func'] = True
data['def_func_name'] = data['name']
data['def_func_param'] = param
data['name'] = ''.join(data['name'] + param)
else:
text = data['node_content']['content'][name_len:]
else:
print('mar_define error, its content is none')
if text:
text = text.strip() # 删除两边的字符(默认是删除左右空格)
data['text'] = text
data["type"] = "def_no_type"
def processing_func(cursor, data): # 处理函数

View File

@ -264,8 +264,12 @@ def copy_self_include(link_include_path, self_include_file, flag=-1):
if std_include and not os.path.exists(std_include):
shutil.copytree(self_include_file, std_include)
for dir_path, _, _ in os.walk(std_include):
link_include_path.append(dir_path)
for dir_path, _, files in os.walk(std_include):
for file in files:
if not file.endswith('.h'):
os.remove(os.path.join(dir_path, file))
elif dir_path not in link_include_path:
link_include_path.append(dir_path)
def delete_typedef_child(child):
@ -295,6 +299,7 @@ def parser_include_ast(gn_file_path, include_path, flag=-1): # 对于单
link_include_path = []
copy_std_lib(link_include_path)
find_include(link_include_path)
link_include(gn_file_path, StringConstant.FUNK_NAME.value, link_include_path)
copy_self_include(link_include_path, gn_file_path, flag)
modes = stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU

View File

@ -223,7 +223,7 @@ bool OH_ResourceManager_ReleaseRawFileDescriptor(const RawFileDescriptor &descri
* @since 11
* @version 1.0
*/
int64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, size_t length);
int64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, int64_t length);
/**
* @brief Uses the 64-bit data type to seek a data read position based on the specified offset within a raw file.
@ -239,7 +239,7 @@ int64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, si
* @since 11
* @version 1.0
*/
int OH_ResourceManager_SeekRawFile64(const RawFile64 *rawFile, long offset, int whence);
int OH_ResourceManager_SeekRawFile64(const RawFile64 *rawFile, int64_t offset, int whence);
/**
* @brief Obtains the raw file length represented by an int64_t.

View File

@ -82,6 +82,30 @@ typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle;
*/
typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate;
/**
* @brief Defines an <b>OH_Drawing_TextBox</b>, which is used to create an <b>OH_Drawing_TextBox</b> object.
*
* @since 11
* @version 1.0
*/
typedef struct OH_Drawing_TextBox OH_Drawing_TextBox;
/**
* @brief Defines an <b>OH_Drawing_PositionAndAffinity</b>,
* which is used to create an <b>OH_Drawing_PositionAndAffinity</b> object.
* @since 11
* @version 1.0
*/
typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity;
/**
* @brief Defines an <b>OH_Drawing_Range</b>, which is used to create an <b>OH_Drawing_Range</b> object.
*
* @since 11
* @version 1.0
*/
typedef struct OH_Drawing_Range OH_Drawing_Range;
#ifdef __cplusplus
}
#endif

View File

@ -148,6 +148,144 @@ enum OH_Drawing_FontStyle {
FONT_STYLE_ITALIC,
};
/**
* @brief Enumerates placeholder vertical alignment.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Offset At Baseline */
ALIGNMENT_OFFSET_AT_BASELINE,
/** Above Baseline */
ALIGNMENT_ABOVE_BASELINE,
/** Below Baseline */
ALIGNMENT_BELOW_BASELINE,
/** Top of Row Box */
ALIGNMENT_TOP_OF_ROW_BOX,
/** Bottom of Row Box */
ALIGNMENT_BOTTOM_OF_ROW_BOX,
/** Center of Row Box */
ALIGNMENT_CENTER_OF_ROW_BOX,
} OH_Drawing_PlaceholderVerticalAlignment;
/**
* @brief Defines the placeholder span.
*
* @since 11
* @version 1.0
*/
typedef struct {
/** width of placeholder */
double width;
/** height of placeholder */
double height;
/** alignment of placeholder */
OH_Drawing_PlaceholderVerticalAlignment alignment;
/** baseline of placeholder */
OH_Drawing_TextBaseline baseline;
/** baselineoffset of placeholder */
double baselineOffset;
} OH_Drawing_PlaceholderSpan;
/**
* @brief Enumerates text decoration style.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Solid style */
TEXT_DECORATION_STYLE_SOLID,
/** Double style */
TEXT_DECORATION_STYLE_DOUBLE,
/** Dotted style */
TEXT_DECORATION_STYLE_DOTTED,
/** Dashed style */
TEXT_DECORATION_STYLE_DASHED,
/** Wavy style */
TEXT_DECORATION_STYLE_WAVY,
} OH_Drawing_TextDecorationStyle;
/**
* @brief Enumerates ellipsis modal.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Head modal */
ELLIPSIS_MODAL_HEAD = 0,
/** Middle modal */
ELLIPSIS_MODAL_MIDDLE = 1,
/** Tail modal */
ELLIPSIS_MODAL_TAIL = 2,
} OH_Drawing_EllipsisModal;
/**
* @brief Enumerates break strategy.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Greedy strategy */
BREAK_STRATEGY_GREEDY = 0,
/** Quality strategy */
BREAK_STRATEGY_HIGH_QUALITY = 1,
/** Balanced strategy */
BREAK_STRATEGY_BALANCED = 2,
} OH_Drawing_BreakStrategy;
/**
* @brief Enumerates word break type.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Normal type */
WORD_BREAK_TYPE_NORMAL = 0,
/** Break All type */
WORD_BREAK_TYPE_BREAK_ALL = 1,
/** Break Word type */
WORD_BREAK_TYPE_BREAK_WORD = 2,
} OH_Drawing_WordBreakType;
/**
* @brief Enumerates rect height style.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Tight style */
RECT_HEIGHT_STYLE_TIGHT,
/** Max style */
RECT_HEIGHT_STYLE_MAX,
/** Includelinespacemiddle style */
RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE,
/** Includelinespacetop style */
RECT_HEIGHT_STYLE_INCLUDELINESPACETOP,
/** Includelinespacebottom style */
RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM,
/** Struct style */
RECT_HEIGHT_STYLE_STRUCT,
} OH_Drawing_RectHeightStyle;
/**
* @brief Enumerates rect Width style.
*
* @since 11
* @version 1.0
*/
typedef enum {
/** Tight style */
RECT_WIDTH_STYLE_TIGHT,
/** Max style */
RECT_WIDTH_STYLE_MAX,
} OH_Drawing_RectWidthStyle;
/**
* @brief Creates an <b>OH_Drawing_TypographyStyle</b> object.
*
@ -511,6 +649,358 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*);
*/
double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*);
/**
* @brief Sets the placeholder.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TypographyCreate Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
* @param OH_Drawing_PlaceholderSpan Indicates the pointer to an <b>OH_Drawing_PlaceholderSpan</b> object.
* @since 11
* @version 1.0
*/
void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*);
/**
* @brief Gets the exceed maxLines.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @return Returns the exceed maxLines.
* @since 11
* @version 1.0
*/
bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*);
/**
* @brief Gets the rects for range.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @param size_t Indicates the start of range to set.
* @param size_t Indicates the end of range to set.
* @param OH_Drawing_RectHeightStyle Indicates the height style to set.
* For details, see the enum <b>OH_Drawing_RectHeightStyle</b>.
* @param OH_Drawing_RectWidthStyle Indicates the width style to set.
* For details, see the enum <b>OH_Drawing_RectWidthStyle</b>.
* @return Returns the rects for range.
* @since 11
* @version 1.0
*/
OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography*,
size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle);
/**
* @brief Gets the rects for placeholders.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @return Returns the rects for placeholders.
* @since 11
* @version 1.0
*/
OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*);
/**
* @brief Gets left from textbox.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextBox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object.
* @param int Indicates the index of textbox.
* @return Returns left from textbox.
* @since 11
* @version 1.0
*/
float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int);
/**
* @brief Gets right from textbox.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextBox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object.
* @param int Indicates the index of textbox.
* @return Returns right from textbox.
* @since 11
* @version 1.0
*/
float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int);
/**
* @brief Gets top from textbox.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextBox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object.
* @param int Indicates the index of textbox.
* @return Returns top from textbox.
* @since 11
* @version 1.0
*/
float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int);
/**
* @brief Gets bottom from textbox.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextBox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object.
* @param int Indicates the index of textbox.
* @return Returns bottom from textbox.
* @since 11
* @version 1.0
*/
float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int);
/**
* @brief Gets direction from textbox.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextBox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object.
* @param int Indicates the index of textbox.
* @return Returns direction from textbox.
* @since 11
* @version 1.0
*/
int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int);
/**
* @brief Gets size of textbox.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextBox Indicates the pointer to an <b>OH_Drawing_TextBox</b> object.
* @return Returns size of textbox.
* @since 11
* @version 1.0
*/
size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*);
/**
* @brief Gets the glyphposition at coordinate.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @param double Indicates the positionX of typography to set.
* @param double Indicates the positionY of typography to set.
* @return Returns the glyphposition at coordinate.
* @since 11
* @version 1.0
*/
OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*,
double, double);
/**
* @brief Gets the glyphposition at coordinate with cluster.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @param double Indicates the positionX of typography to set.
* @param double Indicates the positionY of typography to set.
* @return Returns the glyphposition at coordinate with cluster.
* @since 11
* @version 1.0
*/
OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*,
double, double);
/**
* @brief Gets position from position and affinity.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_PositionAndAffinity Indicates the pointer to an <b>OH_Drawing_PositionAndAffinity</b> object.
* @return Returns position from position and affinity.
* @since 11
* @version 1.0
*/
size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*);
/**
* @brief Gets affinity from position and affinity.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_PositionAndAffinity Indicates the pointer to an <b>OH_Drawing_PositionAndAffinity</b> object.
* @return Returns affinity from position and affinity.
* @since 11
* @version 1.0
*/
int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*);
/**
* @brief Gets the word boundary.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @param size_t Indicates the size of text to set.
* @return Returns the word boundary.
* @since 11
* @version 1.0
*/
OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t);
/**
* @brief Gets start from range.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Range Indicates the pointer to an <b>OH_Drawing_Range</b> object.
* @return Returns start from range.
* @since 11
* @version 1.0
*/
size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*);
/**
* @brief Gets end from range.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Range Indicates the pointer to an <b>OH_Drawing_Range</b> object.
* @return Returns end from range.
* @since 11
* @version 1.0
*/
size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*);
/**
* @brief Gets the line count.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @return Returns the line count.
* @since 11
* @version 1.0
*/
size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*);
/**
* @brief Sets the decoration style.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object.
* @param int Indicates the text decoration style to set.
* For details, see the enum <b>OH_Drawing_TextDecorationStyle</b>.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int);
/**
* @brief Sets the decoration thickness scale.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object.
* @param double Indicates the thickness scale of text decoration to set.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double);
/**
* @brief Sets the letter spacing.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object.
* @param double Indicates the letter space to set.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double);
/**
* @brief Sets the word spacing.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object.
* @param double Indicates the word space to set.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double);
/**
* @brief Sets the half leading.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object.
* @param bool Indicates the half leading to set.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool);
/**
* @brief Sets the ellipsis.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object.
* @param char* Indicates the pointer to ellipsis style.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*);
/**
* @brief Sets the ellipsis modal.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TextStyle Indicates the pointer to an <b>OH_Drawing_TextStyle</b> object.
* @param int Indicates the ellipsis model to set. For details, see the enum <b>OH_Drawing_EllipsisModal</b>.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int);
/**
* @brief Sets the break strategy.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TypographyStyle Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object.
* @param int Indicates the break strategy to set. For details, see the enum <b>OH_Drawing_BreakStrategy</b>.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int);
/**
* @brief Sets the word break type.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TypographyStyle Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object.
* @param int Indicates the word break type to set. For details, see the enum <b>OH_Drawing_WordBreakType</b>.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int);
/**
* @brief Sets the ellipsis modal.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TypographyStyle Indicates the pointer to an <b>OH_Drawing_TypographyStyle</b> object.
* @param int Indicates the ellipsis modal to set. For details, see the enum <b>OH_Drawing_EllipsisModal</b>.
* @since 11
* @version 1.0
*/
void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int);
/**
* @brief get line height.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @param int Indicates the line number.
* @return Returns line height.
* @since 11
* @version 1.0
*/
double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int);
/**
* @brief get line width.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Typography Indicates the pointer to an <b>OH_Drawing_Typography</b> object.
* @param int Indicates the line number.
* @return Returns line width.
* @since 11
* @version 1.0
*/
double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int);
#ifdef __cplusplus
}
#endif

View File

@ -144,6 +144,132 @@
{ "name": "OH_Drawing_TypographyGetMaxIntrinsicWidth" },
{ "name": "OH_Drawing_TypographyGetAlphabeticBaseline" },
{ "name": "OH_Drawing_TypographyGetIdeographicBaseline" },
{ "name": "OH_Drawing_RegisterFont" },
{ "name": "OH_Drawing_RegisterFontBuffer" }
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyHandlerAddPlaceholder"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyDidExceedMaxLines"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetRectsForRange"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetRectsForPlaceholders"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetLeftFromTextBox"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetRightFromTextBox"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetTopFromTextBox"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetBottomFromTextBox"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetTextDirectionFromTextBox"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetSizeOfTextBox"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinate"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetPositionFromPositionAndAffinity"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetAffinityFromPositionAndAffinity"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetWordBoundary"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetStartFromRange"
},
{
"first_introduced": "11",
"name": "OH_Drawing_GetEndFromRange"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetLineCount"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTextStyleDecorationStyle"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTextStyleDecorationThicknessScale"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTextStyleLetterSpacing"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTextStyleWordSpacing"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTextStyleHalfLeading"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTextStyleEllipsis"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTextStyleEllipsisModal"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTypographyTextBreakStrategy"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTypographyTextWordBreakType"
},
{
"first_introduced": "11",
"name": "OH_Drawing_SetTypographyTextEllipsisModal"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetLineHeight"
},
{
"first_introduced": "11",
"name": "OH_Drawing_TypographyGetLineWidth"
},
{
"first_introduced": "11",
"name": "OH_Drawing_RegisterFont"
},
{
"first_introduced": "11",
"name": "OH_Drawing_RegisterFontBuffer"
}
]

View File

@ -549,6 +549,34 @@ typedef struct OH_AudioCapturer_Callbacks_Struct {
void* userData,
OH_AudioStream_Result error);
} OH_AudioCapturer_Callbacks;
/**
* @brief Defines reason for device changes of one audio stream.
*
* @since 11
*/
typedef enum {
/* Unknown. */
REASON_UNKNOWN = 0,
/* New Device available. */
REASON_NEW_DEVICE_AVAILABLE = 1,
/* Old Device unavailable. Applications should consider to pause the audio playback when this reason is
reported. */
REASON_OLD_DEVICE_UNAVAILABLE = 2,
/* Device is overrode by user or system. */
REASON_OVERRODE = 3,
} OH_AudioStream_DeviceChangeReason;
/**
* @brief Callback when the output device of an audio renderer changed.
*
* @param renderer AudioRenderer where this event occurs.
* @param userData User data which is passed by user.
* @param reason Indicates that why does the output device changes.
* @since 11
*/
typedef void (*OH_AudioRenderer_OutputDeviceChangeCallback)(OH_AudioRenderer* renderer, void* userData,
OH_AudioStream_DeviceChangeReason reason);
#ifdef __cplusplus
}
#endif

View File

@ -164,6 +164,18 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInfo(OH_AudioStreamBuilde
OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererCallback(OH_AudioStreamBuilder* builder,
OH_AudioRenderer_Callbacks callbacks, void* userData);
/**
* @brief Set the callback when the output device of an audio renderer changed.
*
* @param builder Reference provided by OH_AudioStreamBuilder_Create()
* @param callback Callback to the function that will process this device change event.
* @param userData Pointer to an application data structure that will be passed to the callback functions.
* @return {@link #AUDIOSTREAM_SUCCESS} or an undesired error.
* @since 11
*/
OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback(OH_AudioStreamBuilder* builder,
OH_AudioRenderer_OutputDeviceChangeCallback callback, void* userData);
/*
* Set the callbacks for the capturer client
*

View File

@ -39,6 +39,10 @@
"first_introduced": "10",
"name": "OH_AudioStreamBuilder_SetRendererCallback"
},
{
"first_introduced": "11",
"name": "OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback"
},
{
"first_introduced": "10",
"name": "OH_AudioStreamBuilder_SetCapturerCallback"

View File

@ -0,0 +1,31 @@
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_acodec_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources = [ "../native_avcodec_audiocodec.h" ]
}
ohos_ndk_library("libnative_media_acodec") {
ndk_description_file = "./libnative_media_acodec.ndk.json"
min_compact_version = "1"
output_name = "native_media_acodec"
output_extension = "so"
system_capability = "SystemCapability.Multimedia.Media.AudioCodec"
system_capability_headers =
[ "multimedia/player_framework/native_avcodec_audiocodec.h" ]
}

View File

@ -0,0 +1,62 @@
[
{
"first_introduced": "11",
"name": "OH_AudioCodec_CreateByMime"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_CreateByName"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_Destroy"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_RegisterCallback"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_Configure"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_Prepare"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_Start"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_Stop"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_Flush"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_Reset"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_GetOutputDescription"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_SetParameter"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_PushInputBuffer"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_FreeOutputBuffer"
},
{
"first_introduced": "11",
"name": "OH_AudioCodec_IsValid"
}
]

View File

@ -15,8 +15,7 @@ import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_adec_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources =
[ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audiodecoder.h" ]
sources = [ "../native_avcodec_audiodecoder.h" ]
}
ohos_ndk_library("libnative_media_adec") {

View File

@ -1,17 +1,62 @@
[
{ "name": "OH_AudioDecoder_CreateByMime" },
{ "name": "OH_AudioDecoder_CreateByName" },
{ "name": "OH_AudioDecoder_Destroy" },
{ "name": "OH_AudioDecoder_SetCallback" },
{ "name": "OH_AudioDecoder_Configure" },
{ "name": "OH_AudioDecoder_Prepare" },
{ "name": "OH_AudioDecoder_Start" },
{ "name": "OH_AudioDecoder_Stop" },
{ "name": "OH_AudioDecoder_Flush" },
{ "name": "OH_AudioDecoder_Reset" },
{ "name": "OH_AudioDecoder_GetOutputDescription" },
{ "name": "OH_AudioDecoder_SetParameter" },
{ "name": "OH_AudioDecoder_PushInputData" },
{ "name": "OH_AudioDecoder_FreeOutputData" },
{ "name": "OH_AudioDecoder_IsValid" }
{
"first_introduced": "9",
"name": "OH_AudioDecoder_CreateByMime"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_CreateByName"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_Destroy"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_SetCallback"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_Configure"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_Prepare"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_Start"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_Stop"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_Flush"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_Reset"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_GetOutputDescription"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_SetParameter"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_PushInputData"
},
{
"first_introduced": "9",
"name": "OH_AudioDecoder_FreeOutputData"
},
{
"first_introduced": "10",
"name": "OH_AudioDecoder_IsValid"
}
]

View File

@ -15,8 +15,7 @@ import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_aenc_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources =
[ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audioencoder.h" ]
sources = [ "../native_avcodec_audioencoder.h" ]
}
ohos_ndk_library("libnative_media_aenc") {

View File

@ -1,17 +1,62 @@
[
{ "name": "OH_AudioEncoder_CreateByMime" },
{ "name": "OH_AudioEncoder_CreateByName" },
{ "name": "OH_AudioEncoder_Destroy" },
{ "name": "OH_AudioEncoder_SetCallback" },
{ "name": "OH_AudioEncoder_Configure" },
{ "name": "OH_AudioEncoder_Prepare" },
{ "name": "OH_AudioEncoder_Start" },
{ "name": "OH_AudioEncoder_Stop" },
{ "name": "OH_AudioEncoder_Flush" },
{ "name": "OH_AudioEncoder_Reset" },
{ "name": "OH_AudioEncoder_GetOutputDescription" },
{ "name": "OH_AudioEncoder_SetParameter" },
{ "name": "OH_AudioEncoder_PushInputData" },
{ "name": "OH_AudioEncoder_FreeOutputData" },
{ "name": "OH_AudioEncoder_IsValid" }
{
"first_introduced": "9",
"name": "OH_AudioEncoder_CreateByMime"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_CreateByName"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_Destroy"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_SetCallback"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_Configure"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_Prepare"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_Start"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_Stop"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_Flush"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_Reset"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_GetOutputDescription"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_SetParameter"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_PushInputData"
},
{
"first_introduced": "9",
"name": "OH_AudioEncoder_FreeOutputData"
},
{
"first_introduced": "10",
"name": "OH_AudioEncoder_IsValid"
}
]

View File

@ -24,6 +24,8 @@ extern "C" {
* @brief Audio Channel Set
* A 64-bit integer with bits set for each channel.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @deprecated since 11
* @useinstead OH_AudioChannelSet
* @since 10
*/
enum AudioChannelSet : uint64_t {
@ -91,6 +93,8 @@ enum AudioChannelSet : uint64_t {
* Indicates that the channel order in which the user requests decoder output
* is the native codec channel order.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @deprecated since 11
* @useinstead OH_AudioChannelLayout
* @since 10
*/
enum AudioChannelLayout : uint64_t {

View File

@ -15,7 +15,7 @@ import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_avdemuxer_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources = [ "//interface/sdk_c/multimedia/av_codec/native_avdemuxer.h" ]
sources = [ "../native_avdemuxer.h" ]
}
ohos_ndk_library("libnative_media_avdemuxer") {

View File

@ -1,8 +1,30 @@
[
{ "name": "OH_AVDemuxer_CreateWithSource" },
{ "name": "OH_AVDemuxer_Destroy" },
{ "name": "OH_AVDemuxer_SelectTrackByID" },
{ "name": "OH_AVDemuxer_UnselectTrackByID" },
{ "name": "OH_AVDemuxer_ReadSample" },
{ "name": "OH_AVDemuxer_SeekToTime" }
{
"first_introduced": "10",
"name": "OH_AVDemuxer_CreateWithSource"
},
{
"first_introduced": "10",
"name": "OH_AVDemuxer_Destroy"
},
{
"first_introduced": "10",
"name": "OH_AVDemuxer_SelectTrackByID"
},
{
"first_introduced": "10",
"name": "OH_AVDemuxer_UnselectTrackByID"
},
{
"first_introduced": "10",
"name": "OH_AVDemuxer_ReadSample"
},
{
"first_introduced": "10",
"name": "OH_AVDemuxer_SeekToTime"
},
{
"first_introduced": "11",
"name": "OH_AVDemuxer_ReadSampleBuffer"
}
]

View File

@ -15,7 +15,7 @@ import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_avmuxer_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources = [ "//interface/sdk_c/multimedia/av_codec/native_avmuxer.h" ]
sources = [ "../native_avmuxer.h" ]
}
ohos_ndk_library("libnative_media_avmuxer") {

View File

@ -1,9 +1,34 @@
[
{ "name": "OH_AVMuxer_Create" },
{ "name": "OH_AVMuxer_SetRotation" },
{ "name": "OH_AVMuxer_AddTrack" },
{ "name": "OH_AVMuxer_Start" },
{ "name": "OH_AVMuxer_WriteSample" },
{ "name": "OH_AVMuxer_Stop" },
{ "name": "OH_AVMuxer_Destroy" }
{
"first_introduced": "10",
"name": "OH_AVMuxer_Create"
},
{
"first_introduced": "10",
"name": "OH_AVMuxer_SetRotation"
},
{
"first_introduced": "10",
"name": "OH_AVMuxer_AddTrack"
},
{
"first_introduced": "10",
"name": "OH_AVMuxer_Start"
},
{
"first_introduced": "10",
"name": "OH_AVMuxer_WriteSample"
},
{
"first_introduced": "10",
"name": "OH_AVMuxer_Stop"
},
{
"first_introduced": "10",
"name": "OH_AVMuxer_Destroy"
},
{
"first_introduced": "11",
"name": "OH_AVMuxer_WriteSampleBuffer"
}
]

View File

@ -15,7 +15,7 @@ import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_avsource_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources = [ "//interface/sdk_c/multimedia/av_codec/native_avsource.h" ]
sources = [ "../native_avsource.h" ]
}
ohos_ndk_library("libnative_media_avsource") {

View File

@ -1,7 +1,22 @@
[
{ "name": "OH_AVSource_CreateWithURI" },
{ "name": "OH_AVSource_CreateWithFD" },
{ "name": "OH_AVSource_Destroy" },
{ "name": "OH_AVSource_GetSourceFormat" },
{ "name": "OH_AVSource_GetTrackFormat" }
{
"first_introduced": "10",
"name": "OH_AVSource_CreateWithURI"
},
{
"first_introduced": "10",
"name": "OH_AVSource_CreateWithFD"
},
{
"first_introduced": "10",
"name": "OH_AVSource_Destroy"
},
{
"first_introduced": "10",
"name": "OH_AVSource_GetSourceFormat"
},
{
"first_introduced": "10",
"name": "OH_AVSource_GetTrackFormat"
}
]

View File

@ -16,9 +16,9 @@ import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_codecbase_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources = [
"//interface/sdk_c/multimedia/av_codec/avcodec_audio_channel_layout.h",
"//interface/sdk_c/multimedia/av_codec/native_avcapability.h",
"//interface/sdk_c/multimedia/av_codec/native_avcodec_base.h",
"../avcodec_audio_channel_layout.h",
"../native_avcapability.h",
"../native_avcodec_base.h",
]
}

View File

@ -1,83 +1,365 @@
[
{ "name": "OH_AVCODEC_MIMETYPE_VIDEO_AVC" },
{ "name": "OH_AVCODEC_MIMETYPE_AUDIO_AAC" },
{ "name": "OH_AVCODEC_MIMETYPE_VIDEO_MPEG4" },
{ "name": "OH_AVCODEC_MIMETYPE_VIDEO_HEVC" },
{ "name": "OH_AVCODEC_MIMETYPE_AUDIO_MPEG" },
{ "name": "OH_AVCODEC_MIMETYPE_IMAGE_JPG" },
{ "name": "OH_AVCODEC_MIMETYPE_IMAGE_PNG" },
{ "name": "OH_AVCODEC_MIMETYPE_IMAGE_BMP" },
{ "name": "OH_AVCODEC_MIMETYPE_AUDIO_FLAC" },
{ "name": "OH_AVCODEC_MIMETYPE_AUDIO_VORBIS" },
{ "name": "OH_ED_KEY_TIME_STAMP" },
{ "name": "OH_ED_KEY_EOS" },
{ "name": "OH_MD_KEY_TRACK_TYPE" },
{ "name": "OH_MD_KEY_CODEC_MIME" },
{ "name": "OH_MD_KEY_DURATION" },
{ "name": "OH_MD_KEY_BITRATE" },
{ "name": "OH_MD_KEY_MAX_INPUT_SIZE" },
{ "name": "OH_MD_KEY_WIDTH" },
{ "name": "OH_MD_KEY_HEIGHT" },
{ "name": "OH_MD_KEY_PIXEL_FORMAT" },
{ "name": "OH_MD_KEY_RANGE_FLAG" },
{ "name": "OH_MD_KEY_COLOR_PRIMARIES" },
{ "name": "OH_MD_KEY_TRANSFER_CHARACTERISTICS" },
{ "name": "OH_MD_KEY_MATRIX_COEFFICIENTS" },
{ "name": "OH_MD_KEY_AUDIO_SAMPLE_FORMAT" },
{ "name": "OH_MD_KEY_FRAME_RATE" },
{ "name": "OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE" },
{ "name": "OH_MD_KEY_PROFILE" },
{ "name": "OH_MD_KEY_AUD_CHANNEL_COUNT" },
{ "name": "OH_MD_KEY_AUD_SAMPLE_RATE" },
{ "name": "OH_MD_KEY_I_FRAME_INTERVAL" },
{ "name": "OH_MD_KEY_ROTATION" },
{ "name": "OH_MD_KEY_CODEC_CONFIG" },
{ "name": "OH_MD_KEY_REQUEST_I_FRAME" },
{ "name": "OH_MD_KEY_QUALITY" },
{ "name": "OH_MD_KEY_CHANNEL_LAYOUT" },
{ "name": "OH_MD_KEY_BITS_PER_CODED_SAMPLE" },
{ "name": "OH_MD_KEY_AAC_IS_ADTS" },
{ "name": "OH_MD_KEY_SBR" },
{ "name": "OH_MD_KEY_COMPLIANCE_LEVEL" },
{ "name": "OH_MD_KEY_IDENTIFICATION_HEADER" },
{ "name": "OH_MD_KEY_SETUP_HEADER" },
{ "name": "OH_MD_KEY_SCALING_MODE" },
{ "name": "OH_MD_MAX_INPUT_BUFFER_COUNT" },
{ "name": "OH_MD_MAX_OUTPUT_BUFFER_COUNT" },
{ "name": "OH_MD_KEY_TITLE" },
{ "name": "OH_MD_KEY_ARTIST" },
{ "name": "OH_MD_KEY_ALBUM" },
{ "name": "OH_MD_KEY_ALBUM_ARTIST" },
{ "name": "OH_MD_KEY_DATE" },
{ "name": "OH_MD_KEY_COMMENT" },
{ "name": "OH_MD_KEY_GENRE" },
{ "name": "OH_MD_KEY_COPYRIGHT" },
{ "name": "OH_MD_KEY_LANGUAGE" },
{ "name": "OH_MD_KEY_DESCRIPTION" },
{ "name": "OH_MD_KEY_LYRICS" },
{ "name": "OH_MD_KEY_TRACK_COUNT" },
{ "name": "OH_AVCapability_IsHardware" },
{ "name": "OH_AVCapability_GetName" },
{ "name": "OH_AVCapability_GetMaxSupportedInstances" },
{ "name": "OH_AVCapability_GetEncoderBitrateRange" },
{ "name": "OH_AVCapability_IsEncoderBitrateModeSupported" },
{ "name": "OH_AVCapability_GetEncoderQualityRange" },
{ "name": "OH_AVCapability_GetEncoderComplexityRange" },
{ "name": "OH_AVCapability_GetAudioSupportedSampleRates" },
{ "name": "OH_AVCapability_GetAudioChannelCountRange" },
{ "name": "OH_AVCapability_GetVideoWidthAlignment" },
{ "name": "OH_AVCapability_GetVideoHeightAlignment" },
{ "name": "OH_AVCapability_GetVideoWidthRangeForHeight" },
{ "name": "OH_AVCapability_GetVideoHeightRangeForWidth" },
{ "name": "OH_AVCapability_GetVideoWidthRange" },
{ "name": "OH_AVCapability_GetVideoHeightRange" },
{ "name": "OH_AVCapability_IsVideoSizeSupported" },
{ "name": "OH_AVCapability_GetVideoFrameRateRange" },
{ "name": "OH_AVCapability_GetVideoFrameRateRangeForSize" },
{ "name": "OH_AVCapability_AreVideoSizeAndFrameRateSupported" },
{ "name": "OH_AVCapability_GetVideoSupportedPixelFormats" },
{ "name": "OH_AVCapability_GetSupportedProfiles" },
{ "name": "OH_AVCapability_GetSupportedLevelsForProfile" },
{ "name": "OH_AVCapability_AreProfileAndLevelSupported" }
{
"first_introduced": "9",
"name": "OH_AVCODEC_MIMETYPE_VIDEO_AVC"
},
{
"first_introduced": "9",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_AAC"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_VIDEO_MPEG4"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_VIDEO_HEVC"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_MPEG"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_IMAGE_JPG"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_IMAGE_PNG"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_IMAGE_BMP"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_FLAC"
},
{
"first_introduced": "10",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_VORBIS"
},
{
"first_introduced": "11",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_VIVID"
},
{
"first_introduced": "11",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB"
},
{
"first_introduced": "11",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB"
},
{
"first_introduced": "11",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_OPUS"
},
{
"first_introduced": "11",
"name": "OH_AVCODEC_MIMETYPE_AUDIO_G711MU"
},
{
"first_introduced": "9",
"name": "OH_ED_KEY_TIME_STAMP"
},
{
"first_introduced": "9",
"name": "OH_ED_KEY_EOS"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_TRACK_TYPE"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_CODEC_MIME"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_DURATION"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_BITRATE"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_MAX_INPUT_SIZE"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_WIDTH"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_HEIGHT"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_PIXEL_FORMAT"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_RANGE_FLAG"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_COLOR_PRIMARIES"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_TRANSFER_CHARACTERISTICS"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_MATRIX_COEFFICIENTS"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_AUDIO_SAMPLE_FORMAT"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_FRAME_RATE"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_PROFILE"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_AUD_CHANNEL_COUNT"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_AUD_SAMPLE_RATE"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_I_FRAME_INTERVAL"
},
{
"first_introduced": "9",
"name": "OH_MD_KEY_ROTATION"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_CODEC_CONFIG"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_REQUEST_I_FRAME"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_QUALITY"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_CHANNEL_LAYOUT"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_BITS_PER_CODED_SAMPLE"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_AAC_IS_ADTS"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_SBR"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_COMPLIANCE_LEVEL"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_IDENTIFICATION_HEADER"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_SETUP_HEADER"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_SCALING_MODE"
},
{
"first_introduced": "10",
"name": "OH_MD_MAX_INPUT_BUFFER_COUNT"
},
{
"first_introduced": "10",
"name": "OH_MD_MAX_OUTPUT_BUFFER_COUNT"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_TITLE"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_ARTIST"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_ALBUM"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_ALBUM_ARTIST"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_DATE"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_COMMENT"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_GENRE"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_COPYRIGHT"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_LANGUAGE"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_DESCRIPTION"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_LYRICS"
},
{
"first_introduced": "10",
"name": "OH_MD_KEY_TITLEOH_MD_KEY_TITLE"
},
{
"first_introduced": "11",
"name": "OH_MD_KEY_AUDIO_COMPRESSION_LEVEL"
},
{
"first_introduced": "11",
"name": "OH_MD_KEY_VIDEO_IS_HDR_VIVID"
},
{
"first_introduced": "11",
"name": "OH_MD_KEY_AUDIO_OBJECT_NUMBER"
},
{
"first_introduced": "11",
"name": "OH_MD_KEY_AUDIO_VIVID_METADATA"
},
{
"first_introduced": "10",
"name": "OH_AVCodec_GetCapability"
},
{
"first_introduced": "10",
"name": "OH_AVCodec_GetCapabilityByCategory"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_IsHardware"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetName"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetMaxSupportedInstances"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetEncoderBitrateRange"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_IsEncoderBitrateModeSupported"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetEncoderQualityRange"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetEncoderComplexityRange"
},
{
"name": "OH_AVCapability_GetAudioSupportedSampleRates"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetAudioChannelCountRange"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoWidthAlignment"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoHeightAlignment"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoWidthRangeForHeight"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoHeightRangeForWidth"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoWidthRange"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoHeightRange"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_IsVideoSizeSupported"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoFrameRateRange"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoFrameRateRangeForSize"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_AreVideoSizeAndFrameRateSupported"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetVideoSupportedPixelFormats"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetSupportedProfiles"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_GetSupportedLevelsForProfile"
},
{
"first_introduced": "10",
"name": "OH_AVCapability_AreProfileAndLevelSupported"
}
]

View File

@ -0,0 +1,207 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NATIVE_AVCODEC_AUDIOCODEC_H
#define NATIVE_AVCODEC_AUDIOCODEC_H
#include <stdint.h>
#include <stdio.h>
#include "native_avcodec_base.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create an audio encoder or decoder instance from the mime type, which is recommended in most cases.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE}
* @param isEncoder true indicates the need to create an encoder, while false indicates the need to create a decoder.
* @return Returns a Pointer to an OH_AVCodec instance
* @since 11
*/
OH_AVCodec *OH_AudioCodec_CreateByMime(const char *mime, bool isEncoder);
/**
* @brief Create an audio codec instance through the audio codec name.
* The premise of using this interface is to know the exact name of the codec.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param name Audio codec name
* @return Returns a Pointer to an OH_AVCodec instance
* @since 11
*/
OH_AVCodec *OH_AudioCodec_CreateByName(const char *name);
/**
* @brief Clear the internal resources of the codec and destroy the codec instance
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_Destroy(OH_AVCodec *codec);
/**
* @brief Set the asynchronous callback function so that your application
* can respond to the events generated by the audio codec. This interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @param callback A collection of all callback functions, see {@link OH_AVCodecCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
/**
* @brief To configure the audio codec, typically, you need to configure the description information of the
* audio track. This interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @param format A pointer to an OH_AVFormat giving a description of the audio track to be encoded or decoded
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_Configure(OH_AVCodec *codec, const OH_AVFormat *format);
/**
* @brief To prepare the internal resources of the codec, the Configure interface must be called
* before calling this interface.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_Prepare(OH_AVCodec *codec);
/**
* @brief Start the codec, this interface must be called after the Prepare is successful.
* After being successfully started, the codec will start reporting NeedInputData events.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_Start(OH_AVCodec *codec);
/**
* @brief Stop the codec. After stopping, you can re-enter the Started state through Start,
* but it should be noted that need to re-enter if the codec has been input before
* Codec-Specific-Data.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_Stop(OH_AVCodec *codec);
/**
* @brief Clear the input and output data buffered in the codec. 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.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_Flush(OH_AVCodec *codec);
/**
* @brief Reset the codec. To continue encoding or decoding, you need to call the Configure interface again to
* configure the codec instance.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_Reset(OH_AVCodec *codec);
/**
* @brief Get the description information of the output data of the codec, refer to {@link 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 calling {@link OH_AVFormat_Destroy}.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription,
* or destroyed with OH_AVCodec;
* @since 11
*/
OH_AVFormat *OH_AudioCodec_GetOutputDescription(OH_AVCodec *codec);
/**
* @brief Set dynamic parameters to the codec. Note: This interface can only be called after the codec is started.
* At the same time, incorrect parameter settings may cause encoding or decoding failure.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @param format OH_AVFormat handle pointer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_SetParameter(OH_AVCodec *codec, const OH_AVFormat *format);
/**
* @brief Submit the input buffer filled with data to the audio codec. The {@link 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 codec, the buffer cannot be accessed again until the {@link OH_AVCodecOnNeedInputData}
* callback is received again reporting that the buffer with the same index is available. In addition, for some
* codecs, it is required to input Codec-Specific-Data to the codec at the beginning to initialize the encoding or
* decoding process of the codec.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @param index Enter the index value corresponding to the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
/**
* @brief Return the processed output Buffer to the codec.
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index);
/**
* @brief Check whether the current codec instance is valid. It can be used fault recovery or app
* switchback from the background
* @syscap SystemCapability.Multimedia.Media.AudioCodec
* @param codec Pointer to an OH_AVCodec instance
* @param 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
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AudioCodec_IsValid(OH_AVCodec *codec, bool *isValid);
#ifdef __cplusplus
}
#endif
#endif // NATIVE_AVCODEC_AUDIOCODEC_H

View File

@ -18,9 +18,6 @@
#include <stdint.h>
#include <stdio.h>
#include "native_averrors.h"
#include "native_avformat.h"
#include "native_avmemory.h"
#include "native_avcodec_base.h"
#ifdef __cplusplus
@ -32,6 +29,8 @@ extern "C" {
* @syscap SystemCapability.Multimedia.Media.AudioDecoder
* @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE}
* @return Returns a Pointer to an OH_AVCodec instance
* @deprecated since 11
* @useinstead OH_AudioCodec_CreateByMime
* @since 9
* @version 1.0
*/
@ -43,6 +42,8 @@ OH_AVCodec *OH_AudioDecoder_CreateByMime(const char *mime);
* @syscap SystemCapability.Multimedia.Media.AudioDecoder
* @param name Audio codec name
* @return Returns a Pointer to an OH_AVCodec instance
* @deprecated since 11
* @useinstead OH_AudioCodec_CreateByName
* @since 9
* @version 1.0
*/
@ -54,6 +55,8 @@ OH_AVCodec *OH_AudioDecoder_CreateByName(const char *name);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Destroy
* @since 9
* @version 1.0
*/
@ -68,6 +71,8 @@ OH_AVErrCode OH_AudioDecoder_Destroy(OH_AVCodec *codec);
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_RegisterCallback
* @since 9
* @version 1.0
*/
@ -75,12 +80,14 @@ OH_AVErrCode OH_AudioDecoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb
/**
* @brief To configure the audio decoder, typically, you need to configure the description information of the decoded
* audio track, which can be extracted from the container. This interface must be called before Prepare is called.
* audio track, which can be extracted from the OH_AVSource. This interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.AudioDecoder
* @param codec Pointer to an OH_AVCodec instance
* @param format A pointer to an OH_AVFormat giving a description of the audio track to be decoded
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Configure
* @since 9
* @version 1.0
*/
@ -93,6 +100,8 @@ OH_AVErrCode OH_AudioDecoder_Configure(OH_AVCodec *codec, OH_AVFormat *format);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Prepare
* @since 9
* @version 1.0
*/
@ -105,6 +114,8 @@ OH_AVErrCode OH_AudioDecoder_Prepare(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Start
* @since 9
* @version 1.0
*/
@ -118,6 +129,8 @@ OH_AVErrCode OH_AudioDecoder_Start(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Stop
* @since 9
* @version 1.0
*/
@ -131,6 +144,8 @@ OH_AVErrCode OH_AudioDecoder_Stop(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Flush
* @since 9
* @version 1.0
*/
@ -143,6 +158,8 @@ OH_AVErrCode OH_AudioDecoder_Flush(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Reset
* @since 9
* @version 1.0
*/
@ -157,6 +174,8 @@ OH_AVErrCode OH_AudioDecoder_Reset(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription,
* or destroyed with OH_AVCodec;
* @deprecated since 11
* @useinstead OH_AudioCodec_GetOutputDescription
* @since 9
* @version 1.0
*/
@ -170,6 +189,8 @@ OH_AVFormat *OH_AudioDecoder_GetOutputDescription(OH_AVCodec *codec);
* @param format OH_AVFormat handle pointer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_SetParameter
* @since 9
* @version 1.0
*/
@ -188,6 +209,8 @@ OH_AVErrCode OH_AudioDecoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format
* @param attr Information describing the data contained in the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_PushInputBuffer
* @since 9
* @version 1.0
*/
@ -200,6 +223,8 @@ OH_AVErrCode OH_AudioDecoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_FreeOutputBuffer
* @since 9
* @version 1.0
*/
@ -214,6 +239,8 @@ OH_AVErrCode OH_AudioDecoder_FreeOutputData(OH_AVCodec *codec, uint32_t index);
* false if the codec instance is invalid
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_IsValid
* @since 10
*/
OH_AVErrCode OH_AudioDecoder_IsValid(OH_AVCodec *codec, bool *isValid);

View File

@ -18,10 +18,8 @@
#include <stdint.h>
#include <stdio.h>
#include "native_averrors.h"
#include "native_avformat.h"
#include "native_avmemory.h"
#include "native_avcodec_base.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -31,6 +29,8 @@ extern "C" {
* @syscap SystemCapability.Multimedia.Media.AudioEncoder
* @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE}
* @return Returns a Pointer to an OH_AVCodec instance
* @deprecated since 11
* @useinstead OH_AudioCodec_CreateByMime
* @since 9
* @version 1.0
*/
@ -42,6 +42,8 @@ OH_AVCodec *OH_AudioEncoder_CreateByMime(const char *mime);
* @syscap SystemCapability.Multimedia.Media.AudioEncoder
* @param name Audio encoder name
* @return Returns a Pointer to an OH_AVCodec instance
* @deprecated since 11
* @useinstead OH_AudioCodec_CreateByName
* @since 9
* @version 1.0
*/
@ -53,6 +55,8 @@ OH_AVCodec *OH_AudioEncoder_CreateByName(const char *name);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Destroy
* @since 9
* @version 1.0
*/
@ -67,6 +71,8 @@ OH_AVErrCode OH_AudioEncoder_Destroy(OH_AVCodec *codec);
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_RegisterCallback
* @since 9
* @version 1.0
*/
@ -80,6 +86,8 @@ OH_AVErrCode OH_AudioEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb
* @param format OH_AVFormat handle pointer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Configure
* @since 9
* @version 1.0
*/
@ -92,6 +100,8 @@ OH_AVErrCode OH_AudioEncoder_Configure(OH_AVCodec *codec, OH_AVFormat *format);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Prepare
* @since 9
* @version 1.0
*/
@ -104,6 +114,8 @@ OH_AVErrCode OH_AudioEncoder_Prepare(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Start
* @since 9
* @version 1.0
*/
@ -115,6 +127,8 @@ OH_AVErrCode OH_AudioEncoder_Start(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Stop
* @since 9
* @version 1.0
*/
@ -128,6 +142,8 @@ OH_AVErrCode OH_AudioEncoder_Stop(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Flush
* @since 9
* @version 1.0
*/
@ -140,6 +156,8 @@ OH_AVErrCode OH_AudioEncoder_Flush(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_Reset
* @since 9
* @version 1.0
*/
@ -153,6 +171,8 @@ OH_AVErrCode OH_AudioEncoder_Reset(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription,
* or destroyed with OH_AVCodec;
* @deprecated since 11
* @useinstead OH_AudioCodec_GetOutputDescription
* @since 9
* @version 1.0
*/
@ -166,6 +186,8 @@ OH_AVFormat *OH_AudioEncoder_GetOutputDescription(OH_AVCodec *codec);
* @param format OH_AVFormat handle pointer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_SetParameter
* @since 9
* @version 1.0
*/
@ -182,6 +204,8 @@ OH_AVErrCode OH_AudioEncoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format
* @param attr Information describing the data contained in the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_PushInputBuffer
* @since 9
* @version 1.0
*/
@ -194,6 +218,8 @@ OH_AVErrCode OH_AudioEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_FreeOutputBuffer
* @since 9
* @version 1.0
*/
@ -208,6 +234,8 @@ OH_AVErrCode OH_AudioEncoder_FreeOutputData(OH_AVCodec *codec, uint32_t index);
* false if the codec instance is invalid
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AudioCodec_IsValid
* @since 10
*/
OH_AVErrCode OH_AudioEncoder_IsValid(OH_AVCodec *codec, bool *isValid);

View File

@ -18,8 +18,7 @@
#include <stdint.h>
#include <stdio.h>
#include "native_averrors.h"
#include "native_avformat.h"
#include "native_avbuffer.h"
#include "native_avmemory.h"
#ifdef __cplusplus
@ -29,41 +28,6 @@ extern "C" {
typedef struct NativeWindow OHNativeWindow;
typedef struct OH_AVCodec OH_AVCodec;
/**
* @brief Enumerate the categories of OH_AVCodec's Buffer tags
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 9
* @version 1.0
*/
typedef enum OH_AVCodecBufferFlags {
AVCODEC_BUFFER_FLAGS_NONE = 0,
/* Indicates that the Buffer is an End-of-Stream frame */
AVCODEC_BUFFER_FLAGS_EOS = 1 << 0,
/* Indicates that the Buffer contains keyframes */
AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 << 1,
/* Indicates that the data contained in the Buffer is only part of a frame */
AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2,
/* Indicates that the Buffer contains Codec-Specific-Data */
AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3,
} OH_AVCodecBufferFlags;
/**
* @brief Define the Buffer description information of OH_AVCodec
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 9
* @version 1.0
*/
typedef struct OH_AVCodecBufferAttr {
/* Presentation timestamp of this Buffer in microseconds */
int64_t pts;
/* The size of the data contained in the Buffer in bytes */
int32_t size;
/* The starting offset of valid data in this Buffer */
int32_t offset;
/* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */
uint32_t flags;
} OH_AVCodecBufferAttr;
/**
* @brief When an error occurs in the running of the OH_AVCodec instance, the function pointer will be called
* to report specific error information.
@ -97,6 +61,8 @@ typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format
* @param index The index corresponding to the newly available input buffer.
* @param data New available input buffer.
* @param userData User specific data
* @deprecated since 11
* @useinstead OH_AVCodecOnNeedInputBuffer
* @since 9
* @version 1.0
*/
@ -113,11 +79,37 @@ typedef void (*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_
* @param data Buffer containing the new output data
* @param attr The description of the new output Buffer, please refer to {@link OH_AVCodecBufferAttr}
* @param userData specified data
* @deprecated since 11
* @useinstead OH_AVCodecOnNewOutputBuffer
* @since 9
* @version 1.0
*/
typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data,
OH_AVCodecBufferAttr *attr, void *userData);
OH_AVCodecBufferAttr *attr, void *userData);
/**
* @brief When OH_AVCodec needs new input data during the running process,
* the function pointer will be called and carry an available Buffer to fill in the new input data.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @param codec OH_AVCodec instance
* @param index The index corresponding to the newly available input buffer.
* @param buffer New available input buffer.
* @param userData User specific data
* @since 11
*/
typedef void (*OH_AVCodecOnNeedInputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData);
/**
* @brief When new output data is generated during the operation of OH_AVCodec, the function pointer will be
* called and carry a Buffer containing the new output data.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @param codec OH_AVCodec instance
* @param index The index corresponding to the new output Buffer.
* @param buffer Buffer containing the new output buffer.
* @param userData specified data
* @since 11
*/
typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData);
/**
* @brief A collection of all asynchronous callback function pointers in OH_AVCodec. Register an instance of this
@ -127,7 +119,9 @@ typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_
* @param onError Monitor OH_AVCodec operation errors, refer to {@link OH_AVCodecOnError}
* @param onStreamChanged Monitor codec stream information, refer to {@link OH_AVCodecOnStreamChanged}
* @param onNeedInputData Monitoring codec requires input data, refer to {@link OH_AVCodecOnNeedInputData}
* @param onNeedInputData Monitor codec to generate output data, refer to {@link onNeedInputData}
* @param onNeedOutputData Monitor codec to generate output data, refer to {@link OH_AVCodecOnNewOutputData}
* @deprecated since 11
* @useinstead OH_AVCodecCallback
* @since 9
* @version 1.0
*/
@ -138,6 +132,24 @@ typedef struct OH_AVCodecAsyncCallback {
OH_AVCodecOnNewOutputData onNeedOutputData;
} OH_AVCodecAsyncCallback;
/**
* @brief A collection of all asynchronous callback function pointers in OH_AVCodec. Register an instance of this
* structure to the OH_AVCodec instance, and process the information reported through the callback to ensure the
* normal operation of OH_AVCodec.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @param onError Monitor OH_AVCodec operation errors, refer to {@link OH_AVCodecOnError}
* @param onStreamChanged Monitor codec stream information, refer to {@link OH_AVCodecOnStreamChanged}
* @param onNeedInputBuffer Monitoring codec requires input buffer, refer to {@link OH_AVCodecOnNeedInputBuffer}
* @param onNewOutputBuffer Monitor codec to generate output buffer, refer to {@link OH_AVCodecOnNewOutputBuffer}
* @since 11
*/
typedef struct OH_AVCodecCallback {
OH_AVCodecOnError onError;
OH_AVCodecOnStreamChanged onStreamChanged;
OH_AVCodecOnNeedInputBuffer onNeedInputBuffer;
OH_AVCodecOnNewOutputBuffer onNewOutputBuffer;
} OH_AVCodecCallback;
/**
* @brief Enumerates the MIME types of audio and video codecs
* @syscap SystemCapability.Multimedia.Media.CodecBase
@ -156,14 +168,34 @@ extern const char *OH_AVCODEC_MIMETYPE_AUDIO_FLAC;
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VORBIS;
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_MPEG;
extern const char *OH_AVCODEC_MIMETYPE_VIDEO_HEVC;
/**
* @brief Enumerates the types of audio and video muxer
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @deprecated since 11
* @since 10
*/
extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4;
/**
* @brief Enumerates the types of audio and video muxer
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
extern const char *OH_AVCODEC_MIMETYPE_IMAGE_JPG;
extern const char *OH_AVCODEC_MIMETYPE_IMAGE_PNG;
extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP;
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AVS3DA;
/**
* @brief Enumerates the MIME types of audio codecs
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 11
*/
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VIVID;
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB;
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB;
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_OPUS;
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_G711MU;
/**
* @brief The extra data's key of surface Buffer
@ -177,7 +209,7 @@ extern const char *OH_ED_KEY_TIME_STAMP;
extern const char *OH_ED_KEY_EOS;
/**
* @brief Provides the uniform container for storing the media description.
* @brief Provides the uniform key for storing the media description.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 9
* @version 1.0
@ -216,7 +248,7 @@ extern const char *OH_MD_KEY_I_FRAME_INTERVAL;
extern const char *OH_MD_KEY_ROTATION;
/**
* @brief Provides the uniform container for storing the media description.
* @brief Provides the uniform key for storing the media description.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
@ -259,18 +291,6 @@ extern const char *OH_MD_KEY_DESCRIPTION;
extern const char *OH_MD_KEY_LYRICS;
/* source format Key for track count, value type is uint32_t */
extern const char *OH_MD_KEY_TRACK_COUNT;
/* Key for type of file, value type is int32_t, see @OH_FileType */
extern const char *OH_MD_KEY_FILE_TYPE;
/* Key for whether the file contains video tracks, value type is boolean */
extern const char *OH_MD_KEY_HAS_VIDEO;
/* Key for whether the file contains audio tracks, value type is boolean */
extern const char *OH_MD_KEY_HAS_AUDIO;
/* Key for author of file, value type is string */
extern const char *OH_MD_KEY_AUTHOR;
/* Key for composer of file, value type is string */
extern const char *OH_MD_KEY_COMPOSER;
/* Key for cover of file, value type is uint8_t pointer */
extern const char *OH_MD_KEY_COVER;
/* Key for the desired encoding channel layout, value type is int64_t, this key is only supported for encoders */
extern const char *OH_MD_KEY_CHANNEL_LAYOUT;
/* Key for bits per coded sample, value type is uint32_t, supported for flac encoder, see @OH_BitsPerSample */
@ -291,32 +311,20 @@ extern const char *OH_MD_KEY_SCALING_MODE;
extern const char *OH_MD_MAX_INPUT_BUFFER_COUNT;
/* Key for max output buffer count, value type is int32_t */
extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT;
/* Key for codec compression level, value type is uint32_t */
extern const char *OH_MD_KEY_COMPRESSION_LEVEL;
/* Key for encode level, value type is int32_t. see @OH_HEVCLevel. */
extern const char *OH_MD_KEY_LEVEL;
/* Key for chroma location, value type is int32_t. see @OH_ChromaLocation. */
extern const char *OH_MD_KEY_VIDEO_CHROMA_LOCATION;
/**
* @brief File type.
* @brief Provides the uniform key for storing the media description.
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
* @version 1.0
* @since 11
*/
typedef enum OH_FileType {
FILE_TYPE_UNKNOW = 0,
FILE_TYPE_MP4 = 101,
FILE_TYPE_MPEGTS = 102,
FILE_TYPE_MKV = 103,
FILE_TYPE_AMR = 201,
FILE_TYPE_AAC = 202,
FILE_TYPE_MP3 = 203,
FILE_TYPE_FLAC = 204,
FILE_TYPE_OGG = 205,
FILE_TYPE_M4A = 206,
FILE_TYPE_WAV = 207,
} OH_FileType;
/* Key for audio codec compression level, value type is uint32_t */
extern const char *OH_MD_KEY_AUDIO_COMPRESSION_LEVEL;
/* Key of the video is hdr vivid. value type is bool */
extern const char *OH_MD_KEY_VIDEO_IS_HDR_VIVID;
/* Key for number of audio objects. value type is int32_t */
extern const char *OH_MD_KEY_AUDIO_OBJECT_NUMBER;
/* Key for meta data of audio vivid. value type is a uint8_t pointer */
extern const char *OH_MD_KEY_AUDIO_VIVID_METADATA;
/**
* @brief Media type.
@ -353,6 +361,19 @@ typedef enum OH_AVCProfile {
AVC_PROFILE_MAIN = 8,
} OH_AVCProfile;
/**
* @brief HEVC Profile
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
typedef enum OH_HEVCProfile {
HEVC_PROFILE_MAIN = 0,
HEVC_PROFILE_MAIN_10 = 1,
HEVC_PROFILE_MAIN_STILL = 2,
HEVC_PROFILE_MAIN_10_HDR10 = 3,
HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4,
} OH_HEVCProfile;
/**
* @brief Enumerates the muxer output file format
* @syscap SystemCapability.Multimedia.Media.CodecBase
@ -379,38 +400,33 @@ typedef enum OH_AVSeekMode {
} OH_AVSeekMode;
/**
* @brief HEVC Profile
* @brief Scaling Mode
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
typedef enum OH_HEVCProfile {
HEVC_PROFILE_MAIN = 0,
HEVC_PROFILE_MAIN_10 = 1,
HEVC_PROFILE_MAIN_STILL = 2,
HEVC_PROFILE_MAIN_10_HDR10 = 3,
HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4,
} OH_HEVCProfile;
typedef enum OH_ScalingMode {
SCALING_MODE_SCALE_TO_WINDOW = 1,
SCALING_MODE_SCALE_CROP = 2,
} OH_ScalingMode;
/**
* @brief HEVC Level
* @brief enum Audio Bits Per Coded Sample
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
enum OH_HEVCLevel {
HEVC_LEVEL_1 = 0,
HEVC_LEVEL_2 = 1,
HEVC_LEVEL_21 = 2,
HEVC_LEVEL_3 = 3,
HEVC_LEVEL_31 = 4,
HEVC_LEVEL_4 = 5,
HEVC_LEVEL_41 = 6,
HEVC_LEVEL_5 = 7,
HEVC_LEVEL_51 = 8,
HEVC_LEVEL_52 = 9,
HEVC_LEVEL_6 = 10,
HEVC_LEVEL_61 = 11,
HEVC_LEVEL_62 = 12,
};
typedef enum OH_BitsPerSample {
SAMPLE_U8 = 0,
SAMPLE_S16LE = 1,
SAMPLE_S24LE = 2,
SAMPLE_S32LE = 3,
SAMPLE_F32LE = 4,
SAMPLE_U8P = 5,
SAMPLE_S16P = 6,
SAMPLE_S24P = 7,
SAMPLE_S32P = 8,
SAMPLE_F32P = 9,
INVALID_WIDTH = -1
} OH_BitsPerSample;
/**
* @brief Color Primary
@ -478,49 +494,6 @@ typedef enum OH_MatrixCoefficient {
MATRIX_COEFFICIENT_ICTCP = 14,
} OH_MatrixCoefficient;
/**
* @brief Chroma Location
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
enum OH_ChromaLocation {
CHROMA_LOC_UNSPECIFIED = 0,
CHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
CHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
CHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
CHROMA_LOC_TOP = 4,
CHROMA_LOC_BOTTOMLEFT = 5,
CHROMA_LOC_BOTTOM = 6,
};
/**
* @brief Scaling Mode
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
typedef enum OH_ScalingMode {
SCALING_MODE_SCALE_TO_WINDOW = 1,
SCALING_MODE_SCALE_CROP = 2,
} OH_ScalingMode;
/**
* @brief enum Audio Bits Per Coded Sample
* @syscap SystemCapability.Multimedia.Media.CodecBase
* @since 10
*/
typedef enum OH_BitsPerSample {
SAMPLE_U8 = 0,
SAMPLE_S16LE = 1,
SAMPLE_S24LE = 2,
SAMPLE_S32LE = 3,
SAMPLE_F32LE = 4,
SAMPLE_U8P = 5,
SAMPLE_S16P = 6,
SAMPLE_S24P = 7,
SAMPLE_S32P = 8,
SAMPLE_F32P = 9,
INVALID_WIDTH = -1
} OH_BitsPerSample;
#ifdef __cplusplus
}
#endif

View File

@ -18,9 +18,6 @@
#include <stdint.h>
#include <stdio.h>
#include "native_averrors.h"
#include "native_avformat.h"
#include "native_avmemory.h"
#include "native_avcodec_base.h"
#ifdef __cplusplus
@ -68,11 +65,26 @@ OH_AVErrCode OH_VideoDecoder_Destroy(OH_AVCodec *codec);
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_VideoDecoder_RegisterCallback
* @since 9
* @version 1.0
*/
OH_AVErrCode OH_VideoDecoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallback callback, void *userData);
/**
* @brief Set the asynchronous callback function so that your application can respond to the events
* generated by the video decoder. This interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @param callback A collection of all callback functions, see {@link OH_AVCodecCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
/**
* @brief Specify the output Surface to provide video decoding output,
* this interface must be called before Prepare is called
@ -88,7 +100,7 @@ OH_AVErrCode OH_VideoDecoder_SetSurface(OH_AVCodec *codec, OHNativeWindow *windo
/**
* @brief To configure the video decoder, typically, you need to configure the description information of the decoded
* video track, which can be extracted from the container. This interface must be called before Prepare is called.
* video track, which can be extracted from the OH_AVSource. This interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @param format A pointer to an OH_AVFormat to give the description of the video track to be decoded
@ -198,6 +210,8 @@ OH_AVErrCode OH_VideoDecoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format
* @param attr Information describing the data contained in the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_VideoDecoder_PushInputBuffer
* @since 9
* @version 1.0
*/
@ -212,6 +226,8 @@ OH_AVErrCode OH_VideoDecoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_VideoDecoder_RenderOutputBuffer
* @since 9
* @version 1.0
*/
@ -224,11 +240,53 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputData(OH_AVCodec *codec, uint32_t index)
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_VideoDecoder_FreeOutputBuffer
* @since 9
* @version 1.0
*/
OH_AVErrCode OH_VideoDecoder_FreeOutputData(OH_AVCodec *codec, uint32_t index);
/**
* @brief Submit the input buffer filled with data to the video decoder. The {@link OH_AVCodecOnNeedInputBuffer}
* callback will report the available input buffer and the corresponding index value. Once the buffer with the
* specified index is submitted to the video decoder, the buffer cannot be accessed again until the
* {@link OH_AVCodecOnNeedInputBuffer} callback is received again reporting that the buffer with the same index is
* available. In addition, for some decoders, it is required to input Codec-Specific-Data to the decoder at the
* beginning to initialize the decoding process of the decoder, such as PPS/SPS data in H264 format.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @param index The index of the input buffer.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
/**
* @brief Return the processed output Buffer to the decoder, and notify the decoder to finish rendering the
* decoded data contained in the Buffer on the output Surface. If the output surface is not configured before,
* calling this interface only returns the output buffer corresponding to the specified index to the decoder.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link
* OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t index);
/**
* @brief Return the processed output Buffer to the decoder.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index);
/**
* @brief Check whether the current codec instance is valid. It can be used fault recovery or app
* switchback from the background.

View File

@ -18,9 +18,6 @@
#include <stdint.h>
#include <stdio.h>
#include "native_averrors.h"
#include "native_avformat.h"
#include "native_avmemory.h"
#include "native_avcodec_base.h"
#ifdef __cplusplus
@ -61,18 +58,33 @@ OH_AVErrCode OH_VideoEncoder_Destroy(OH_AVCodec *codec);
/**
* @brief Set the asynchronous callback function so that your application can respond to the events generated by the
* video encoder. This interface must be called before Prepare is called
* video encoder. This interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @param callback A collection of all callback functions, see {@link OH_AVCodecAsyncCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_VideoEncoder_RegisterCallback
* @since 9
* @version 1.0
*/
OH_AVErrCode OH_VideoEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallback callback, void *userData);
/**
* @brief Set the asynchronous callback function so that your application can respond to the events generated by the
* video encoder. This interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @param callback A collection of all callback functions, see {@link OH_AVCodecCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link
* OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_VideoEncoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
/**
* @brief To configure the video encoder, typically, you need to configure the description information of the
* encoded video track. This interface must be called before Prepare is called.
@ -175,7 +187,8 @@ OH_AVErrCode OH_VideoEncoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format
* @brief Get the input Surface from the video encoder, this interface must be called before Prepare is called.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}
* @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}, the application is responsible for
* managing the life cycle of the window, call OH_NativeWindow_DestroyNativeWindow() when done.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 9
@ -190,6 +203,8 @@ OH_AVErrCode OH_VideoEncoder_GetSurface(OH_AVCodec *codec, OHNativeWindow **wind
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_VideoEncoder_FreeOutputBuffer
* @since 9
* @version 1.0
*/
@ -215,10 +230,34 @@ OH_AVErrCode OH_VideoEncoder_NotifyEndOfStream(OH_AVCodec *codec);
* @param attr Information describing the data contained in the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_VideoEncoder_PushInputBuffer
* @since 10
*/
OH_AVErrCode OH_VideoEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr);
/**
* @brief Submit the input buffer filled with data to the video encoder.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @param index Enter the index value corresponding to the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_VideoEncoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
/**
* @brief Return the processed output Buffer to the encoder.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_VideoEncoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index);
/**
* @brief Get the input data description of the encoder after call {@OH_VideoEncoder_Configure},
* refer to {@link OH_AVFormat} for details. It should be noted that the life cycle of the OH_AVFormat

View File

@ -18,8 +18,6 @@
#include <stdint.h>
#include "native_avcodec_base.h"
#include "native_averrors.h"
#include "native_avmemory.h"
#include "native_avsource.h"
#ifdef __cplusplus
@ -92,11 +90,28 @@ OH_AVErrCode OH_AVDemuxer_UnselectTrackByID(OH_AVDemuxer *demuxer, uint32_t trac
* @param info The OH_AVCodecBufferAttr handle pointer to the buffer storing sample information.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AVDemuxer_ReadSampleBuffer
* @since 10
*/
OH_AVErrCode OH_AVDemuxer_ReadSample(OH_AVDemuxer *demuxer, uint32_t trackIndex,
OH_AVMemory *sample, OH_AVCodecBufferAttr *info);
/**
* @brief Get the current encoded sample and sample-related information from the specified
* track. The track index must be selected before reading sample. The demuxer will advance
* automatically after calling this interface.
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param demuxer Pointer to an OH_AVDemuxer instance.
* @param trackIndex The index of the track from which read an encoded sample.
* @param sample The OH_AVBuffer handle pointer to the buffer storing the sample data and corresponding attribute.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AVDemuxer_ReadSampleBuffer(OH_AVDemuxer *demuxer, uint32_t trackIndex,
OH_AVBuffer *sample);
/**
* @brief All selected tracks seek near to the requested time according to the seek mode.
* @syscap SystemCapability.Multimedia.Media.Spliter

View File

@ -19,10 +19,6 @@
#include <stdint.h>
#include <stdio.h>
#include "native_avcodec_base.h"
#include "native_averrors.h"
#include "native_avformat.h"
#include "native_avmemory.h"
#ifdef __cplusplus
extern "C" {
@ -90,12 +86,28 @@ OH_AVErrCode OH_AVMuxer_Start(OH_AVMuxer *muxer);
* @param info The buffer information related to this sample {@link OH_AVCodecBufferAttr}
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AVMuxer_WriteSampleBuffer
* @since 10
*/
OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer,
uint32_t trackIndex,
OH_AVMemory *sample,
OH_AVCodecBufferAttr info);
OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, uint32_t trackIndex,
OH_AVMemory *sample, OH_AVCodecBufferAttr info);
/**
* @brief Write an encoded sample to the muxer.
* Note: This interface can only be called after OH_AVMuxer_Start and before OH_AVMuxer_Stop. The application needs to
* make sure that the samples are written to the right tracks. Also, it needs to make sure the samples for each track
* are written in chronological order.
* @syscap SystemCapability.Multimedia.Media.Muxer
* @param muxer Pointer to an OH_AVMuxer instance
* @param trackIndex The track index for this sample
* @param sample The encoded or demuxer sample, which including data and buffer information
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AVMuxer_WriteSampleBuffer(OH_AVMuxer *muxer, uint32_t trackIndex,
const OH_AVBuffer *sample);
/**
* @brief Stop the muxer.

View File

@ -15,8 +15,7 @@ import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_vdec_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources =
[ "//interface/sdk_c/multimedia/av_codec/native_avcodec_videodecoder.h" ]
sources = [ "../native_avcodec_videodecoder.h" ]
}
ohos_ndk_library("libnative_media_vdec") {

View File

@ -1,19 +1,86 @@
[
{ "name": "OH_VideoDecoder_CreateByMime" },
{ "name": "OH_VideoDecoder_CreateByName" },
{ "name": "OH_VideoDecoder_Destroy" },
{ "name": "OH_VideoDecoder_SetCallback" },
{ "name": "OH_VideoDecoder_SetSurface" },
{ "name": "OH_VideoDecoder_Configure" },
{ "name": "OH_VideoDecoder_Prepare" },
{ "name": "OH_VideoDecoder_Start" },
{ "name": "OH_VideoDecoder_Stop" },
{ "name": "OH_VideoDecoder_Flush" },
{ "name": "OH_VideoDecoder_Reset" },
{ "name": "OH_VideoDecoder_GetOutputDescription" },
{ "name": "OH_VideoDecoder_SetParameter" },
{ "name": "OH_VideoDecoder_PushInputData" },
{ "name": "OH_VideoDecoder_RenderOutputData" },
{ "name": "OH_VideoDecoder_FreeOutputData" },
{ "name": "OH_VideoDecoder_IsValid" }
{
"first_introduced": "9",
"name": "OH_VideoDecoder_CreateByMime"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_CreateByName"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_Destroy"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_SetCallback"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_SetSurface"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_Configure"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_Prepare"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_Start"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_Stop"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_Flush"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_Reset"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_GetOutputDescription"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_SetParameter"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_PushInputData"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_RenderOutputData"
},
{
"first_introduced": "9",
"name": "OH_VideoDecoder_FreeOutputData"
},
{
"first_introduced": "10",
"name": "OH_VideoDecoder_IsValid"
},
{
"first_introduced": "11",
"name": "OH_VideoDecoder_RegisterCallback"
},
{
"first_introduced": "11",
"name": "OH_VideoDecoder_PushInputBuffer"
},
{
"first_introduced": "11",
"name": "OH_VideoDecoder_FreeOutputBuffer"
},
{
"first_introduced": "11",
"name": "OH_VideoDecoder_RenderOutputBuffer"
}
]

View File

@ -15,8 +15,7 @@ import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_venc_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources =
[ "//interface/sdk_c/multimedia/av_codec/native_avcodec_videoencoder.h" ]
sources = [ "../native_avcodec_videoencoder.h" ]
}
ohos_ndk_library("libnative_media_venc") {

View File

@ -1,20 +1,86 @@
[
{ "name": "OH_VideoEncoder_CreateByMime" },
{ "name": "OH_VideoEncoder_CreateByName" },
{ "name": "OH_VideoEncoder_Destroy" },
{ "name": "OH_VideoEncoder_SetCallback" },
{ "name": "OH_VideoEncoder_Configure" },
{ "name": "OH_VideoEncoder_Prepare" },
{ "name": "OH_VideoEncoder_Start" },
{ "name": "OH_VideoEncoder_Stop" },
{ "name": "OH_VideoEncoder_Flush" },
{ "name": "OH_VideoEncoder_Reset" },
{ "name": "OH_VideoEncoder_GetOutputDescription" },
{ "name": "OH_VideoEncoder_SetParameter" },
{ "name": "OH_VideoEncoder_GetSurface" },
{ "name": "OH_VideoEncoder_FreeOutputData" },
{ "name": "OH_VideoEncoder_NotifyEndOfStream" },
{ "name": "OH_VideoEncoder_PushInputData" },
{ "name": "OH_VideoEncoder_GetInputDescription" },
{ "name": "OH_VideoEncoder_IsValid" }
{
"first_introduced": "9",
"name": "OH_VideoEncoder_CreateByMime"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_CreateByName"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_Destroy"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_SetCallback"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_Configure"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_Prepare"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_Start"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_Stop"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_Flush"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_Reset"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_GetOutputDescription"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_SetParameter"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_GetSurface"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_FreeOutputData"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_NotifyEndOfStream"
},
{
"first_introduced": "9",
"name": "OH_VideoEncoder_PushInputData"
},
{
"first_introduced": "10",
"name": "OH_VideoEncoder_GetInputDescription"
},
{
"first_introduced": "10",
"name": "OH_VideoEncoder_IsValid"
},
{
"first_introduced": "11",
"name": "OH_VideoEncoder_RegisterCallback"
},
{
"first_introduced": "11",
"name": "OH_VideoEncoder_PushInputBuffer"
},
{
"first_introduced": "11",
"name": "OH_VideoEncoder_FreeOutputBuffer"
}
]

View File

@ -13,15 +13,23 @@
import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_ndk_headers("native_media_core_header") {
dest_dir = "$ndk_headers_out_dir/multimedia/player_framework"
sources = [
"//interface/sdk_c/multimedia/av_codec/native_averrors.h",
"//interface/sdk_c/multimedia/av_codec/native_avformat.h",
"//interface/sdk_c/multimedia/av_codec/native_avmemory.h",
"../native_avbuffer.h",
"../native_avbuffer_info.h",
"../native_averrors.h",
"../native_avformat.h",
"../native_avmemory.h",
]
}
ohos_ndk_headers("native_media_core_common_header") {
dest_dir = "$ndk_headers_out_dir/multimedia"
sources = [ "../native_audio_channel_layout.h" ]
}
ohos_ndk_library("libnative_media_core") {
ndk_description_file = "./libnative_media_core.ndk.json"
min_compact_version = "1"
@ -30,8 +38,11 @@ ohos_ndk_library("libnative_media_core") {
system_capability = "SystemCapability.Multimedia.Media.Core"
system_capability_headers = [
"multimedia/player_framework/native_avbuffer.h",
"multimedia/player_framework/native_avbuffer_info.h",
"multimedia/player_framework/native_averrors.h",
"multimedia/player_framework/native_avformat.h",
"multimedia/player_framework/native_avmemory.h",
"multimedia/player_framework/native_audio_channel_layout.h",
]
}

View File

@ -21,6 +21,13 @@
{ "name": "OH_AVMemory_GetAddr" },
{ "name": "OH_AVMemory_GetSize" },
{ "name": "OH_AVMemory_Destroy" },
{ "name": "OH_AVCodec_GetCapability" },
{ "name": "OH_AVCodec_GetCapabilityByCategory" }
{ "name": "OH_AVBuffer_Create" },
{ "name": "OH_AVBuffer_Destroy" },
{ "name": "OH_AVBuffer_GetBufferAttr" },
{ "name": "OH_AVBuffer_SetBufferAttr" },
{ "name": "OH_AVBuffer_GetParameter" },
{ "name": "OH_AVBuffer_SetParameter" },
{ "name": "OH_AVBuffer_GetAddr" },
{ "name": "OH_AVBuffer_GetCapacity" },
{ "name": "OH_AVBuffer_GetNativeBuffer" }
]

View File

@ -0,0 +1,350 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup MediaFoundation
* @{
*
* @brief Provides APIs for media foundation.
*
* @since 11
*/
/**
* @file native_audio_channel_layout.h
*
* @brief The channel layout indicates the appearance and order of the speakers for recording or playback.
*
* @library NA
* @syscap SystemCapability.Multimedia.Media.Core
* @since 11
*/
#ifndef NATIVE_AUDIO_CHANNEL_LAYOUT_H
#define NATIVE_AUDIO_CHANNEL_LAYOUT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Audio Channel Set
*
* A 64-bit integer with bits set for each channel.
* @syscap SystemCapability.Multimedia.Media.Core
* @since 11
*/
typedef enum OH_AudioChannelSet {
/** Channel set For FRONT-LEFT position */
CH_SET_FRONT_LEFT = 1ULL << 0U,
/** Channel set For FRONT_RIGHT position */
CH_SET_FRONT_RIGHT = 1ULL << 1U,
/** Channel set For FRONT_CENTER position */
CH_SET_FRONT_CENTER = 1ULL << 2U,
/** Channel set For LOW_FREQUENCY position */
CH_SET_LOW_FREQUENCY = 1ULL << 3U,
/** Channel set For BACK_LEFT position */
CH_SET_BACK_LEFT = 1ULL << 4U,
/** Channel set For BACK_RIGHT position */
CH_SET_BACK_RIGHT = 1ULL << 5U,
/** Channel set For FRONT_LEFT_OF_CENTER position */
CH_SET_FRONT_LEFT_OF_CENTER = 1ULL << 6U,
/** Channel set For FRONT_RIGHT_OF_CENTER position */
CH_SET_FRONT_RIGHT_OF_CENTER = 1ULL << 7U,
/** Channel set For BACK_CENTER position */
CH_SET_BACK_CENTER = 1ULL << 8U,
/** Channel set For SIDE_LEFT position */
CH_SET_SIDE_LEFT = 1ULL << 9U,
/** Channel set For SIDE_RIGHT position */
CH_SET_SIDE_RIGHT = 1ULL << 10U,
/** Channel set For TOP_CENTER position */
CH_SET_TOP_CENTER = 1ULL << 11U,
/** Channel set For TOP_FRONT_LEFT position */
CH_SET_TOP_FRONT_LEFT = 1ULL << 12U,
/** Channel set For TOP_FRONT_CENTER position */
CH_SET_TOP_FRONT_CENTER = 1ULL << 13U,
/** Channel set For TOP_FRONT_RIGHT position */
CH_SET_TOP_FRONT_RIGHT = 1ULL << 14U,
/** Channel set For TOP_BACK_LEFT position */
CH_SET_TOP_BACK_LEFT = 1ULL << 15U,
/** Channel set For TOP_BACK_CENTER position */
CH_SET_TOP_BACK_CENTER = 1ULL << 16U,
/** Channel set For TOP_BACK_RIGHT position */
CH_SET_TOP_BACK_RIGHT = 1ULL << 17U,
/** Channel set For STEREO_LEFT position */
CH_SET_STEREO_LEFT = 1ULL << 29U,
/** Channel set For STEREO_RIGHT position */
CH_SET_STEREO_RIGHT = 1ULL << 30U,
/** Channel set For WIDE_LEFT position */
CH_SET_WIDE_LEFT = 1ULL << 31U,
/** Channel set For WIDE_RIGHT position */
CH_SET_WIDE_RIGHT = 1ULL << 32U,
/** Channel set For SURROUND_DIRECT_LEFT position */
CH_SET_SURROUND_DIRECT_LEFT = 1ULL << 33U,
/** Channel set For SURROUND_DIRECT_RIGHT position */
CH_SET_SURROUND_DIRECT_RIGHT = 1ULL << 34U,
/** Channel set For LOW_FREQUENCY_2 position */
CH_SET_LOW_FREQUENCY_2 = 1ULL << 35U,
/** Channel set For TOP_SIDE_LEFT position */
CH_SET_TOP_SIDE_LEFT = 1ULL << 36U,
/** Channel set For TOP_SIDE_RIGHT position */
CH_SET_TOP_SIDE_RIGHT = 1ULL << 37U,
/** Channel set For BOTTOM_FRONT_CENTER position */
CH_SET_BOTTOM_FRONT_CENTER = 1ULL << 38U,
/** Channel set For BOTTOM_FRONT_LEFT position */
CH_SET_BOTTOM_FRONT_LEFT = 1ULL << 39U,
/** Channel set For BOTTOM_FRONT_RIGHT position */
CH_SET_BOTTOM_FRONT_RIGHT = 1ULL << 40U
} OH_AudioChannelSet;
/**
* @brief Ambisonic attribute set.
*
* A set of 64-bit integers indicate the ambisonic attributes.
* @syscap SystemCapability.Multimedia.Media.Core
* @since 11
*/
typedef enum OH_AmbAttributeSet {
/** Ambisonic attribute: order 1 */
AMB_ORD_1 = 1ULL << 0U,
/** Ambisonic attribute: order 2 */
AMB_ORD_2 = 2ULL << 0U,
/** Ambisonic attribute: order 3 */
AMB_ORD_3 = 3ULL << 0U,
/** Ambisonic attribute: ACN Component Ordering */
AMB_COM_ACN = 0ULL << 8U,
/** Ambisonic attribute: FUMA Component Ordering */
AMB_COM_FUMA = 1ULL << 8U,
/** Ambisonic attribute: N3D Normalization */
AMB_NOR_N3D = 0ULL << 12U,
/** Ambisonic attribute: SN3D Normalization */
AMB_NOR_SN3D = 1ULL << 12U,
/** Channel layout: Ambisonic mode */
AMB_MODE = 1ULL << 44U
} OH_AmbAttributeSet;
/**
* @brief Audio Channel Layout
*
* A 64-bit integer indicates that the appearance and order of the speakers for recording or playback.
* @syscap SystemCapability.Multimedia.Media.Core
* @since 11
*/
typedef enum OH_AudioChannelLayout {
/** Unknown Channel Layout */
CH_LAYOUT_UNKNOWN = 0ULL,
/** Channel Layout For Mono, 1 channel in total */
CH_LAYOUT_MONO = CH_SET_FRONT_CENTER,
/** Channel Layout For Stereo, 2 channels in total */
CH_LAYOUT_STEREO = CH_SET_FRONT_LEFT | CH_SET_FRONT_RIGHT,
/** Channel Layout For Stereo-Downmix, 2 channels in total */
CH_LAYOUT_STEREO_DOWNMIX = CH_SET_STEREO_LEFT | CH_SET_STEREO_RIGHT,
/** Channel Layout For 2.1, 3 channels in total */
CH_LAYOUT_2POINT1 = CH_LAYOUT_STEREO | CH_SET_LOW_FREQUENCY,
/** Channel Layout For 3.0, 3 channels in total */
CH_LAYOUT_3POINT0 = CH_LAYOUT_STEREO | CH_SET_BACK_CENTER,
/** Channel Layout For Surround, 3 channels in total */
CH_LAYOUT_SURROUND = CH_LAYOUT_STEREO | CH_SET_FRONT_CENTER,
/** Channel Layout For 3.1, 4 channels in total */
CH_LAYOUT_3POINT1 = CH_LAYOUT_SURROUND | CH_SET_LOW_FREQUENCY,
/** Channel Layout For 4.0, 4 channels in total */
CH_LAYOUT_4POINT0 = CH_LAYOUT_SURROUND | CH_SET_BACK_CENTER,
/** Channel Layout For Quad-Side, 4 channels in total */
CH_LAYOUT_QUAD_SIDE = CH_LAYOUT_STEREO | CH_SET_SIDE_LEFT | CH_SET_SIDE_RIGHT,
/** Channel Layout For Quad, 4 channels in total */
CH_LAYOUT_QUAD = CH_LAYOUT_STEREO | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT,
/** Channel Layout For 2.0.2, 4 channels in total */
CH_LAYOUT_2POINT0POINT2 = CH_LAYOUT_STEREO | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT,
/** Channel Layout For ORDER1-ACN-N3D First Order Ambisonic(FOA), 4 channels in total */
CH_LAYOUT_AMB_ORDER1_ACN_N3D = AMB_MODE | AMB_ORD_1 | AMB_COM_ACN | AMB_NOR_N3D,
/** Channel Layout For ORDER1-ACN-SN3D FOA, 4 channels in total */
CH_LAYOUT_AMB_ORDER1_ACN_SN3D = AMB_MODE | AMB_ORD_1 | AMB_COM_ACN | AMB_NOR_SN3D,
/** Channel Layout For ORDER1-FUMA FOA, 4 channels in total */
CH_LAYOUT_AMB_ORDER1_FUMA = AMB_MODE | AMB_ORD_1 | AMB_COM_FUMA,
/** Channel Layout For 4.1, 5 channels in total */
CH_LAYOUT_4POINT1 = CH_LAYOUT_4POINT0 | CH_SET_LOW_FREQUENCY,
/** Channel Layout For 5.0, 5 channels in total */
CH_LAYOUT_5POINT0 = CH_LAYOUT_SURROUND | CH_SET_SIDE_LEFT | CH_SET_SIDE_RIGHT,
/** Channel Layout For 5.0-Back, 5 channels in total */
CH_LAYOUT_5POINT0_BACK = CH_LAYOUT_SURROUND | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT,
/** Channel Layout For 2.1.2, 5 channels in total */
CH_LAYOUT_2POINT1POINT2 = CH_LAYOUT_2POINT0POINT2 | CH_SET_LOW_FREQUENCY,
/** Channel Layout For 3.0.2, 5 channels in total */
CH_LAYOUT_3POINT0POINT2 = CH_LAYOUT_2POINT0POINT2 | CH_SET_FRONT_CENTER,
/** Channel Layout For 5.1, 6 channels in total */
CH_LAYOUT_5POINT1 = CH_LAYOUT_5POINT0 | CH_SET_LOW_FREQUENCY,
/** Channel Layout For 5.1-Back, 6 channels in total */
CH_LAYOUT_5POINT1_BACK = CH_LAYOUT_5POINT0_BACK | CH_SET_LOW_FREQUENCY,
/** Channel Layout For 6.0, 6 channels in total */
CH_LAYOUT_6POINT0 = CH_LAYOUT_5POINT0 | CH_SET_BACK_CENTER,
/** Channel Layout For 3.1.2, 6 channels in total */
CH_LAYOUT_3POINT1POINT2 = CH_LAYOUT_3POINT1 | CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT,
/** Channel Layout For 6.0-Front, 6 channels in total */
CH_LAYOUT_6POINT0_FRONT = CH_LAYOUT_QUAD_SIDE | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER,
/** Channel Layout For Hexagonal, 6 channels in total */
CH_LAYOUT_HEXAGONAL = CH_LAYOUT_5POINT0_BACK | CH_SET_BACK_CENTER,
/** Channel Layout For 6.1, 7 channels in total */
CH_LAYOUT_6POINT1 = CH_LAYOUT_5POINT1 | CH_SET_BACK_CENTER,
/** Channel Layout For 6.1-Back, 7 channels in total */
CH_LAYOUT_6POINT1_BACK = CH_LAYOUT_5POINT1_BACK | CH_SET_BACK_CENTER,
/** Channel Layout For 6.1-Front, 7 channels in total */
CH_LAYOUT_6POINT1_FRONT = CH_LAYOUT_6POINT0_FRONT | CH_SET_LOW_FREQUENCY,
/** Channel Layout For 7.0, 7 channels in total */
CH_LAYOUT_7POINT0 = CH_LAYOUT_5POINT0 | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT,
/** Channel Layout For 7.0-Front, 7 channels in total */
CH_LAYOUT_7POINT0_FRONT = CH_LAYOUT_5POINT0 | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER,
/** Channel Layout For 7.1, 8 channels in total */
CH_LAYOUT_7POINT1 = CH_LAYOUT_5POINT1 | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT,
/** Channel Layout For Octagonal, 8 channels in total */
CH_LAYOUT_OCTAGONAL = CH_LAYOUT_5POINT0 | CH_SET_BACK_LEFT | CH_SET_BACK_CENTER | CH_SET_BACK_RIGHT,
/** Channel Layout For 5.1.2, 8 channels in total */
CH_LAYOUT_5POINT1POINT2 = CH_LAYOUT_5POINT1 | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT,
/** Channel Layout For 7.1-Wide, 8 channels in total */
CH_LAYOUT_7POINT1_WIDE = CH_LAYOUT_5POINT1 | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER,
/** Channel Layout For 7.1-Wide-Back, 8 channels in total */
CH_LAYOUT_7POINT1_WIDE_BACK = CH_LAYOUT_5POINT1_BACK | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER,
/** Channel Layout For ORDER2-ACN-N3D Higher Order Ambisonics(HOA), 9 channels in total */
CH_LAYOUT_AMB_ORDER2_ACN_N3D = AMB_MODE | AMB_ORD_2 | AMB_COM_ACN | AMB_NOR_N3D,
/** Channel Layout For ORDER2-ACN-SN3D HOA, 9 channels in total */
CH_LAYOUT_AMB_ORDER2_ACN_SN3D = AMB_MODE | AMB_ORD_2 | AMB_COM_ACN | AMB_NOR_SN3D,
/** Channel Layout For ORDER2-FUMA HOA, 9 channels in total */
CH_LAYOUT_AMB_ORDER2_FUMA = AMB_MODE | AMB_ORD_2 | AMB_COM_FUMA,
/** Channel Layout For 5.1.4, 10 channels in total */
CH_LAYOUT_5POINT1POINT4 = CH_LAYOUT_5POINT1 | CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT |
CH_SET_TOP_BACK_LEFT | CH_SET_TOP_BACK_RIGHT,
/** Channel Layout For 7.1.2, 10 channels in total */
CH_LAYOUT_7POINT1POINT2 = CH_LAYOUT_7POINT1 | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT,
/** Channel Layout For 7.1.4, 12 channels in total */
CH_LAYOUT_7POINT1POINT4 = CH_LAYOUT_7POINT1 | CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT |
CH_SET_TOP_BACK_LEFT | CH_SET_TOP_BACK_RIGHT,
/** Channel Layout For 10.2, 12 channels in total */
CH_LAYOUT_10POINT2 = CH_SET_FRONT_LEFT | CH_SET_FRONT_RIGHT | CH_SET_FRONT_CENTER | CH_SET_TOP_FRONT_LEFT |
CH_SET_TOP_FRONT_RIGHT | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT | CH_SET_BACK_CENTER |
CH_SET_SIDE_LEFT | CH_SET_SIDE_RIGHT | CH_SET_WIDE_LEFT | CH_SET_WIDE_RIGHT,
/** Channel Layout For 9.1.4, 14 channels in total */
CH_LAYOUT_9POINT1POINT4 = CH_LAYOUT_7POINT1POINT4 | CH_SET_WIDE_LEFT | CH_SET_WIDE_RIGHT,
/** Channel Layout For 9.1.6, 16 channels in total */
CH_LAYOUT_9POINT1POINT6 = CH_LAYOUT_9POINT1POINT4 | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT,
/** Channel Layout For Hexadecagonal, 16 channels in total */
CH_LAYOUT_HEXADECAGONAL = CH_LAYOUT_OCTAGONAL | CH_SET_WIDE_LEFT | CH_SET_WIDE_RIGHT | CH_SET_TOP_BACK_LEFT |
CH_SET_TOP_BACK_RIGHT | CH_SET_TOP_BACK_CENTER | CH_SET_TOP_FRONT_CENTER |
CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT,
/** Channel Layout For ORDER3-ACN-N3D HOA, 16 channels in total */
CH_LAYOUT_AMB_ORDER3_ACN_N3D = AMB_MODE | AMB_ORD_3 | AMB_COM_ACN | AMB_NOR_N3D,
/** Channel Layout For ORDER3-ACN-SN3D HOA, 16 channels in total */
CH_LAYOUT_AMB_ORDER3_ACN_SN3D = AMB_MODE | AMB_ORD_3 | AMB_COM_ACN | AMB_NOR_SN3D,
/** Channel Layout For ORDER3-FUMA HOA, 16 channels in total */
CH_LAYOUT_AMB_ORDER3_FUMA = AMB_MODE | AMB_ORD_3 | AMB_COM_FUMA,
/** Channel Layout For 22.2, 24 channels in total */
CH_LAYOUT_22POINT2 = CH_LAYOUT_7POINT1POINT4 | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER |
CH_SET_BACK_CENTER | CH_SET_TOP_CENTER | CH_SET_TOP_FRONT_CENTER | CH_SET_TOP_BACK_CENTER |
CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT | CH_SET_BOTTOM_FRONT_LEFT |
CH_SET_BOTTOM_FRONT_RIGHT | CH_SET_BOTTOM_FRONT_CENTER | CH_SET_LOW_FREQUENCY_2
} OH_AudioChannelLayout;
#ifdef __cplusplus
}
#endif
#endif // NATIVE_AUDIO_CHANNEL_LAYOUT_H
/** @} */

View File

@ -0,0 +1,130 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NATIVE_AVBUFFER_H
#define NATIVE_AVBUFFER_H
#include <stdint.h>
#include <stdio.h>
#include "native_averrors.h"
#include "native_avformat.h"
#include "native_avbuffer_info.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OH_AVBuffer OH_AVBuffer;
typedef struct OH_NativeBuffer OH_NativeBuffer;
/**
* @brief 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 {@link OH_AVBuffer_Destroy}.
* @syscap SystemCapability.Multimedia.Media.Core
* @param capacity the buffer's capacity, bytes
* @return Returns a pointer to an OH_AVBuffer instance if the execution is successful, otherwise returns nullptr
* @since 11
*/
OH_AVBuffer *OH_AVBuffer_Create(int32_t capacity);
/**
* @brief Clear the internal resources of the buffer and destroy the buffer instance.
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to
* {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AVBuffer_Destroy(OH_AVBuffer *buffer);
/**
* @brief Get the buffer's attribute.
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to
* {@link OH_AVCodecBufferAttr}
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to
* {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AVBuffer_GetBufferAttr(OH_AVBuffer *buffer, OH_AVCodecBufferAttr *attr);
/**
* @brief Set the buffer's attribute.
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to
* {@link OH_AVCodecBufferAttr}
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to
* {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, const OH_AVCodecBufferAttr *attr);
/**
* @brief 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 {@link OH_AVFormat_Destroy}.
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @return Returns Encapsulate OH_AVFormat structure instance pointer if the execution is successful,
* otherwise returns nullptr
* @since 11
*/
OH_AVFormat *OH_AVBuffer_GetParameter(OH_AVBuffer *buffer);
/**
* @brief Set the buffer's parameter.
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @param format Encapsulate OH_AVFormat structure instance pointer
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to
* {@link OH_AVErrCode}
* @since 11
*/
OH_AVErrCode OH_AVBuffer_SetParameter(OH_AVBuffer *buffer, const OH_AVFormat *format);
/**
* @brief Get the buffer's virtual address.
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @return the buffer's virtual address if the buffer is valid, otherwise nullptr
* @since 11
*/
uint8_t *OH_AVBuffer_GetAddr(OH_AVBuffer *buffer);
/**
* @brief Get the buffer's capacity
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @return the buffer's capacity if the buffer is valid, otherwise -1
* @since 11
*/
int32_t OH_AVBuffer_GetCapacity(OH_AVBuffer *buffer);
/**
* @brief 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 {@link OH_NativeBuffer_Unreference}.
* @syscap SystemCapability.Multimedia.Media.Core
* @param buffer Encapsulate OH_AVBuffer structure instance pointer
* @return Returns Encapsulate OH_NativeBuffer structure instance pointer is successful,
* otherwise returns nullptr
* @since 11
*/
OH_NativeBuffer *OH_AVBuffer_GetNativeBuffer(OH_AVBuffer *buffer);
#ifdef __cplusplus
}
#endif
#endif // NATIVE_AVBUFFER_H

View File

@ -0,0 +1,62 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NATIVE_AVBUFFER_INFO_H
#define NATIVE_AVBUFFER_INFO_H
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Enumerate the categories of OH_AVCodec's Buffer tags
* @syscap SystemCapability.Multimedia.Media.Core
* @since 9
*/
typedef enum OH_AVCodecBufferFlags {
AVCODEC_BUFFER_FLAGS_NONE = 0,
/* Indicates that the Buffer is an End-of-Stream frame */
AVCODEC_BUFFER_FLAGS_EOS = 1 << 0,
/* Indicates that the Buffer contains keyframes */
AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 << 1,
/* Indicates that the data contained in the Buffer is only part of a frame */
AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2,
/* Indicates that the Buffer contains Codec-Specific-Data */
AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3,
} OH_AVCodecBufferFlags;
/**
* @brief Define the Buffer description information of OH_AVCodec
* @syscap SystemCapability.Multimedia.Media.Core
* @since 9
*/
typedef struct OH_AVCodecBufferAttr {
/* Presentation timestamp of this Buffer in microseconds */
int64_t pts;
/* The size of the data contained in the Buffer in bytes */
int32_t size;
/* The starting offset of valid data in this Buffer */
int32_t offset;
/* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */
uint32_t flags;
} OH_AVCodecBufferAttr;
#ifdef __cplusplus
}
#endif
#endif // NATIVE_AVBUFFER_INFO_H

View File

@ -30,6 +30,8 @@ typedef struct OH_AVMemory OH_AVMemory;
* @syscap SystemCapability.Multimedia.Media.Core
* @param size the memory's size, bytes.
* @return Returns a pointer to an OH_AVMemory instance, needs to be freed by OH_AVMemory_Destroy.
* @deprecated since 11
* @useinstead OH_AVBuffer_Create
* @since 10
*/
OH_AVMemory *OH_AVMemory_Create(int32_t size);
@ -39,6 +41,8 @@ OH_AVMemory *OH_AVMemory_Create(int32_t size);
* @syscap SystemCapability.Multimedia.Media.Core
* @param mem Encapsulate OH_AVMemory structure instance pointer
* @return the memory's virtual address if the memory is valid, otherwise nullptr.
* @deprecated since 11
* @useinstead OH_AVBuffer_GetAddr
* @since 9
* @version 1.0
*/
@ -49,17 +53,22 @@ uint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem);
* @syscap SystemCapability.Multimedia.Media.Core
* @param mem Encapsulate OH_AVMemory structure instance pointer
* @return the memory's size if the memory is valid, otherwise -1.
* @deprecated since 11
* @useinstead OH_AVBuffer_GetCapacity
* @since 9
* @version 1.0
*/
int32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem);
/**
* @brief Clear the internal resources of the memory and destroy the memory instance
* @brief Clear the internal resources of the memory and destroy the memory
* instance
* @syscap SystemCapability.Multimedia.Media.Core
* @param mem Encapsulate OH_AVMemory structure instance pointer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @deprecated since 11
* @useinstead OH_AVBuffer_Destroy
* @since 10
*/
OH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem);

View File

@ -146,6 +146,10 @@ typedef enum AVPlayerOnInfoType {
AV_INFO_TYPE_TRACK_INFO_UPDATE = 15,
/* return the subtitle of playback. */
AV_INFO_TYPE_SUBTITLE_UPDATE = 16,
/** Return the reason when the audio output device changes. When this info is reported, the extra param of
* {@link OH_AVPlayerOnInfo} is the same as {@OH_AudioStream_DeviceChangeReason} in audio framework.
*/
AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17,
} AVPlayerOnInfoType;
/**

View File

@ -14,7 +14,7 @@
import("//build/ohos.gni")
ohos_ndk_headers("ndk_vibrator_header") {
dest_dir = "$ndk_headers_out_dir/sensors/miscdevice/vibrator"
dest_dir = "$ndk_headers_out_dir/sensors"
sources = [
"./include/vibrator.h",
"./include/vibrator_type.h",

View File

@ -277,35 +277,35 @@ typedef struct Sensor_Event Sensor_Event;
/**
* @brief Obtains the sensor type.
*
* @param Sensor_Event - Pointer to the sensor data information.
* @param sensorEvent - Pointer to the sensor data information.
* @param sensorType - Pointer to the sensor type.
* @return Returns <b>SENSOR_SUCCESS</b> if the operation is successful;
* returns an error code defined in {@link Sensor_Result} otherwise.
* @since 11
*/
int32_t OH_SensorEvent_GetType(Sensor_Event* Sensor_Event, Sensor_Type *sensorType);
int32_t OH_SensorEvent_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorType);
/**
* @brief Obtains the timestamp of sensor data.
*
* @param Sensor_Event - Pointer to the sensor data information.
* @param sensorEvent - Pointer to the sensor data information.
* @param timestamp - Pointer to the timestamp.
* @return Returns <b>SENSOR_SUCCESS</b> if the operation is successful;
* returns an error code defined in {@link Sensor_Result} otherwise.
* @since 11
*/
int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* Sensor_Event, int64_t *timestamp);
int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestamp);
/**
* @brief Obtains the accuracy of sensor data.
*
* @param Sensor_Event - Pointer to the sensor data information.
* @param sensorEvent - Pointer to the sensor data information.
* @param accuracy - Pointer to the accuracy.
* @return Returns <b>SENSOR_SUCCESS</b> if the operation is successful;
* returns an error code defined in {@link Sensor_Result} otherwise.
* @since 11
*/
int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* Sensor_Event, Sensor_Accuracy *accuracy);
int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy);
/**
* @brief Obtains sensor data. The data length and content depend on the sensor type.
@ -333,14 +333,14 @@ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* Sensor_Event, Sensor_Accuracy *
* SENSOR_TYPE_PEDOMETER: data[0], indicating the number of steps a user has walked.
* SENSOR_TYPE_HEART_RATE: data[0], indicating the heart rate value.
*
* @param Sensor_Event - Pointer to the sensor data information.
* @param sensorEvent - Pointer to the sensor data information.
* @param data - Double pointer to the sensor data.
* @param length - Pointer to the array length.
* @return Returns <b>SENSOR_SUCCESS</b> if the operation is successful;
* returns an error code defined in {@link Sensor_Result} otherwise.
* @since 11
*/
int32_t OH_SensorEvent_GetData(Sensor_Event* Sensor_Event, float **data, uint32_t *length);
int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length);
/**
* @brief Defines the sensor subscription ID, which uniquely identifies a sensor.
@ -371,7 +371,7 @@ int32_t OH_Sensor_DestroySubscriptionId(Sensor_SubscriptionId *id);
* @brief Obtains the sensor type.
*
* @param id - Pointer to the sensor subscription ID.
* @param id - Pointer to the sensor type.
* @param sensorType - Pointer to the sensor type.
* @return Returns <b>SENSOR_SUCCESS</b> if the operation is successful;
* returns an error code defined in {@link Sensor_Result} otherwise.
* @since 11