summaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
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);
}