summaryrefslogtreecommitdiffstats
path: root/libMpegTPEnc/src/tpenc_lib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libMpegTPEnc/src/tpenc_lib.cpp')
-rw-r--r--libMpegTPEnc/src/tpenc_lib.cpp52
1 files changed, 50 insertions, 2 deletions
diff --git a/libMpegTPEnc/src/tpenc_lib.cpp b/libMpegTPEnc/src/tpenc_lib.cpp
index d0a2fec..058b8d4 100644
--- a/libMpegTPEnc/src/tpenc_lib.cpp
+++ b/libMpegTPEnc/src/tpenc_lib.cpp
@@ -102,9 +102,9 @@ amm-info@iis.fraunhofer.de
#include "tpenc_adif.h"
-#include "tpenc_latm.h"
-
+#include "tpenc_dab.h"
+#include "tpenc_latm.h"
typedef struct {
int curSubFrame;
@@ -128,6 +128,8 @@ struct TRANSPORTENC
ADIF_INFO adif;
+ STRUCT_DAB dab;
+
LATM_STREAM latm;
RAWPACKETS_INFO raw;
@@ -203,6 +205,7 @@ static INT getPceRepetitionRate(
case TT_MP4_LOAS: /* PCE in ASC if chChonfig==0 */
case TT_MP4_LATM_MCP1: /* PCE in ASC if chChonfig==0 */
case TT_DRM: /* PCE not allowed in DRM */
+ case TT_DABPLUS:
default:
pceFrameCounter = -1; /* no PCE in raw_data_block */
}
@@ -221,6 +224,7 @@ static INT getPceRepetitionRate(
pceFrameCounter = headerPeriod;
break;
case TT_DRM: /* PCE not allowed in DRM */
+ case TT_DABPLUS:
default:
pceFrameCounter = -1; /* no PCE in raw_data_block */
} /* switch transportFmt */
@@ -287,6 +291,18 @@ TRANSPORTENC_ERROR transportEnc_Init(
}
break;
+ case TT_DABPLUS:
+ /* Sanity checks */
+ if ( ( hTpEnc->config.aot != AOT_AAC_LC)
+ ||(hTpEnc->config.samplesPerFrame != 960) )
+ {
+ return TRANSPORTENC_INVALID_PARAMETER;
+ }
+ if ( dabWrite_Init(&hTpEnc->writer.dab, &hTpEnc->config) != 0) {
+ return TRANSPORTENC_INVALID_PARAMETER;
+ }
+ break;
+
case TT_MP4_LOAS:
case TT_MP4_LATM_MCP0:
case TT_MP4_LATM_MCP1:
@@ -383,6 +399,17 @@ TRANSPORTENC_ERROR transportEnc_WriteAccessUnit(
frameUsedBits
);
break;
+ case TT_DABPLUS:
+ bufferFullness /= ncc; /* Number of Considered Channels */
+ bufferFullness /= 32;
+ bufferFullness = FDKmin(0x7FF, bufferFullness); /* Signal variable rate */
+ dabWrite_EncodeHeader(
+ &hTp->writer.dab,
+ &hTp->bitStream,
+ bufferFullness,
+ frameUsedBits
+ );
+ break;
case TT_MP4_LOAS:
case TT_MP4_LATM_MCP0:
case TT_MP4_LATM_MCP1:
@@ -450,6 +477,9 @@ TRANSPORTENC_ERROR transportEnc_EndAccessUnit(HANDLE_TRANSPORTENC hTp, int *bits
case TT_MP4_ADTS:
adtsWrite_EndRawDataBlock(&hTp->writer.adts, &hTp->bitStream, bits);
break;
+ case TT_DABPLUS:
+ dabWrite_EndRawDataBlock(&hTp->writer.dab, &hTp->bitStream, bits);
+ break;
case TT_MP4_ADIF:
/* Substract ADIF header from AU bits, not to be considered. */
*bits -= adifWrite_GetHeaderBits(&hTp->writer.adif);
@@ -484,6 +514,14 @@ TRANSPORTENC_ERROR transportEnc_GetFrame(HANDLE_TRANSPORTENC hTpEnc, int *nbytes
*nbytes = 0;
}
break;
+ case TT_DABPLUS:
+ if (hTpEnc->writer.dab.currentBlock >= hTpEnc->writer.dab.num_raw_blocks+1) {
+ *nbytes = (FDKgetValidBits(hBs) + 7)>>3;
+ hTpEnc->writer.dab.currentBlock = 0;
+ } else {
+ *nbytes = 0;
+ }
+ break;
case TT_MP4_ADIF:
FDK_ASSERT((INT)FDKgetValidBits(hBs) >= 0);
*nbytes = (FDKgetValidBits(hBs) + 7)>>3;
@@ -518,6 +556,9 @@ INT transportEnc_GetStaticBits( HANDLE_TRANSPORTENC hTp, int auBits )
case TT_MP4_ADTS:
nbits = adtsWrite_GetHeaderBits(&hTp->writer.adts);
break;
+ case TT_DABPLUS:
+ nbits = dabWrite_CountTotalBitDemandHeader(&hTp->writer.dab, auBits);
+ break;
case TT_MP4_LOAS:
case TT_MP4_LATM_MCP0:
case TT_MP4_LATM_MCP1:
@@ -552,6 +593,9 @@ int transportEnc_CrcStartReg(HANDLE_TRANSPORTENC hTpEnc, int mBits)
case TT_MP4_ADTS:
crcReg = adtsWrite_CrcStartReg(&hTpEnc->writer.adts, &hTpEnc->bitStream, mBits);
break;
+ case TT_DABPLUS:
+ crcReg = dabWrite_CrcStartReg(&hTpEnc->writer.dab, &hTpEnc->bitStream, mBits);
+ break;
default:
break;
}
@@ -565,6 +609,9 @@ void transportEnc_CrcEndReg(HANDLE_TRANSPORTENC hTpEnc, int reg)
case TT_MP4_ADTS:
adtsWrite_CrcEndReg(&hTpEnc->writer.adts, &hTpEnc->bitStream, reg);
break;
+ case TT_DABPLUS:
+ dabWrite_CrcEndReg(&hTpEnc->writer.dab, &hTpEnc->bitStream, reg);
+ break;
default:
break;
}
@@ -630,6 +677,7 @@ TRANSPORTENC_ERROR transportEnc_GetLibInfo( LIB_INFO *info )
| CAPF_LATM
| CAPF_LOAS
| CAPF_RAWPACKETS
+ | CAPF_DAB_AAC
;
return TRANSPORTENC_OK;