summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2015-04-13 22:39:18 +0200
committerStefan Pöschel <github@basicmaster.de>2015-04-13 22:39:18 +0200
commitc6cbb0864a40effe1219116f0f2b541c46d96024 (patch)
treecb6174aed459416a976da747ba4274c238406cb6 /src
parentc29478792f0052d37ef8f706e29b81ee20f4bb62 (diff)
downloadfdk-aac-dabplus-c6cbb0864a40effe1219116f0f2b541c46d96024.tar.gz
fdk-aac-dabplus-c6cbb0864a40effe1219116f0f2b541c46d96024.tar.bz2
fdk-aac-dabplus-c6cbb0864a40effe1219116f0f2b541c46d96024.zip
Fix continuity index at MOT data group
Diffstat (limited to 'src')
-rw-r--r--src/mot-encoder.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp
index 37a2657..0c39556 100644
--- a/src/mot-encoder.cpp
+++ b/src/mot-encoder.cpp
@@ -212,7 +212,7 @@ void createMotHeader(
int* mothdrlen,
bool jfif_not_png);
-void createMscDG(MSCDG* msc, unsigned short int dgtype, unsigned short int cindex,
+void createMscDG(MSCDG* msc, unsigned short int dgtype, int *cindex, unsigned short int segnum,
unsigned short int lastseg, unsigned short int tid, unsigned char* data,
unsigned short int datalen);
@@ -232,6 +232,11 @@ size_t get_xpadlength(int mask);
#define ALLOWED_PADLEN "6 (short X-PAD; only DLS), 23, 26, 34, 42, 58"
+// MOT Slideshow related
+static int cindex_header = 0;
+static int cindex_body = 0;
+
+
// DLS related
#define DLS_SEG_LEN_PREFIX 2
#define DLS_SEG_LEN_CHAR_MAX 16
@@ -745,7 +750,7 @@ int encodeFile(int output_fd, std::string& fname, int fidx, int padlen, bool raw
createMotHeader(blobsize, fidx, mothdr, &mothdrlen, jfif_not_png);
// Create the MSC Data Group C-Structure
- createMscDG(&msc, 3, 0, 1, fidx, mothdr, mothdrlen);
+ createMscDG(&msc, 3, &cindex_header, 0, 1, fidx, mothdr, mothdrlen);
// Generate the MSC DG frame (Figure 9 en 300 401)
packMscDG(mscblob, &msc, &mscblobsize);
writeMotPAD(output_fd, mscblob, mscblobsize, padlen);
@@ -761,7 +766,7 @@ int encodeFile(int output_fd, std::string& fname, int fidx, int padlen, bool raw
last = 0;
}
- createMscDG(&msc, 4, i, last, fidx, curseg, curseglen);
+ createMscDG(&msc, 4, &cindex_body, i, last, fidx, curseg, curseglen);
packMscDG(mscblob, &msc, &mscblobsize);
writeMotPAD(output_fd, mscblob, mscblobsize, padlen);
}
@@ -822,7 +827,7 @@ void createMotHeader(size_t blobsize, int fidx, unsigned char* mothdr, int* moth
}
void createMscDG(MSCDG* msc, unsigned short int dgtype,
- unsigned short int cindex, unsigned short int lastseg,
+ int *cindex, unsigned short int segnum, unsigned short int lastseg,
unsigned short int tid, unsigned char* data,
unsigned short int datalen)
{
@@ -831,10 +836,10 @@ void createMscDG(MSCDG* msc, unsigned short int dgtype,
msc->segflag = 1;
msc->accflag = 1;
msc->dgtype = dgtype;
- msc->cindex = cindex;
+ msc->cindex = *cindex;
msc->rindex = 0;
msc->last = lastseg;
- msc->segnum = cindex;
+ msc->segnum = segnum;
msc->rfa = 0;
msc->tidflag = 1;
msc->lenid = 2;
@@ -842,6 +847,8 @@ void createMscDG(MSCDG* msc, unsigned short int dgtype,
msc->segdata = data;
msc->rcount = 0;
msc->seglen = datalen;
+
+ *cindex = (*cindex + 1) % 16; // increment continuity index
}