// int CVideoPlayBack::DownLoadStramCB(struct _jcu_stream_cb_s *handle, jcu_cb_parm_t *parm) // { // //TRACE("======================id %d, args %d, size %d data %x\n", parm->id, parm->args, parm->size, parm->data); // // j_frame_t* pBufFrame = (j_frame_t*)parm->data; // if (parm->id == JCU_STREAM_EV_OPEN) // { // return 0; // } // else if (parm->id == JCU_STREAM_EV_RECV) // { // // if(gVideoPlayback->m_lstartTime < 0 && (pBufFrame->frame_type == j_video_i_frame || pBufFrame->frame_type == j_video_p_frame || pBufFrame->frame_type == j_video_b_frame)) // { // gVideoPlayback->m_lstartTime = pBufFrame->timestamp_sec; // } // ; // int iRet = -1; // iRet = fwrite(parm->data,parm->size,1,fp); // if( iRet != 1) // { // //AfxMessageBox("写入信息失败"); // return -1; // } // //TRACE("写入成功"); // long fileSize = ftell(fp); //文件大小 // g_PubData.g_iDownLoadPos = fileSize / (gVideoPlayback->m_lRecFileSize[gVideoPlayback->m_iListIndex] / 100); // if(pBufFrame->frame_type == j_video_i_frame || pBufFrame->frame_type == j_video_p_frame || pBufFrame->frame_type == j_video_b_frame) // { // gVideoPlayback->m_lEndTime = pBufFrame->timestamp_sec; // } // gVideoPlayback->m_lFrameCount ++; // return 0; // } // else if(parm->id == JCU_STREAM_EV_CLOSE) // { // if(m_downloadHandle == NULL) // return -1; // //TRACE("下载完成\n"); // // // STFileHead_1000 fileHead; //文件头信息 // // STFileIndex_1001 fileIndex; //文件索引信息 // // // // fileHead.m_dwMagic = READER_T_JPF; // // fileHead.m_dwVersion = 0x01000002; // // fileHead.m_lTimeZone = 0; // // fileHead.m_iFileOffset = sizeof(stFileIndex_1001); // // fileHead.m_iUserOffset = 0; // // // // // m_lFrameCount = 0; // 帧数 // // // m_iRes1 = 0; // 保留位 // // // m_tStart = 0; // 开始时间 // // // m_tEnd = 0; // 结束时间 // // // m_dwSize = 0xFFFFFFFF; // 下一索引位置 // // // m_dwProtocal = READER_T_JPF; // 协议类型,如:READER_T_JPF // // // m_dwEncoder = Encoder_3516; // 创建的主机的CPU,见eEncoderType // // // m_iRes2 = 0; // 保留位 // // long fileSize = ftell(fp); // // fileIndex.m_lFrameCount = gVideoPlayback->m_lFrameCount; // // fileIndex.m_iRes1 = 0; // // fileIndex.m_tStart = gVideoPlayback->m_lstartTime; // // fileIndex.m_tEnd = gVideoPlayback->m_lEndTime; // // fileIndex.m_dwSize = fileSize; // // fileIndex.m_dwProtocal = READER_T_JPF; // // fileIndex.m_dwEncoder = Encoder_3516; // // fileIndex.m_iRes2 = 0; // // // // fseek(fp, 0L , 0); // // int iRet = -1; // // iRet = fwrite((char *)&fileHead, sizeof(fileHead),1,fp); // // if(iRet != 1) // // { // // //AfxMessageBox(_T("写入文件头失败")); // // return 0; // // } // // // // iRet = fwrite((char *)&fileIndex, sizeof(fileIndex),1,fp); // // if(iRet != 1) // // { // // //AfxMessageBox(_T("写入文件索引位置信息失败")); // // return 0; // // } // // // // fclose(fp); // // fp = NULL; // // // // if(m_downloadHandle != NULL) // // { // // iRet = jcu_net_rec_close(m_downloadHandle); // // if(iRet != 0) // // { // // //AfxMessageBox(_T("关闭录像失败")); // // return -1; // // } // // m_downloadHandle = NULL; // // } // // // // gVideoPlayback->m_progressDownLoad.SetPos(100); // g_PubData.g_iDownLoadPos = 0; // gVideoPlayback->GetDlgItem(IDC_BUTTON_SERACHVIDEO)->EnableWindow(TRUE); // gVideoPlayback->GetDlgItem(IDC_BUTTON_DOWNLOAD)->EnableWindow(TRUE); // if(g_PubData.g_iLanguageFlag == 0) // AfxMessageBox(_T("下载完成")); // else // AfxMessageBox(_T("Download"), _T("Download success!")); // gVideoPlayback->m_progressDownLoad.SetPos(0); // gVideoPlayback->m_progressDownLoad.ShowWindow(SW_HIDE); // return 0; // } // return 0; // // } // int CVideoPlayBack::DownLoadNotifyCB(struct _jcu_notify_cb_s *handle, jcu_cb_parm_t *parm) // { // gVideoPlayback->m_nDownLoadFlag = parm->args; // if (parm->args != JCU_NOTIFY_ERR_0) // { // if(m_downloadHandle != NULL) // { // int iRet = jcu_net_rec_close(m_downloadHandle); // if(iRet != 0) // { // return -1; // } // m_downloadHandle = NULL; // } // g_PubData.g_iDownLoadPos = 0; // gVideoPlayback->GetDlgItem(IDC_BUTTON_SERACHVIDEO)->EnableWindow(TRUE); // gVideoPlayback->GetDlgItem(IDC_BUTTON_DOWNLOAD)->EnableWindow(TRUE); // gVideoPlayback->m_progressDownLoad.SetPos(0); // gVideoPlayback->m_progressDownLoad.ShowWindow(SW_HIDE); // AfxMessageBox(_T("Download"), _T("Download error!")); // return -1; // } // return 0; // } void CVideoPlayBack::OnBnClickedButtonPlayfile() { // TODO: 在此添加控件通知处理程序代码 CString strFile = ""; CString strText = ""; time_t tStart = 0; // 文件的开始时间 time_t tEnd = 0; // 文件的结束时间 long lSize = 0; // 文件的大小 long lProtocal = 0; // 文件的帧头协议 long lEncoder = 0; // 文件所用的编码器 CFileDialog dlgFile(TRUE, _T("jav"),NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("jav Files (*.jav)|*.jav|All Files (*.*)|*.*||"),this); if ( dlgFile.DoModal()!=IDOK ) { return; } strFile = dlgFile.GetPathName(); PlayVideoFile(strFile); }
void task_play_start(void) { #if (USER_CONFIG==CONFIG_AX3251_AIRBORNE) #else FRESULT ret; u32 scan_num; u32 cur_num; if(FALSE == sd_err_reinit()) { return; } ret = f_scan_files(WORK_DIR_NAME,".JPG|.AVI",&scan_num); //deg_Printf("pass f_scan_files, ret =%d,scan_num = %d\n ",ret,scan_num); //play_file_total = scan_num; play_file_total = f_get_totalfile_num(0); deg_Printf("play_file_total =%d\n ",play_file_total); if(play_file_total > 0) { //f_exchangesort_file(play_file_total); memcpy__(filename, "Record/", 7); deg_Printf("play_file_num =%d\n ",play_file_num); //char *ptr = f_get_scan_file_name(play_file_num,play_file_total); char *ptr = f_get_file_name(play_file_num,play_file_total); deg_Printf("get file name = %s\n",ptr); cur_num = (ptr[3]-'0')*100+(ptr[4]-'0')*10+(ptr[5]-'0'); if('L' == ptr[0]) { t_play.file_lock_flag = 1; } else { t_play.file_lock_flag = 0; } //deg_Printf("cur_num = %d\n",cur_num); memcpy__(filename+7, ptr, 13); //deg_Printf("filename = %s\n",filename); } else { return; } filename[10]='0'+ ((cur_num/100)%10); filename[11]='0'+ ((cur_num/10)%10); filename[12]='0'+ (cur_num%10); deg_Printf("fopen %s\n",filename); ret = f_open(&Fil,(char const *)filename, FA_READ); if(ret != FR_OK) { deg_Printf("open file failed:%d\n",ret); } //deg_Printf("pass f_open, ret =%d\n ",ret); if((filename[14] =='A')&&(filename[15] =='V')&&(filename[16] =='I')) { PlayVideoFile(&Fil); f_close(&Fil); sd_WaitSdStopTran(); t_play.play_sta = PLAY_VIDEO; } else if((filename[14] =='J')&&(filename[15] =='P')&&(filename[16] =='G')) { t_play.play_sta = PLAY_PHOTO; PlayPictureFile(&Fil); f_close(&Fil); sd_WaitSdStopTran(); t_play.play_sta = PLAY_STOP; } task_ctl.on_playing = 0; #endif deg_Printf("play finish\n"); }