ref: 594fc4fe7b9018f181714cd2a3e9d17bd96a785b
parent: b3fa8dd334796292dcba4cc014ec571878f21a9b
author: ruil2 <[email protected]>
date: Fri Mar 7 05:23:25 EST 2014
dump file refactor
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -89,7 +89,8 @@
ENCODER_OPTION_ENABLE_PREFIX_NAL_ADDING, //enable prefix: true--enable prefix; false--disable prefix
ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, //disable pSps/pPps id addition: true--disable pSps/pPps id; false--enable pSps/pPps id addistion
- ENCODER_OPTION_CURRENT_PATH
+ ENCODER_OPTION_CURRENT_PATH,
+ ENCODER_OPTION_DUMP_FILE
} ENCODER_OPTION;
/* Option types introduced in decoder application */
@@ -295,5 +296,8 @@
long long uiTimeStamp;
} SSourcePicture;
-
+typedef struct Dump_Layer_s{
+ int iLayer;
+ char *pFileName;
+}SDumpLayer;
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
--- a/codec/console/enc/inc/read_config.h
+++ b/codec/console/enc/inc/read_config.h
@@ -48,9 +48,8 @@
typedef struct tagFilesSet {
string strBsFile;
string strSeqFile; // for cmd lines
- struct {
- string strLayerCfgFile;
- } sSpatialLayers[MAX_DEPENDENCY_LAYER];
+ string strLayerCfgFile[MAX_DEPENDENCY_LAYER];
+ char sRecFileName[MAX_DEPENDENCY_LAYER][MAX_FNAME_LEN];
} SFilesSet;
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -281,7 +281,7 @@
}
} else if (strTag[0].compare ("LayerCfg") == 0) {
if (strTag[1].length() > 0)
- sFileSet.sSpatialLayers[iLayerCount].strLayerCfgFile = strTag[1];
+ sFileSet.strLayerCfgFile[iLayerCount] = strTag[1];
// pSvcParam.sDependencyLayers[iLayerCount].uiDependencyId = iLayerCount;
++ iLayerCount;
} else if (strTag[0].compare ("PrefixNALAddingCtrl") == 0) {
@@ -305,7 +305,7 @@
for (int8_t iLayer = 0; iLayer < kiActualLayerNum; ++ iLayer) {
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
- CReadConfig cRdLayerCfg (sFileSet.sSpatialLayers[iLayer].strLayerCfgFile);
+ CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
{
iRet = 1;
@@ -477,11 +477,11 @@
pSvcParam.iSpatialLayerNum = atoi (argv[n++]);
for (int ln = 0 ; (ln < pSvcParam.iSpatialLayerNum) && (n < argc) ; ln++) {
// pSvcParam.sDependencyLayers[ln].uiDependencyId = ln;
- sFileSet.sSpatialLayers[ln].strLayerCfgFile.assign (argv[n++]);
+ sFileSet.strLayerCfgFile[ln].assign (argv[n++]);
}
for (int8_t iLayer = 0; iLayer < pSvcParam.iSpatialLayerNum; ++ iLayer) {
- CReadConfig cRdLayerCfg (sFileSet.sSpatialLayers[iLayer].strLayerCfgFile);
+ CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
{
return 1;
@@ -489,19 +489,13 @@
}
}
else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
-#ifdef ENABLE_FRAME_DUMP
unsigned int iLayer = atoi (argv[n++]);
const int iLen = strlen (argv[n]);
- SDLayerParam* pDLayer = &pSvcParam.sDependencyLayers[iLayer];
- if (iLen >= sizeof(pDLayer->sRecFileName))
+ if (iLen >= sizeof(sFileSet.sRecFileName[iLayer]))
return 1;
- pDLayer->sRecFileName[iLen] = '\0';
- strncpy (pDLayer->sRecFileName, argv[n++], iLen); // confirmed_safe_unsafe_usage
-#else
- n += 2;
-#endif//ENABLE_FRAME_DUMP
+ sFileSet.sRecFileName[iLayer][iLen] = '\0';
+ strncpy (sFileSet.sRecFileName[iLayer], argv[n++], iLen); // confirmed_safe_unsafe_usage
}
-
else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {
unsigned int iLayer = atoi (argv[n++]);
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
@@ -700,7 +694,6 @@
ret = 1;
goto ERROR_RET;
}
-
iPicLumaSize = sSvcParam.iPicWidth * sSvcParam.iPicHeight;
switch (sSvcParam.iInputCsp) {
int iStride;
@@ -852,7 +845,7 @@
memset (&sFbi, 0, sizeof (SFrameBSInfo));
memset (&sSvcParam, 0, sizeof (SEncParamExt));
-
+ memset (&fs,0,sizeof(SFilesSet));
sSvcParam.iInputCsp = videoFormatI420; // I420 in default
sSvcParam.sSpatialLayers[0].uiProfileIdc = PRO_BASELINE;
// svc_cfg->sDependencyLayers[0].frext_mode = 0;
@@ -917,6 +910,20 @@
fprintf (stderr, "SVC encoder Initialize failed\n");
iRet = 1;
goto INSIDE_MEM_FREE;
+ }
+ for(int iLayer = 0;iLayer<MAX_DEPENDENCY_LAYER;iLayer++)
+ {
+ if(fs.sRecFileName[iLayer][0]!=0)
+ {
+ SDumpLayer sDumpLayer;
+ sDumpLayer.iLayer = iLayer;
+ sDumpLayer.pFileName = fs.sRecFileName[iLayer];
+ if(cmResultSuccess!=pPtrEnc->SetOption(ENCODER_OPTION_DUMP_FILE,&sDumpLayer)){
+ fprintf (stderr, "SetOption ENCODER_OPTION_DUMP_FILE failed!\n");
+ iRet = 1;
+ goto INSIDE_MEM_FREE;
+ }
+ }
}
// Inactive with sink with output file handler
if (fs.strBsFile.length() > 0) {
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -938,6 +938,15 @@
}
}
break;
+ case ENCODER_OPTION_DUMP_FILE:{
+#ifdef ENABLE_FRAME_DUMP
+ if(m_pEncContext->pSvcParam!=NULL){
+ SDumpLayer*pDump = (static_cast<SDumpLayer *>(pOption));
+ WelsStrncpy(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName, pDump->pFileName, sizeof(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName))
+ }
+#endif
+ }
+ break;
default:
return cmInitParaError;
}