Example #1
0
File: other.cpp Project: 2php/mp4v2
bool
fileFetchSummaryInfo( MP4FileHandle file, FileSummaryInfo& info )
{
    if( file == MP4_INVALID_FILE_HANDLE )
        return true;
    MP4File& mp4 = *((MP4File*)file);

    MP4Atom* root = mp4.FindAtom( "" );
    if( !root )
        return true;

    MP4FtypAtom* ftyp = (MP4FtypAtom*)root->FindAtom( "ftyp" );
    if( !ftyp )
        return true;

    info.major_brand   = ftyp->majorBrand.GetValue();
    info.minor_version = ftyp->minorVersion.GetValue();

    const uint32_t cbmax = ftyp->compatibleBrands.GetCount();
    for( uint32_t i = 0; i < cbmax; i++ ) {
        string s = ftyp->compatibleBrands.GetValue( i );

        // remove spaces so brand set is presentable
        string stripped;
        const string::size_type max = s.length();
        for( string::size_type pos = 0; pos < max; pos++ ) {
            if( s[pos] != ' ' )
                stripped += s[pos];
        }

        if( stripped.empty() )
            continue;

        info.compatible_brands.insert( stripped );
    }

    info.nlargesize = 0;
    info.nversion1  = 0;
    info.nspecial   = 0;
    searchFor64bit( *root, info );

    return false;
}