Ignore:
Timestamp:
12/30/06 17:49:40 (18 years ago)
Author:
r2d
Message:
  • moved skip_id3v2 to demuxer and changed so it doesn't need seek (not tested with id3v2 tags)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/libmpcdec/mpc_reader.c

    r195 r196  
    136136}
    137137
    138 mpc_int32_t
    139 mpc_skip_id3v2(mpc_reader* p_reader)
    140 {
    141     mpc_uint8_t  tmp [10];
    142     mpc_uint32_t unsynchronisation; // ID3v2.4-flag
    143     mpc_uint32_t extHeaderPresent;  // ID3v2.4-flag
    144     mpc_uint32_t experimentalFlag;  // ID3v2.4-flag
    145     mpc_uint32_t footerPresent;     // ID3v2.4-flag
    146     mpc_int32_t  ret;
    147 
    148     // seek to first byte of mpc data
    149     ret = p_reader->seek(p_reader, 0);
    150     if(!ret) return 0;
    151 
    152     p_reader->read(p_reader, tmp, sizeof tmp);
    153 
    154     // check id3-tag
    155     if ( 0 != memcmp( tmp, "ID3", 3 ) )
    156         return 0;
    157 
    158     // read flags
    159     unsynchronisation = tmp[5] & 0x80;
    160     extHeaderPresent  = tmp[5] & 0x40;
    161     experimentalFlag  = tmp[5] & 0x20;
    162     footerPresent     = tmp[5] & 0x10;
    163 
    164     if ( tmp[5] & 0x0F )
    165         return MPC_STATUS_FILE; // not (yet???) allowed
    166     if ( (tmp[6] | tmp[7] | tmp[8] | tmp[9]) & 0x80 )
    167         return MPC_STATUS_FILE; // not allowed
    168 
    169     // read headerSize (syncsave: 4 * $0xxxxxxx = 28 significant bits)
    170     ret  = tmp[6] << 21;
    171     ret += tmp[7] << 14;
    172     ret += tmp[8] <<  7;
    173     ret += tmp[9];
    174     ret += 10;
    175     if ( footerPresent )
    176         ret += 10;
    177 
    178     return ret;
    179 }
    180 
    181 
    182 
Note: See TracChangeset for help on using the changeset viewer.