summaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-25 19:30:12 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-25 19:30:12 +0100
commit05e6de86461b4ab0c55880db0c83d7a7bd6c5bc1 (patch)
tree9804f6b9519f508f79480b4a3390b357fc183b1a /libAACenc/src
parentab1f4c8796e0699b16eb95658fd534145af5600b (diff)
downloadfdk-aac-dabplus-05e6de86461b4ab0c55880db0c83d7a7bd6c5bc1.tar.gz
fdk-aac-dabplus-05e6de86461b4ab0c55880db0c83d7a7bd6c5bc1.tar.bz2
fdk-aac-dabplus-05e6de86461b4ab0c55880db0c83d7a7bd6c5bc1.zip
Write DSE at start of AU
To respect the ETSI standard for XPAD in DAB+
Diffstat (limited to 'libAACenc/src')
-rw-r--r--libAACenc/src/bitenc.cpp64
1 files changed, 36 insertions, 28 deletions
diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp
index 6f2c151..c7f698a 100644
--- a/libAACenc/src/bitenc.cpp
+++ b/libAACenc/src/bitenc.cpp
@@ -1302,6 +1302,41 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
frameBits = bitMarkUp = alignAnchor;
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Block moved in order to write DSE at the beginning of the bit stream - Sergio Sagliocco (CSP)
+
+ /* Add fill data / stuffing bits */
+ n = qcOut->nExtensions;
+
+// if (!(syntaxFlags & AC_DAB)) {
+ qcOut->extension[n].type = EXT_FILL_DATA;
+ qcOut->extension[n].nPayloadBits = qcOut->totFillBits;
+ qcOut->nExtensions++;
+// } else {
+// doByteAlign = 0;
+// }
+ if (syntaxFlags & AC_DAB)
+ doByteAlign = 0;
+
+ /* Write global extension payload and fill data */
+ for (n = 0; (n < qcOut->nExtensions) && (n < (2+2)); n++)
+ {
+ //fprintf(stderr,"SERGIO FDKaacEnc_WriteBitstream: call FDKaacEnc_writeExtensionData - 3 (%d)\n",n);
+
+ FDKaacEnc_writeExtensionData( hTpEnc,
+ &qcOut->extension[n],
+ 0,
+ alignAnchor,
+ syntaxFlags,
+ aot,
+ epConfig );
+
+ /* For EXT_FIL or EXT_FILL_DATA we could do an additional sanity check here */
+ }
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
/* Channel element loop */
for (i=0; i<channelMapping->nElements; i++) {
@@ -1362,7 +1397,7 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
if ( (syntaxFlags & AC_ER) && !(syntaxFlags & AC_DRM) )
{
- UCHAR channelElementExtensionWritten[(8)][(1)]; /* 0: extension not touched, 1: extension already written */
+ UCHAR channelElementExtensionWritten[(6)][(1)]; /* 0: extension not touched, 1: extension already written */
FDKmemclear(channelElementExtensionWritten, sizeof(channelElementExtensionWritten));
@@ -1429,33 +1464,6 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
} /* AC_DRM */
- /* Add fill data / stuffing bits */
- n = qcOut->nExtensions;
-
-// if (!(syntaxFlags & AC_DAB)) {
- qcOut->extension[n].type = EXT_FILL_DATA;
- qcOut->extension[n].nPayloadBits = qcOut->totFillBits;
- qcOut->nExtensions++;
-// } else {
-// doByteAlign = 0;
-// }
- if (syntaxFlags & AC_DAB)
- doByteAlign = 0;
-
- /* Write global extension payload and fill data */
- for (n = 0; (n < qcOut->nExtensions) && (n < (2+2)); n++)
- {
- FDKaacEnc_writeExtensionData( hTpEnc,
- &qcOut->extension[n],
- 0,
- alignAnchor,
- syntaxFlags,
- aot,
- epConfig );
-
- /* For EXT_FIL or EXT_FILL_DATA we could do an additional sanity check here */
- }
-
if (!(syntaxFlags & (AC_SCALABLE|AC_ER|AC_DAB))) {
FDKwriteBits(hBs, ID_END, EL_ID_BITS);
}