This commit is contained in:
刘可亮
2025-07-22 11:15:46 +08:00
parent d164b333ed
commit 11c97ef399
2870 changed files with 951307 additions and 26675 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -106,6 +106,20 @@ static mm_callback component_event_callbacks = {
.giveback_buffer = component_giveback_buffer,
};
static s32 _set_vin_type(enum aic_recorder_vin_type type)
{
if (type == AIC_RECORDER_VIN_DVP) {
return MM_VIDEO_IN_SOURCE_DVP;
} else if (type == AIC_RECORDER_VIN_USB) {
return MM_VIDEO_IN_SOURCE_USB;
} else if (type == AIC_RECORDER_VIN_FILE) {
return MM_VIDEO_IN_SOURCE_FILE;
}
return MM_VIDEO_IN_SOURCE_UNKNOWN;
}
struct aic_recorder *aic_recorder_create(void)
{
s32 error;
@@ -259,6 +273,7 @@ s32 aic_recorder_init(struct aic_recorder *recorder,
port_define.format.video.frame_height = recorder->config.video_config.out_height;
port_define.format.video.framerate = recorder->config.video_config.out_frame_rate;
port_define.format.video.color_format = MM_COLOR_FORMAT_YUV420P;
port_define.format.video.vin_type = _set_vin_type(recorder->config.video_config.vin_type);
if (MM_ERROR_NONE != mm_set_parameter(recorder->vin_handle,
MM_INDEX_PARAM_PORT_DEFINITION,
&port_define)) {
@@ -447,25 +462,6 @@ s32 aic_recorder_set_input_file_path(struct aic_recorder *recorder, char *video_
}
s32 aic_recorder_set_vin_type(struct aic_recorder *recorder, enum aic_recorder_vin_type type)
{
if (!recorder || !recorder->vin_handle) {
loge("recorder or vin_handle is null\n");
return -1;
}
mm_param_u32 param;
if (type == AIC_RECORDER_VIN_DVP) {
param.u32 = MM_VIDEO_IN_SOURCE_DVP;
} else if (type == AIC_RECORDER_VIN_USB) {
param.u32 = MM_VIDEO_IN_SOURCE_USB;
} else {
param.u32 = MM_VIDEO_IN_SOURCE_FILE;
}
return mm_set_parameter(recorder->vin_handle, MM_INDEX_PARAM_VIDEO_INPUT_SOURCE, (void *)&param);
}
s32 aic_recorder_set_max_duration(struct aic_recorder *recorder)
{
return 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -19,8 +19,15 @@ extern "C" {
struct aic_recorder;
enum aic_recorder_vin_type {
AIC_RECORDER_VIN_FILE = 0,
AIC_RECORDER_VIN_DVP,
AIC_RECORDER_VIN_USB,
};
struct video_encoding_config {
enum mpp_codec_type codec_type;
enum aic_recorder_vin_type vin_type;
s32 out_width;
s32 out_height;
s32 out_bit_rate;
@@ -67,11 +74,6 @@ enum aic_recorder_event {
AIC_RECORDER_EVENT_RELEASE_VIDEO_BUFFER // notify app input_frame has used.
};
enum aic_recorder_vin_type {
AIC_RECORDER_VIN_FILE = 0,
AIC_RECORDER_VIN_DVP,
AIC_RECORDER_VIN_USB,
};
typedef s32 (*event_handler)(void *app_data, s32 event, s32 data1, s32 data2);
@@ -93,8 +95,6 @@ s32 aic_recorder_stop(struct aic_recorder *recorder);
s32 aic_recorder_snapshot(struct aic_recorder *recorder, struct aic_record_snapshot_info *snapshot_info);
s32 aic_recorder_set_vin_type(struct aic_recorder *recorder, enum aic_recorder_vin_type type);
s32 aic_recorder_print_debug_info(struct aic_recorder *recorder);
#ifdef __cplusplus

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -33,7 +33,7 @@
#define RECORDER_DEMO_DEFAULT_RECORD_TIME 0x7FFFFFFF
/*You can only choose thread trace or cpu trace*/
#define RECORD_THREAD_TRACE_INFO
//#define RECORD_THREAD_TRACE_INFO
//#define RECORD_CPU_TRACE_INFO
@@ -435,6 +435,7 @@ static void *test_recorder_thread(void *arg)
clock_gettime(CLOCK_REALTIME, &cur_time);
if (recorder_cxt->record_time <= (cur_time.tv_sec - start_time.tv_sec)) {
g_recorder_flag = 1;
printf("recorder end time coming, stop recorder.\n");
break;
}
show_cpu_usage();
@@ -503,13 +504,12 @@ int recorder_demo_test(int argc, char *argv[])
loge("aic_recorder_set_event_callback error");
goto _EXIT;
}
recorder_cxt->config.video_config.vin_type = recorder_cxt->vin_source_type;
if (aic_recorder_init(recorder_cxt->recorder, &recorder_cxt->config)) {
loge("aic_recorder_init error");
goto _EXIT;
}
aic_recorder_set_vin_type(recorder_cxt->recorder, recorder_cxt->vin_source_type);
aic_recorder_set_input_file_path(recorder_cxt->recorder, recorder_cxt->video_in_file_path, NULL);
if (aic_recorder_start(recorder_cxt->recorder)) {

View File

@@ -10,12 +10,12 @@
{
"enable":1,
"codec_type":4097,
"out_width":320,
"out_height":240,
"out_width":640,
"out_height":480,
"out_framerate":25,
"out_bitrate":1300,
"in_width":320,
"in_height":240,
"in_width":640,
"in_height":480,
"in_pix_format":32
},
"audio":