Skip to content

Commit

Permalink
Preparing in prevision of the audio stream handling
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Jun 10, 2024
1 parent 6b2400c commit 3ab6fd8
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 28 deletions.
7 changes: 4 additions & 3 deletions src/hal/hisi/v3_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ v3_vi_impl v3_vi;
v3_vpss_impl v3_vpss;

hal_chnstate v3_state[V3_VENC_CHN_NUM] = {0};
int (*v3_aud_cb)(hal_audframe*);
int (*v3_venc_cb)(char, hal_vidstream*);

char _v3_aud_chn = 0;
Expand Down Expand Up @@ -80,9 +81,9 @@ int v3_audio_init(void)
config.intf = V3_AUD_INTF_I2S_SLAVE;
config.stereoOn = 0;
config.expandOn = 0;
config.frmNum = 0;
config.packNumPerFrm = 0;
config.chnNum = 0;
config.frmNum = 40;
config.packNumPerFrm = 640;
config.chnNum = 1;
config.syncRxClkOn = 0;
if (ret = v3_aud.fnSetDeviceConfig(_v3_aud_dev, &config))
return ret;
Expand Down
1 change: 1 addition & 0 deletions src/hal/hisi/v3_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
extern char keepRunning;

extern hal_chnstate v3_state[V3_VENC_CHN_NUM];
extern int (*v3_aud_cb)(hal_audframe*);
extern int (*v3_venc_cb)(char, hal_vidstream*);

void v3_hal_deinit(void);
Expand Down
7 changes: 4 additions & 3 deletions src/hal/hisi/v4_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ v4_vi_impl v4_vi;
v4_vpss_impl v4_vpss;

hal_chnstate v4_state[V4_VENC_CHN_NUM] = {0};
int (*v4_aud_cb)(hal_audframe*);
int (*v4_venc_cb)(char, hal_vidstream*);

char _v4_aud_chn = 0;
Expand Down Expand Up @@ -81,9 +82,9 @@ int v4_audio_init(void)
config.intf = V4_AUD_INTF_I2S_SLAVE;
config.stereoOn = 0;
config.expandOn = 0;
config.frmNum = 0;
config.packNumPerFrm = 0;
config.chnNum = 0;
config.frmNum = 40;
config.packNumPerFrm = 640;
config.chnNum = 1;
config.syncRxClkOn = 0;
if (ret = v4_aud.fnSetDeviceConfig(_v4_aud_dev, &config))
return ret;
Expand Down
1 change: 1 addition & 0 deletions src/hal/hisi/v4_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
extern char keepRunning;

extern hal_chnstate v4_state[V4_VENC_CHN_NUM];
extern int (*v4_aud_cb)(hal_audframe*);
extern int (*v4_venc_cb)(char, hal_vidstream*);

void v4_hal_deinit(void);
Expand Down
7 changes: 4 additions & 3 deletions src/hal/inge/t31_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ t31_sys_impl t31_sys;
t31_venc_impl t31_venc;

hal_chnstate t31_state[T31_VENC_CHN_NUM] = {0};
int (*t31_aud_cb)(hal_audframe*);
int (*t31_venc_cb)(char, hal_vidstream*);

t31_isp_snr _t31_isp_snr;
Expand Down Expand Up @@ -63,9 +64,9 @@ int t31_audio_init(void)
config.rate = 48000;
config.bit = T31_AUD_BIT_16;
config.mode = T31_AUD_SND_MONO;
config.frmNum = 0;
config.packNumPerFrm = 0;
config.chnNum = 0;
config.frmNum = 40;
config.packNumPerFrm = 640;
config.chnNum = 1;
if (ret = t31_aud.fnSetDeviceConfig(_t31_aud_dev, &config))
return ret;
}
Expand Down
1 change: 1 addition & 0 deletions src/hal/inge/t31_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
extern char keepRunning;

extern hal_chnstate t31_state[T31_VENC_CHN_NUM];
extern int (*t31_aud_cb)(hal_audframe*);
extern int (*t31_venc_cb)(char, hal_vidstream*);

void t31_hal_deinit(void);
Expand Down
9 changes: 5 additions & 4 deletions src/hal/sstar/i6_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ i6_vif_impl i6_vif;
i6_vpe_impl i6_vpe;

hal_chnstate i6_state[I6_VENC_CHN_NUM] = {0};
int (*i6_aud_cb)(hal_audframe*);
int (*i6_venc_cb)(char, hal_vidstream*);

i6_snr_pad _i6_snr_pad;
Expand Down Expand Up @@ -80,10 +81,10 @@ int i6_audio_init(void)
config.bit24On = 0;
config.intf = I6_AUD_INTF_I2S_SLAVE;
config.sound = I6_AUD_SND_MONO;
config.frmNum = 0;
config.packNumPerFrm = 0;
config.codecChnNum = 0;
config.chnNum = 0;
config.frmNum = 40;
config.packNumPerFrm = 640;
config.codecChnNum = 1;
config.chnNum = 1;
config.i2s.clock = I6_AUD_CLK_OFF;
config.i2s.leftJustOn = 0;
config.i2s.syncRxClkOn = 0;
Expand Down
1 change: 1 addition & 0 deletions src/hal/sstar/i6_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

extern char keepRunning;

extern int (*i6_aud_cb)(hal_audframe*);
extern int (*i6_venc_cb)(char, hal_vidstream*);

