Closed GoogleCodeExporter closed 9 years ago
Hi,
ok, after two days of investigation I found the problem: the property values of
the mean and name tags are written as null terminated string. The '\0'
character at the end is included in the atom. That's an issue, because iTunes
expect a fixed length string without terminating zero.
I fixed it in generic.cpp by setting the fixed length parameter to the actual
sting length:
static bool
__itemModelToAtom( const MP4ItmfItem& model, MP4ItemAtom& atom )
{
if( ATOMID( atom.GetType() ) == ATOMID( "----" )) {
ASSERT( model.mean ); // mandatory
MP4MeanAtom& meanAtom = *(MP4MeanAtom*)MP4Atom::CreateAtom( &atom, "mean" );
atom.AddChildAtom( &meanAtom );
meanAtom.value.SetValue( model.mean );
> meanAtom.value.SetFixedLength( strlen(model.mean) );
if( model.name ) {
MP4NameAtom& nameAtom = *(MP4NameAtom*)MP4Atom::CreateAtom( &atom, "name" );
atom.AddChildAtom( &nameAtom );
nameAtom.value.SetValue( model.name );
> nameAtom.value.SetFixedLength( strlen(model.name) );
}
}
for( uint32_t i = 0; i < model.dataList.size; i++ ) {
...
Original comment by holgr.ja...@googlemail.com
on 5 Jan 2012 at 8:30
I'll work on getting this change in today; if I understand you correctly,
you're basically just telling the atom the length of the value, so existing
code that expected a NULL terminator would still work correctly?
Original comment by kid...@gmail.com
on 5 Jan 2012 at 7:02
Actually, sorry--have you tried trunk, or the current developer release? The
code that's currently there is significantly different from what's in 1.9.0
(which, actually, I'd advise against using because there's a ton of known
issues):
static bool
__itemModelToAtom( const MP4ItmfItem& model, MP4ItemAtom& atom )
{
if( ATOMID( atom.GetType() ) == ATOMID( "----" )) {
ASSERT( model.mean ); // mandatory
MP4MeanAtom& meanAtom = *(MP4MeanAtom*)MP4Atom::CreateAtom( atom.GetFile(), &atom, "mean" );
atom.AddChildAtom( &meanAtom );
meanAtom.value.SetValue( (const uint8_t*)model.mean, (uint32_t)strlen( model.mean ));
if( model.name ) {
MP4NameAtom& nameAtom = *(MP4NameAtom*)MP4Atom::CreateAtom( atom.GetFile(), &atom, "name" );
atom.AddChildAtom( &nameAtom );
nameAtom.value.SetValue( (const uint8_t*)model.name, (uint32_t)strlen( model.name ));
}
}
I want to do a release soon, and now might be as good a time as any if this is
a bug we can fix (or establish as fixed).
Original comment by kid...@gmail.com
on 5 Jan 2012 at 7:13
Closing this bug; already fixed in trunk. Please let me know if you have an
issue w/trunk and I'll revisit the issue.
Original comment by kid...@gmail.com
on 19 Mar 2012 at 2:37
Original issue reported on code.google.com by
holgr.ja...@googlemail.com
on 20 Dec 2011 at 10:46