static void main_loop(int flag, LogLevel_t level, const char *logName) { int cnt = 0; DBG("Log Test Start: %d.", cnt++); INFO("Info: %d", cnt++); ERR("Err: %d", cnt++); FILE *fp = fopen("not_exit", "b"); ERRSTR("Open none exist file"); LogHandle hLog; hLog = log_create(level, flag, logName, 1024 * 1024); assert(hLog != NULL); for(level = LOG_LEVEL_DBG; level < LOG_LEVEL_MAX; level++) { log_print(hLog, "Log level: %d", level); log_set_level(hLog, level); log_debug(hLog, "Debug info, log name %s", logName); log_warning(hLog,"Warning, flag: %u, level: %d", flag, level); log_error(hLog,"Error, log handle addr: 0x%X", hLog); } const char *pErr = str_err((int)E_BUSY); printf("Err string: %s\n", pErr); log_print(hLog, "Log test success!"); }
/***************************************************************************** Prototype : msg_process Description : process msg Input : VidEncThrEnv *envp CommonMsg *msgBuf Output : None Return Value : static Calls : Called By : History : 1.Date : 2012/3/8 Author : Sun Modification : Created function *****************************************************************************/ static Int32 msg_process(VidEncThrEnv *envp, CommonMsg *msgBuf) { Int32 ret; /* recv msg */ ret = msg_recv(envp->hMsg, msgBuf, sizeof(CommonMsg)); if(ret < 0) { ERR("img enc thr recv msg err: %s", str_err(ret)); return ret; } /* process msg */ MsgHeader *msgHdr = &msgBuf->header; switch(msgHdr->cmd) { case APPCMD_NEW_DATA: ret = vid_enc_thr_run(envp, (ImgMsg *)msgBuf); break; case APPCMD_SET_VID_ENC_PARAMS: ret = vid_enc_params_update(envp); break; case APPCMD_EXIT: envp->exit = TRUE; break; default: ERR("unkown cmd: 0x%X", (unsigned int)msgHdr->cmd); ret = E_UNSUPT; break; } return ret; }
void print_robot_chart(robot_chart &chart) { typedef robot_chart::error_map_t error_map_t; LOG_TRACE("robot succ num = %d\r\n", chart.n_succ); LOG_TRACE("robot fail num = %d\r\n", chart.n_fail); char buf[128]; for(error_map_t::iterator itr = chart.error_map.begin(); itr != chart.error_map.end(); itr++) { int err_type = itr->first; int err_occur_num = itr->second; str_err(err_type, buf, sizeof(buf)); LOG_TRACE("num of error<%d, %s> is %d\r\n", err_type, buf, err_occur_num); } }
/***************************************************************************** Prototype : msg_process Description : process msg Input : EncoderHandle hEnc CommonMsg *msgBuf Output : None Return Value : static Calls : Called By : History : 1.Date : 2012/3/8 Author : Sun Modification : Created function *****************************************************************************/ static Int32 msg_process(EncoderHandle hEnc, CommonMsg *msgBuf) { Int32 ret; /* recv msg */ ret = msg_recv(hEnc->hMsg, (MsgHeader *)msgBuf, sizeof(CommonMsg), 0); if(ret < 0) { ERR("%s recv msg err: %s", hEnc->name, str_err(ret)); return ret; } /* process msg */ MsgHeader *msgHdr = &msgBuf->header; switch(msgHdr->cmd) { case APPCMD_NEW_DATA: ret = encode_frame(hEnc, (ImgMsg *)msgBuf); break; case APPCMD_SET_ENC_PARAMS: ret = enc_params_update(hEnc, msgBuf->buf, msgHdr->dataLen); break; case APPCMD_SET_UPLOAD_PARAMS: if( msgHdr->dataLen == sizeof(UploadParams)) ret = upload_update(hEnc, (UploadParams *)msgBuf->buf); else ERR("invalid len of upload params"); break; case APPCMD_UPLOAD_CTRL: ret = upload_control(hEnc->hUpload, msgHdr->param[0], msgBuf->buf); break; case APPCMD_EXIT: hEnc->exit = TRUE; break; default: ERR("unkown cmd: 0x%X", (unsigned int)msgHdr->cmd); ret = E_UNSUPT; break; } return ret; }
/***************************************************************************** Prototype : detector_uart_open Description : open uart device Input : DetectorHandle hDetector Output : None Return Value : static Calls : Called By : History : 1.Date : 2012/4/6 Author : Sun Modification : Created function *****************************************************************************/ static Int32 detector_uart_open(DetectorHandle hDetector) { Int32 i, status = E_UNSUPT; DetectorUart *dev; const CamDetectorParam *params = DETECTOR_GET_PARAMS(hDetector); dev = calloc(1, sizeof(DetectorUart)); if(!dev) { ERR("memory allocation of dev failed."); return E_NOMEM; } /* set private data as our dev info */ DETECTOR_SET_PRIVATE(hDetector, dev); memset(dev->lastFrameCode, FRAME_TRIG_BASE, sizeof(dev->lastFrameCode)); /* probe and init detector */ i = 0; while(uartDetectorFxns[i] != NULL) { if(uartDetectorFxns[i]->init) { status = uartDetectorFxns[i]->init(dev, params->detecotorId); if(!status) { dev->opts = uartDetectorFxns[i]; break; } } i++; } if(status) { ERR("init detector <%d> failed, %s", params->detecotorId, str_err(status)); goto free_buf; } if(!dev->opts || !dev->opts->singleTrigParse) { ERR("opts should not be NULL"); status = E_IO; goto free_buf; } /* start detector */ dev->timeout = 1; //set to default value: 100ms status = detector_uart_start(dev); if(status) { ERR("start failed"); goto free_buf; } /* check packet len */ if(dev->packetLen < 1 || dev->packetLen > RX_BUF_SIZE) { ERR("packet len invalid"); status = E_NOSPC; goto free_buf; } /* pre parse params */ if(dev->opts->capPreParse) dev->opts->capPreParse(dev, params); /* set dev fd */ hDetector->fd = dev->fd; return E_NO; free_buf: if(dev->fd > 0) close(dev->fd); if(dev) free(dev); DETECTOR_SET_PRIVATE(hDetector, NULL); return status; }
/***************************************************************************** Prototype : vid_enc_thr_run Description : add osd and do jpeg encode Input : VidEncThrEnv *envp ImgMsg *msg Output : None Return Value : static Calls : Called By : History : 1.Date : 2012/3/9 Author : Sun Modification : Created function *****************************************************************************/ static Int32 vid_enc_thr_run(VidEncThrEnv *envp, ImgMsg *msg) { Int32 err; /* Add osd first & ignore error */ err = add_osd(envp->hOsd, msg, &envp->osdCfg.vidOsd); /* Init buffer and args for encode */ AlgBuf inBuf, outBuf; BufHandle hBufIn, hBufOut; H264EncInArgs inArgs; H264EncOutArgs outArgs; Int32 dispFlags = 0; hBufIn = msg->hBuf; inBuf.buf = buffer_get_user_addr(msg->hBuf); inBuf.bufSize = buffer_get_size(msg->hBuf); assert(inBuf.buf && inBuf.bufSize); dispFlags = FD_FLAG_NOT_FREE_BUF; hBufOut = envp->hBufEnc; outBuf.buf = buffer_get_user_addr(hBufOut); outBuf.bufSize = buffer_get_size(hBufOut); inArgs.size = sizeof(inArgs); inArgs.inputID = msg->index; inArgs.timeStamp = 0; outArgs.size = sizeof(outArgs); outArgs.bytesGenerated = 0; /* do h264 encode */ err = h264_enc_process(envp->hH264Enc, &inBuf, &inArgs, &outBuf, &outArgs); if(err) { ERR("h264 enc err: %s", str_err(err)); goto err_quit; } /* free input buffer */ static int cnt = 0; DBG("<%d>h264 free raw buf",++cnt); buf_pool_free(hBufIn); hBufIn = NULL; /* modify frame info */ msg->dimension.colorSpace = FMT_H264; msg->dimension.size = outArgs.bytesGenerated; msg->frameType = outArgs.frameType; msg->hBuf = hBufOut; buffer_set_bytes_used(hBufOut, outArgs.bytesGenerated); //DBG("<%d> h264 enc run ok", msg->index); /* dispatch h.264 data */ err = frame_disp_run(envp->hDispatch, envp->hMsg, msg, NULL, dispFlags); if(err) { ERR("dispatch h264 data failed"); goto err_quit; } return E_NO; err_quit: if(hBufIn) buf_pool_free(hBufIn); return err; }
int Message( DWORD Flags, size_t Buttons, const wchar_t *Title, const wchar_t * const *Items, size_t ItemsNumber, Plugin* PluginNumber, const GUID* Id ) { string strTempStr; string strClipText; int X1,Y1,X2,Y2; int Length, BtnLength; DWORD I, MaxLength, StrCount; BOOL ErrorSets=FALSE; const wchar_t **Str; wchar_t *PtrStr; const wchar_t *CPtrStr; string strErrStr; IsWarningStyle = (Flags&MSG_WARNING) != 0; IsErrorType = (Flags&MSG_ERRORTYPE) != 0; if(IsErrorType) { LastError = GetLastError(); NtStatus = ifn.RtlGetLastNtStatus(); ErrorSets = GetErrorString(strErrStr); } #if 1 // try to replace inserts if (Items && 0 != (Flags & MSG_INSERT_STRINGS)) { string str_err(strErrStr); DWORD insert_mask = 0; size_t len = strErrStr.GetLength(), pos = 0, inserts_n = 0, inserts[10]; for (size_t i = 1; i <= ItemsNumber-Buttons; ++i) { if (0 != (Flags & MSG_INSERT_STR(i))) { inserts[inserts_n++] = i; if (inserts_n >= ARRAYSIZE(inserts)) break; } } while (str_err.Pos(pos, L"%", pos)) { if (pos >= len-1) break; if (str_err.At(pos+1) >= L'1' && str_err.At(pos+1) <= L'9') { size_t insert_i = 0, pos1 = pos+1; while (pos1 < len && str_err.At(pos1) >= L'0' && str_err.At(pos1) <= L'9') { insert_i = 10*insert_i + str_err.At(pos1) - L'0'; ++pos1; } if (insert_i >= 1 && insert_i <= inserts_n) { insert_mask |= MSG_INSERT_STR(inserts[insert_i-1]); const wchar_t *replacement = Items[inserts[insert_i-1]-1]; str_err.Replace(pos,pos1-pos,replacement); len += wcslen(replacement) - (pos1-pos); pos += wcslen(replacement) - (pos1-pos); } else pos = pos1; } else if (str_err.At(pos+1) == L'%') // "%%" pos += 2; else ++pos; } if (insert_mask == (Flags & MSG_INSERT_STRINGS)) strErrStr = str_err; } #endif // выделим пам¤ть под рабочий массив указателей на строки (+запас 16) Str=(const wchar_t **)xf_malloc((ItemsNumber+ADDSPACEFORPSTRFORMESSAGE) * sizeof(wchar_t*)); if (!Str) return -1; StrCount=static_cast<DWORD>(ItemsNumber-Buttons); // предварительный обсчет максимального размера. for (BtnLength=0,I=0; I<static_cast<DWORD>(Buttons); I++) //?? { BtnLength+=HiStrlen(Items[I+StrCount])+2+2+1; // "[ ", " ]", " " } if(BtnLength) { BtnLength--; } DWORD MAX_WIDTH_MESSAGE = Max(ScrX-1-5-5, BtnLength); for (MaxLength=BtnLength,I=0; I<StrCount; I++) { if (static_cast<DWORD>(Length=StrLength(Items[I]))>MaxLength) MaxLength=Length; } // учтем размер заголовка if (Title && *Title) { I=(DWORD)StrLength(Title)+2; if (MaxLength < I) MaxLength=I; strClipText.Append(Title).Append(L"\r\n\r\n"); } // перва¤ коррекци¤ максимального размера MaxLength = Min(MaxLength, MAX_WIDTH_MESSAGE); // теперь обработаем MSG_ERRORTYPE DWORD CountErrorLine=0; if ((Flags & MSG_ERRORTYPE) && ErrorSets) { strClipText.Append(strErrStr).Append(L"\r\n"); // подсчет количества строк во врапенном сообщениеи ++CountErrorLine; //InsertQuote(ErrStr); // оквочим // вычисление "красивого" размера DWORD LenErrStr=(DWORD)strErrStr.GetLength(); if (LenErrStr > MAX_WIDTH_MESSAGE) { // половина меньше? if (LenErrStr/2 < MAX_WIDTH_MESSAGE) { // а половина + 1/3? if ((LenErrStr+LenErrStr/3)/2 < MAX_WIDTH_MESSAGE) LenErrStr=(LenErrStr+LenErrStr/3)/2; else LenErrStr/=2; } else LenErrStr=MAX_WIDTH_MESSAGE; } MaxLength = Max(MaxLength, LenErrStr); // а теперь проврапим FarFormatText(strErrStr,LenErrStr,strErrStr,L"\n",0); //?? MaxLength ?? PtrStr = strErrStr.GetBuffer(); //BUGBUG: string не предназначен дл¤ хранени¤ строк разделЄнных \0 while ((PtrStr=wcschr(PtrStr,L'\n')) ) { *PtrStr++=0; if (*PtrStr) CountErrorLine++; } strErrStr.ReleaseBuffer(); if (CountErrorLine > ADDSPACEFORPSTRFORMESSAGE) CountErrorLine=ADDSPACEFORPSTRFORMESSAGE; //?? } //BUGBUG: string не предназначен дл¤ хранени¤ строк разделЄнных \0 // заполн¤ем массив... CPtrStr=strErrStr; for (I=0; I < CountErrorLine; I++) { Str[I]=CPtrStr; CPtrStr+=StrLength(CPtrStr)+1; if (!*CPtrStr) // два идущих подр¤д нул¤ - "хандец" всему { ++I; break; } } bool EmptyText=false; if(ItemsNumber==Buttons && !I) { EmptyText=true; Str[I]=L""; I++; StrCount++; ItemsNumber++; } for (size_t J=0; J < ItemsNumber-(EmptyText?1:0); ++J, ++I) { Str[I]=Items[J]; } for (size_t i = 0; i < ItemsNumber-Buttons; ++i) { strClipText.Append(Items[i]).Append(L"\r\n"); } strClipText.Append(L"\r\n"); for (size_t i = ItemsNumber-Buttons; i < ItemsNumber; ++i) { if(i > ItemsNumber-Buttons) { strClipText.Append(L' '); } strClipText.Append(Items[i]); } StrCount+=CountErrorLine; MessageX1=X1=(int(ScrX-MaxLength))/2-4; MessageX2=X2=X1+MaxLength+9; Y1=(ScrY-static_cast<int>(StrCount))/2-2; if (Y1 < 0) Y1=0; MessageY1=Y1; MessageY2=Y2=Y1+StrCount+3; string strHelpTopic(strMsgHelpTopic); strMsgHelpTopic.Clear(); // *** ¬ариант с ƒиалогом *** if (Buttons>0) { size_t ItemCount=StrCount+Buttons+1; DialogItemEx *PtrMsgDlg; DialogItemEx *MsgDlg = new DialogItemEx[ItemCount+1]; if (!MsgDlg) { xf_free(Str); return -1; } for (DWORD i=0; i<ItemCount+1; i++) MsgDlg[i].Clear(); int RetCode; MessageY2=++Y2; MsgDlg[0].Type=DI_DOUBLEBOX; MsgDlg[0].X1=3; MsgDlg[0].Y1=1; MsgDlg[0].X2=X2-X1-3; MsgDlg[0].Y2=Y2-Y1-1; if (Title && *Title) MsgDlg[0].strData = Title; FARDIALOGITEMTYPES TypeItem=DI_TEXT; unsigned __int64 FlagsItem=DIF_SHOWAMPERSAND; BOOL IsButton=FALSE; int CurItem=0; bool StrSeparator=false; bool Separator=false; for (PtrMsgDlg=MsgDlg+1,I=1; I < ItemCount; ++I, ++PtrMsgDlg, ++CurItem) { if (I==StrCount+1 && !StrSeparator && !Separator) { PtrMsgDlg->Type=DI_TEXT; PtrMsgDlg->Flags=DIF_SEPARATOR; PtrMsgDlg->Y1=PtrMsgDlg->Y2=I+1; CurItem--; I--; Separator=true; continue; } if(I==StrCount+1) { TypeItem=DI_BUTTON; FlagsItem=DIF_CENTERGROUP|DIF_DEFAULTBUTTON|DIF_FOCUS; IsButton=TRUE; FirstButtonIndex=CurItem+1; LastButtonIndex=CurItem; } else { FlagsItem&=~DIF_DEFAULTBUTTON; } PtrMsgDlg->Type=TypeItem; PtrMsgDlg->Flags|=FlagsItem; CPtrStr=Str[CurItem]; if (IsButton) { PtrMsgDlg->Y1=Y2-Y1-2+(Separator?1:0); PtrMsgDlg->strData+=CPtrStr; LastButtonIndex++; } else { PtrMsgDlg->X1=(Flags & MSG_LEFTALIGN)?5:-1; PtrMsgDlg->Y1=I+1; wchar_t Chr=*CPtrStr; if (Chr == L'\1' || Chr == L'\2') { CPtrStr++; PtrMsgDlg->Flags|=(Chr==2?DIF_SEPARATOR2:DIF_SEPARATOR); if(I==StrCount) { StrSeparator=true; } } else { if (StrLength(CPtrStr)>X2-X1-9) { PtrMsgDlg->Type=DI_EDIT; PtrMsgDlg->Flags|=DIF_READONLY|DIF_BTNNOCLOSE|DIF_SELECTONENTRY; PtrMsgDlg->X1=5; PtrMsgDlg->X2=X2-X1-5; PtrMsgDlg->strData=CPtrStr; } else { //xstrncpy(PtrMsgDlg->Data,CPtrStr,Min((int)MAX_WIDTH_MESSAGE,(int)sizeof(PtrMsgDlg->Data))); //?? ScrX-15 ?? PtrMsgDlg->strData = CPtrStr; //BUGBUG, wrong len } } } } { if(Separator) { FirstButtonIndex++; LastButtonIndex++; MessageY2++; Y2++; MsgDlg[0].Y2++; ItemCount++; } Dialog Dlg(MsgDlg,ItemCount,MsgDlgProc, &strClipText); if (X1 == -1) X1 = 0; if (Y1 == -1) Y1 = 0; Dlg.SetPosition(X1,Y1,X2,Y2); if(Id) Dlg.SetId(*Id); if (!strHelpTopic.IsEmpty()) Dlg.SetHelp(strHelpTopic); Dlg.SetPluginOwner(reinterpret_cast<Plugin*>(PluginNumber)); // «апомним номер плагина if (IsWarningStyle) { Dlg.SetDialogMode(DMODE_WARNINGSTYLE); } Dlg.SetDialogMode(DMODE_MSGINTERNAL); if (Flags & MSG_NOPLUGINS) Dlg.SetDialogMode(DMODE_NOPLUGINS); FlushInputBuffer(); if (Flags & MSG_KILLSAVESCREEN) SendDlgMessage((HANDLE)&Dlg,DM_KILLSAVESCREEN,0,0); Dlg.Process(); RetCode=Dlg.GetExitCode(); } delete [] MsgDlg; xf_free(Str); return(RetCode<0?RetCode:RetCode-StrCount-1-(Separator?1:0)); } // *** Ѕез ƒиалога! *** SetCursorType(0,0); if (!(Flags & MSG_KEEPBACKGROUND)) { SetScreen(X1,Y1,X2,Y2,L' ',ColorIndexToColor((Flags & MSG_WARNING)?COL_WARNDIALOGTEXT:COL_DIALOGTEXT)); MakeShadow(X1+2,Y2+1,X2+2,Y2+1); MakeShadow(X2+1,Y1+1,X2+2,Y2+1); Box(X1+3,Y1+1,X2-3,Y2-1,ColorIndexToColor((Flags & MSG_WARNING)?COL_WARNDIALOGBOX:COL_DIALOGBOX),DOUBLE_BOX); } SetColor((Flags & MSG_WARNING)?COL_WARNDIALOGTEXT:COL_DIALOGTEXT); if (Title && *Title) { string strTempTitle = Title; if (strTempTitle.GetLength() > MaxLength) strTempTitle.SetLength(MaxLength); GotoXY(X1+(X2-X1-1-(int)strTempTitle.GetLength())/2,Y1+1); FS<<L" "<<strTempTitle<<L" "; } for (I=0; I<StrCount; I++) { CPtrStr=Str[I]; wchar_t Chr=*CPtrStr; if (Chr == 1 || Chr == 2) { Length=X2-X1-5; if (Length>1) { SetColor((Flags & MSG_WARNING)?COL_WARNDIALOGBOX:COL_DIALOGBOX); GotoXY(X1+3,Y1+I+2); DrawLine(Length,(Chr == 2?3:1)); CPtrStr++; int TextLength=StrLength(CPtrStr); if (TextLength<Length) { GotoXY(X1+3+(Length-TextLength)/2,Y1+I+2); Text(CPtrStr); } SetColor((Flags & MSG_WARNING)?COL_WARNDIALOGBOX:COL_DIALOGTEXT); } continue; } if ((Length=StrLength(CPtrStr))>ScrX-15) Length=ScrX-15; int Width=X2-X1+1; wchar_t *lpwszTemp = nullptr; int PosX; if (Flags & MSG_LEFTALIGN) { lpwszTemp = (wchar_t*)xf_malloc((Width-10+1)*sizeof(wchar_t)); _snwprintf(lpwszTemp,Width-10+1,L"%.*s",Width-10,CPtrStr); GotoXY(X1+5,Y1+I+2); } else { PosX=X1+(Width-Length)/2; lpwszTemp = (wchar_t*)xf_malloc((PosX-X1-4+Length+X2-PosX-Length-3+1)*sizeof(wchar_t)); _snwprintf(lpwszTemp,PosX-X1-4+Length+X2-PosX-Length-3+1,L"%*s%.*s%*s",PosX-X1-4,L"",Length,CPtrStr,X2-PosX-Length-3,L""); GotoXY(X1+4,Y1+I+2); } Text(lpwszTemp); xf_free(lpwszTemp); } /* $ 13.01.2003 IS - ѕринудительно уберем запрет отрисовки экрана, если количество кнопок в сообщении равно нулю и макрос закончил выполн¤тьс¤. Ёто необходимо, чтобы заработал прогресс-бар от плагина, который был запущен при помощи макроса запретом отрисовки (bugz#533). */ xf_free(Str); if (!Buttons) { if (ScrBuf.GetLockCount()>0 && !CtrlObject->Macro.PeekKey()) ScrBuf.SetLockCount(0); ScrBuf.Flush(); } return 0; }
/***************************************************************************** Prototype : img_enc_thr_run Description : add osd and do jpeg encode Input : EncoderHandle hEnc ImgMsg *msg Output : None Return Value : static Calls : Called By : History : 1.Date : 2012/3/9 Author : Sun Modification : Created function *****************************************************************************/ static Int32 encode_frame(EncoderHandle hEnc, ImgMsg *msg) { Int32 err; /* Add osd first & ignore error */ err = add_osd(hEnc->hOsd, msg, &hEnc->osdInfo); /* Init buffer for encode */ AlgBuf inBuf, outBuf; BufHandle hBufIn, hBufOut; Bool saveToLocal = FALSE; hBufIn = msg->hBuf; inBuf.buf = buffer_get_user_addr(hBufIn); inBuf.bufSize = buffer_get_bytes_used(hBufIn); hEnc->hPoolIn = buffer_get_pool(hBufIn); if(hEnc->hPoolEnc) { /* Alloc buffer for encoded data */ hBufOut = buf_pool_alloc_wait(hEnc->hPoolEnc, BUF_ALLOC_TIMEOUT); //hBufOut = buf_pool_alloc(hEnc->hPoolEnc); if(!hBufOut) { /* alloc buffer failed, use buf for save */ //DBG("<%s> save file to local file system", hEnc->name); hBufOut = hEnc->hBufEnc; saveToLocal = TRUE; } } else { /* no pool */ hBufOut = hEnc->hBufEnc; } outBuf.buf = buffer_get_user_addr(hBufOut); outBuf.bufSize = buffer_get_size(hBufOut); if(!outBuf.buf || !outBuf.bufSize) { ERR("<%s> got invalid encode buf handle", hEnc->name); err = E_NOMEM; goto err_quit; } /* do encode process */ //pthread_mutex_lock(hEnc->mutex); err = hEnc->ops->encProcess(hEnc->hEncode, &inBuf, &outBuf, msg); //pthread_mutex_unlock(hEnc->mutex); if(err) { ERR("<%s> enc err: %s", hEnc->name, str_err(err)); goto err_quit; } /* free input buffer */ buf_pool_free(hBufIn); hBufIn = NULL; /* modify msg for send */ msg->hBuf = hBufOut; if(!saveToLocal) { /* upload to server */ err = upload_run(hEnc->hUpload, hEnc->hMsg, msg); } /* save to local filesys */ if(saveToLocal || err) { if(hEnc->ops->saveFrame) err = hEnc->ops->saveFrame(msg, hEnc->saveRootPath); goto err_quit; } //DBG("<%d> %s encode ok", msg->index, hEnc->name); return E_NO; err_quit: /* free buffers */ if(hBufIn) buf_pool_free(hBufIn); if(!saveToLocal && hEnc->hPoolEnc) buf_pool_free(hBufOut); return err; }