void i6_hal_deinit(void);
Expand Down
5 changes: 3 additions & 2 deletions src/hal/sstar/i6c_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ i6c_venc_impl i6c_venc;
i6c_vif_impl i6c_vif;

hal_chnstate i6c_state[I6C_VENC_CHN_NUM] = {0};
int (*i6c_aud_cb)(hal_audframe*);
int (*i6c_venc_cb)(char, hal_vidstream*);

i6c_snr_pad _i6c_snr_pad;
Expand Down Expand Up @@ -78,7 +79,7 @@ int i6c_audio_init(void)
{
i6c_aud_cnf config;
config.reserved = 0;
config.sound = I6C_AUD_SND_STEREO;
config.sound = I6C_AUD_SND_MONO;
config.rate = 48000;
config.periodSize = 0x600;
config.interleavedOn = 1;
Expand All @@ -94,7 +95,7 @@ int i6c_audio_init(void)
config.rate = 48000;
config.clock = I6C_AUD_CLK_OFF;
config.syncRxClkOn = 1;
config.tdmSlotNum = 2;
config.tdmSlotNum = 1;
if (ret = i6c_aud.fnSetI2SConfig(input, &config))
return ret;
if (ret = i6c_aud.fnAttachToDevice(_i6c_aud_dev, &input, 1))
Expand Down
1 change: 1 addition & 0 deletions src/hal/sstar/i6c_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

extern char keepRunning;

extern int (*i6c_aud_cb)(hal_audframe*);
extern int (*i6c_venc_cb)(char, hal_vidstream*);

void i6c_hal_deinit(void);
Expand Down
13 changes: 7 additions & 6 deletions src/hal/sstar/i6f_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ i6f_venc_impl i6f_venc;
i6f_vif_impl i6f_vif;

hal_chnstate i6f_state[I6F_VENC_CHN_NUM] = {0};
int (*i6f_aud_cb)(hal_audframe*);
int (*i6f_venc_cb)(char, hal_vidstream*);

i6f_snr_pad _i6f_snr_pad;
Expand Down Expand Up @@ -81,15 +82,15 @@ int i6f_audio_init(void)
config.rate = 48000;
config.bit = I6F_AUD_BIT_16;
config.intf = I6F_AUD_INTF_I2S_SLAVE;
config.sound = I6F_AUD_SND_STEREO;
config.frmNum = 0;
config.packNumPerFrm = 0;
config.codecChnNum = 0;
config.chnNum = 0;
config.sound = I6F_AUD_SND_MONO;
config.frmNum = 40;
config.packNumPerFrm = 640;
config.codecChnNum = 1;
config.chnNum = 1;
config.i2s.clock = I6F_AUD_CLK_OFF;
config.i2s.leftJustOn = 0;
config.i2s.syncRxClkOn = 1;
config.i2s.tdmSlotNum = 2;
config.i2s.tdmSlotNum = 1;
config.i2s.bit = I6F_AUD_BIT_32;
if (ret = i6f_aud.fnSetDeviceConfig(_i6f_aud_dev, &config))
return ret;
Expand Down
1 change: 1 addition & 0 deletions src/hal/sstar/i6f_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

extern char keepRunning;

extern int (*i6f_aud_cb)(hal_audframe*);
extern int (*i6f_venc_cb)(char, hal_vidstream*);

void i6f_hal_deinit(void);
Expand Down
9 changes: 9 additions & 0 deletions src/hal/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ typedef enum {
HAL_VIDPROFILE_HIGH
} hal_vidprofile;

typedef struct {
unsigned char *data[8];
unsigned int length[8];
unsigned int seq;
unsigned int timestamp;
char channelCnt;
char interleavedOn;
} hal_audframe;

typedef struct {
int fileDesc;
char enable;
Expand Down
14 changes: 7 additions & 7 deletions src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pthread_mutex_t mutex;
pthread_t ispPid = 0;
pthread_t vencPid = 0;

int save_stream(char index, hal_vidstream *stream) {
int save_video_stream(char index, hal_vidstream *stream) {
int ret;

switch (chnState[index].payload) {
Expand Down Expand Up @@ -178,12 +178,12 @@ int start_sdk() {
}

switch (plat) {
case HAL_PLATFORM_I6: i6_venc_cb = save_stream; break;
case HAL_PLATFORM_I6C: i6c_venc_cb = save_stream; break;
case HAL_PLATFORM_I6F: i6f_venc_cb = save_stream; break;
case HAL_PLATFORM_V3: v3_venc_cb = save_stream; break;
case HAL_PLATFORM_V4: v4_venc_cb = save_stream; break;
case HAL_PLATFORM_T31: t31_venc_cb = save_stream; break;
case HAL_PLATFORM_I6: i6_venc_cb = save_video_stream; break;
case HAL_PLATFORM_I6C: i6c_venc_cb = save_video_stream; break;
case HAL_PLATFORM_I6F: i6f_venc_cb = save_video_stream; break;
case HAL_PLATFORM_V3: v3_venc_cb = save_video_stream; break;
case HAL_PLATFORM_V4: v4_venc_cb = save_video_stream; break;
case HAL_PLATFORM_T31: t31_venc_cb = save_video_stream; break;
}

switch (plat) {
Expand Down

0 comments on commit 3ab6fd8

Please sign in to comment.