📄 pthread_live.c
字号:
video_mode = gp_state_thread->state_main.mode; gp_state_thread->state_live.mode_mon = mode; sp_live_object->cur_mode = mode; rec_mode = gp_state_thread->state_dec.play_file[23]; /* disable zoom */ tw2834_write_reg(TW2834_PAGE1, 0x0C, 0x30); if(mode == L_1CH_PB || mode == L_4CH_PB) { /* From L_1CH_PB to L_4CH_PB or From L_4CH_PB to L_1CH_PB, ch osd text keep */ if(last_ch_mode != mode) { playback_cur_ch--; playback_cur_ch %= 5; } update_display(mode); /* ID : Channel ID, default is 0 * This value is valid only if decodng standard is 0 or 1 */ audio_decode_channel_id(playback_cur_ch%4); } switch(mode) { case L_CH1: case L_CH2: case L_CH3: case L_CH4: case L_1CH_PB: offset = mode - 1; if(mode == L_1CH_PB) { offset = 3; tw2834_write_reg(TW2834_PAGE0, 0x38, 0x08); }else tw2834_write_reg(TW2834_PAGE0, 0x38, 0x00); //vscale [15:8] for x-path tw2834_write_reg(TW2834_PAGE0, 0x18 + 0x40*offset, 0xff); //hscale [15:8] for x-path tw2834_write_reg(TW2834_PAGE0, 0x1c + 0x40*offset, 0xff); // left offset// 2005.10.21 pentamicro // move to 2 pixel to right in case of channel 1, 3 tw2834_write_reg(TW2834_PAGE1, 0x30 + 0x04*offset, 1); // right offset tw2834_write_reg(TW2834_PAGE1, 0x31 + 0x04*offset, 180); // top offset tw2834_write_reg(TW2834_PAGE1, 0x32 + 0x04*offset, 0); // bottom offset tw2834_write_reg(TW2834_PAGE1, 0x33 + 0x04*offset, video_mode == NTSC ? 120 : 144); if(mode == L_1CH_PB) /* change live audio to decoding state */ set_live_audio_ch(4); else /* live audio set */ set_live_audio_ch(offset); for(ii=0; ii<4; ii++) { if(ii == offset) // ch enable tw2834_write_reg(TW2834_PAGE1, 0x10 + 0x08*ii, 0x80+ii); else // ch disable tw2834_write_reg(TW2834_PAGE1, 0x10 + 0x08*ii, 0x00+ii); }// pentamicro 2006.01.11 pal_delay_reg = video_mode==NTSC ? 0x07: 0x0f; tw2834_read_reg(TW2834_PAGE0, 0x14 + 0x40*offset, &buf, 1); tw2834_write_reg(TW2834_PAGE0, 0x14 + 0x40*offset, (buf & 0xc8) | peak_reg); tw2834_read_reg(TW2834_PAGE0, 0x15 + 0x40*offset, &buf, 1); tw2834_write_reg(TW2834_PAGE0, 0x15 + 0x40*offset, (buf & 0xcc) | anti_alia_reg); tw2834_write_reg(TW2834_PAGE0, 0x16 + 0x40*offset, lumi_trap_reg); tw2834_write_reg(TW2834_PAGE0, 0x20 + 0x40*offset, pal_delay_reg); break; case L_QUAD: case L_4CH_PB: if(mode == L_4CH_PB) tw2834_write_reg(TW2834_PAGE0, 0x38, 0x08); else tw2834_write_reg(TW2834_PAGE0, 0x38, 0x00); //set for each ch offset tw2834_burst_write_reg(TW2834_PAGE1, 0x30, video_mode == NTSC ? tbl_ntsc_page1_x_pic_4ch_live : tbl_pal_page1_x_pic_4ch_live, sizeof(tbl_ntsc_page1_x_pic_4ch_live)); for(ii=0; ii<4; ii++) { /* ch enable */ tw2834_write_reg(TW2834_PAGE1, 0x10 + 0x08*ii, 0x80+ii); if(ii == 3 && mode == L_4CH_PB && playback_cur_ch != 4 && rec_mode != 'D') buf = 0xff; else buf = 0x7f; /* vscale [15:8] for x-path */ tw2834_write_reg(TW2834_PAGE0, 0x18 + 0x40*ii, buf); /* hscale [15:8] for x-path */ tw2834_write_reg(TW2834_PAGE0, 0x1c + 0x40*ii, buf); // pentamicro 2006.01.11 if(mode == L_4CH_PB && ii == 3) if(rec_mode == 'C') /* CIF */ if(playback_cur_ch == 4) reg_val_type = 2; else reg_val_type = 1; else reg_val_type = 2; /* D1 */ else reg_val_type = 2; switch(reg_val_type) { case 1: /* h=1 , v=1 scale ratio */ peak_reg = 0x00; anti_alia_reg = 0x00; lumi_trap_reg = 0x00; pal_delay_reg = video_mode==NTSC ? 0x07: 0x0f; /* NTSC= vertical scaling mode PAL= pal delay line mode */ break; case 2: /* h=1/2 , v=1/2 scale ratio */ peak_reg = video_mode==NTSC ? 0x34: 0x10;/* NTSC= 93.75% peaking, 2~4MHz band, PAL= 31.25% peaking, 4~5MHz band */ anti_alia_reg = video_mode==NTSC ? 0x21: 0x21;/* NTSC= 0.25 line band, 2MHz band, PAL= 0.25 line band, 2MHz band */ lumi_trap_reg = video_mode==NTSC ? 0x40: 0xc0;/* NTSC= Force trap filter mode, PAL= Wide band, Force trap */ pal_delay_reg = 0x07; break; } tw2834_read_reg(TW2834_PAGE0, 0x14 + 0x40*ii, &buf, 1); tw2834_write_reg(TW2834_PAGE0, 0x14 + 0x40*ii, (buf & 0xc8) | peak_reg); tw2834_read_reg(TW2834_PAGE0, 0x15 + 0x40*ii, &buf, 1); tw2834_write_reg(TW2834_PAGE0, 0x15 + 0x40*ii, (buf & 0xcc) | anti_alia_reg); tw2834_write_reg(TW2834_PAGE0, 0x16 + 0x40*ii, lumi_trap_reg); tw2834_write_reg(TW2834_PAGE0, 0x20 + 0x40*ii, pal_delay_reg); } if(mode == L_4CH_PB) /* change live audio to decoding state */ set_live_audio_ch(4); break; } /* store current ch */ last_ch_mode = mode; return SUCCESS;}void update_display(LIVE_MON mode){ UNS16 ii; S8 temp[50]; MENU_FONT_t *mft; S8 rec_mode; VIDEO_MODE video_mode; video_mode = gp_state_thread->state_main.mode; rec_mode = gp_state_thread->state_dec.play_file[23]; playback_cur_ch++; playback_cur_ch %= 5; mft = live_menu_font[mode]; switch(playback_cur_ch) { case 0: /* Single CH 1 */ case 1: /* Single CH 2 */ case 2: /* Single CH 3 */ case 3: /* Single CH 4 */ for(ii=0;ii < MAX_CH_NUM; ii++) display(ii, 0); /* display all off */ /* display on, for selected ch */ display(playback_cur_ch, 1); /* display offset */ display_offset(playback_cur_ch, 0, 0); /* move top for current ch priority */ display_priority(playback_cur_ch, 1); if(rec_mode == 'D') /* when the D1 */ display_mode(playback_cur_ch, 1, 1); else /* when the CIF */ display_mode(playback_cur_ch, 3, 3); /* only cif single ch */ if(mode == L_1CH_PB && rec_mode != 'D' ) tw2834_write_reg(TW2834_PAGE1, 0x0c, 0xb0); /* enable zoom */ /* when the decoding D1 or CIF osd text display */ if (gp_state_thread->state_dec.state == BUSY) sprintf(temp, "PB: %s CH%d ", rec_mode == 'D' ? "D1 ": "CIF", playback_cur_ch+1); else sprintf(temp, "PB: CH%d ", playback_cur_ch+1); break; case 4: /* Multi CH */ for(ii=0; ii < MAX_CH_NUM; ii++) { /* display on */ display(ii, 1); /* display offset */ if(video_mode == NTSC) display_offset(ii, (ii%2) * 22, (ii/2) * 15); else display_offset(ii, (ii%2) * 22, (ii/2) * 18); display_mode(ii, 3, 3); } /* when the decoding D1 or CIF osd text display */ if (gp_state_thread->state_dec.state == BUSY) sprintf(temp, "PB: %s MULTI CH", rec_mode == 'D' ? "D1 ": "CIF"); else strcpy(temp, "PB: MULTI CH "); break; } if(mode == L_1CH_PB) strcpy(mft[0].str, temp); else strcpy(mft[9].str, temp);} /* PAL type font location */void live_font_ystart_init(VIDEO_MODE mode){ MENU_FONT_t *mft; int ii, jj; S16 diff_val[4][4] = { {LIVE_MAIN, 6, 12, 2}, {LIVE_SINGLE_PB, 1, 2, 5}, {LIVE_MULTI_4CH, 6, 10, 2},// pentamicro 2006.01.11 {LIVE_DISP_TIME, 0, 12, 5} }; if (mode == NTSC) return; for (ii=0; ii < 4; ii++) { mft = live_menu_font[diff_val[ii][0]]; for(jj=diff_val[ii][1];jj < diff_val[ii][2];jj++) { mft[jj].ystart += diff_val[ii][3]; } }#if 1//xchannel mft = live_menu_font[LIVE_MULTI_4CH]; mft[10].ystart += 5;#endif }RETURN autoselect_spotout(UNS16 ch){ time_t cur_time; static time_t start_spot_time=0; UNS16 set_spot_ch; static UNS16 prev_spot_ch=-1; time(&cur_time); if(cur_time>=(start_spot_time+MAX_SPOT_OUT_TIME)) { if(prev_spot_ch != ch) { if(prev_spot_ch < ch) set_spot_ch = ch; else set_spot_ch = ch; set_spot_out_ch(set_spot_ch); prev_spot_ch = set_spot_ch; time(&start_spot_time); } }}/* when the recoding, display for motion block */void set_motion_block_print(UNS8 ch){ if(gp_state_thread->state_live.mode_mon >= L_CH1 && gp_state_thread->state_live.mode_mon <= L_CH4) { if(gp_state_thread->state_enc.state == BUSY || gp_state_thread->state_enc.state == ALIVE) { if(sp_live_object->disp.state_motionosd) { if(gp_setup_param->enc_ch[ch].motion.flag) tw2834_write_reg(TW2834_PAGE2, 0x60 + (ch * 8), 0x8c); } } }}/* get current free space for osd text */RETURN get_disk_space(void){ MENU_FONT_t *mft; S32 i, disk_cnt=11, bsize, tsize, asize;/* fsize */ float result; S8 temp[50]; struct statfs s[MAX_DISK_NUM]; DISK_PARAM *pdp; mft = live_menu_font[LIVE_DISP_TIME]; pdp = &gp_setup_param->sys.disk; for(i =0; i < MAX_DISK_NUM; i++) { if(pdp->alive_hdd[i] == TRUE) disk_cnt--; } for (i = 0; i < MAX_DISK_NUM; i++) { if (pdp->alive_hdd[i] == TRUE) { GET_DIR_NAME(&temp, i); statfs(temp, &s[i]); bsize = s[i].f_bsize >> 10; /* in kbytes */ tsize = (bsize * s[i].f_blocks) >> 10; /* in MByte */// fsize = (bsize * s[i].f_bfree) >> 10; /* in MByte */ asize = (bsize * s[i].f_bavail) >> 10; /* in MByte */ result = (float)asize/tsize; result *= 100.0; sprintf(temp, "%c:%3.f%%", 'A' + i, 100 - result); strcpy(mft[disk_cnt++].str, temp); } } return SUCCESS;}/* end of pthread_live.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -