diff --git a/TestDASServer.cpp b/TestDASServer.cpp index 8255ae3..1d2b6a6 100644 --- a/TestDASServer.cpp +++ b/TestDASServer.cpp @@ -10,12 +10,12 @@ void OnDASServerStart(XSDK_HANDLE hServer, int nResult) void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDASInfo, int dPos) { - printf("hDevice::%d, dPos::%d\r\n",hDevice,dPos); + printf("hDevice::%d, dPos::%d, DeiveID::%s\r\n",hDevice,dPos,pDASInfo->sDevId); hDeviceArr[dPos] = hDevice; strncpy(DeviceIdArr[dPos], pDASInfo->sDevId, 127); // hDevice---等同于XSDK_DevLoginSyn/XSDK_DevLogin的返回值 - printf("OnDASDeviceReg-->\r\nIP:%s\r\nPort:%d\r\nDeiveID:%s\r\nUserName:%s\r\nPassword:%s\r\nChannelNum:%d\r\nEncryptyType:%s\r\n", - pDASInfo->sDevIP, pDASInfo->nDevPort, pDASInfo->sDevId, pDASInfo->sUserName, pDASInfo->sPassword, pDASInfo->nChannelNum, pDASInfo->sEncryptType); + //printf("OnDASDeviceReg-->\r\nIP:%s\r\nPort:%d\r\nDeiveID:%s\r\nUserName:%s\r\nPassword:%s\r\nChannelNum:%d\r\nEncryptyType:%s\r\n", + // pDASInfo->sDevIP, pDASInfo->nDevPort, pDASInfo->sDevId, pDASInfo->sUserName, pDASInfo->sPassword, pDASInfo->nChannelNum, pDASInfo->sEncryptType); } XSDK_HANDLE g_hDasServer = 0; diff --git a/TestMediaRealPlay.cpp b/TestMediaRealPlay.cpp index 2dbdad3..100e733 100644 --- a/TestMediaRealPlay.cpp +++ b/TestMediaRealPlay.cpp @@ -30,14 +30,14 @@ int CALLBACK Test_MediaCallBack(XSDK_HANDLE hMedia, const unsigned char *pData, if (pFrame->nType == XSDK_FRAME_TYPE_VIDEO) { int pos = getPos(hMedia); - string fmt("/media-file/origin/%s/%04d-%02d-%02d-%02d.dat"); + string fmt("/extdisk/origin/%04d-%02d-%02d-%02d.dat"); char file_name[1024]; - snprintf(file_name,sizeof(file_name),fmt.c_str(),DeviceIdArr[pos],pFrame->nYear,pFrame->nMonth,pFrame->nDay,pFrame->nHour) ; + snprintf(file_name,sizeof(file_name),fmt.c_str(),pFrame->nYear,pFrame->nMonth,pFrame->nDay,pFrame->nHour) ; printf("path: %d ,%s \r\n", pos,file_name); // ABFile("video_header.dat", pFrame->pHeader, pFrame->nLength); ABFile(file_name, pFrame->pContent, pFrame->nFrameLength); } - printf("Media[hMedia:%ld][Len:%d][Type:%d/%d][%04d-%02d-%02d %02d:%02d:%02d-%03d]\r\n", hMedia, nDataLen, pFrame->nType, pFrame->nSubType, pFrame->nYear, pFrame->nMonth, pFrame->nDay, pFrame->nHour, pFrame->nMinute, pFrame->nSecond, (int)(pFrame->nTimeStamp % 1000)); + //printf("Media[hMedia:%ld][Len:%d][Type:%d/%d][%04d-%02d-%02d %02d:%02d:%02d-%03d]\r\n", hMedia, nDataLen, pFrame->nType, pFrame->nSubType, pFrame->nYear, pFrame->nMonth, pFrame->nDay, pFrame->nHour, pFrame->nMinute, pFrame->nSecond, (int)(pFrame->nTimeStamp % 1000)); } else if (EXSDK_DATA_MEDIA_ON_PLAY_STATE == nDataType) { diff --git a/test b/test index ba154a1..9a883c6 100755 Binary files a/test and b/test differ diff --git a/video.py b/video.py index ec24e70..e78f58d 100644 --- a/video.py +++ b/video.py @@ -7,8 +7,8 @@ import subprocess import time import os -DAT_FOLDER = "./" -TARGET_FOLDER = "/media-file/camera" +DAT_FOLDER = "/extdisk/origin" +TARGET_FOLDER = "/extdisk/camera" SUFFIX = ".dat" TARGET_SUFFIX = ".mp4" @@ -20,12 +20,12 @@ def list_folder(org_folder, tar_folder, code): if current_time + ".dat" == f: print("{0} ignore".format(os.path.join(root, f))) continue - convert(os.path.join(root, f), os.path.join(tar_folder, list(root.split("/"))[-1], f+TARGET_SUFFIX)) + convert(os.path.join(root, f), os.path.join(tar_folder, code, f.replace(SUFFIX,"")+TARGET_SUFFIX)) def convert(origin, target): print("origin: {0} ,target: {1}".format(origin,target)) - cmd = "ffmpeg -i " + origin + "-c copy " + target + cmd = 'ffmpeg -i {0} -c copy {1}'.format(origin,target) print("cmd:: {0}".format(cmd)) status, output = subprocess.getstatusoutput(cmd) print("status:: {0}, output {1}".format(status, output))