3gp file has one atom called 'smhd' (sound media header). The size mentioned as per ISO standard is 16 bytes:
A:
aligned(8) class SoundMediaHeaderBox
extends FullBox(‘smhd’, version = 0, 0) {
template int(16) balance = 0;
const unsigned int(16) reserved = 0;
}
Total: 4 bytes
B:
aligned(8) class FullBox(unsigned int(32) boxtype, unsigned int(8) v, bit(24) f)
extends Box(boxtype) {
unsigned int(8) version = v;
bit(24) flags = f;
}
Total: A + 4 bytes = 8 bytes
C:
aligned(8) class Box (unsigned int(32) boxtype,
optional unsigned int(8)[16] extended_type) {
unsigned int(32) size;
unsigned int(32) type = boxtype;
}
Total: B + 8 = 16 bytes
When I am recording a 3gp file, I am appending 4 bytes in atom 'A' for padding (for faster performance) like this:
aligned(8) class SoundMediaHeaderBox
extends FullBox(‘smhd’, version = 0, 0) {
template int(16) balance = 0;
const unsigned int(16) reserved = 0;
const unsigned int(32) myPadding = 0;
}
and in atom 'C', instead of saying 16 for size variable, I am assigning 20 (which is correct)
VLC player and other players are able to play it. The 3gp file also plays on Nokia mobile. But on certain player it fails because of the mismatch in size.
My question is, is it wrong to add a padding field in an existing atom?
--
Aakash