Back to index

eyed3  0.6.18
Public Member Functions | Public Attributes | Static Public Attributes
mp3.XingHeader Class Reference

List of all members.

Public Member Functions

def decode

Public Attributes

 vbr
 numFrames
 numBytes
 toc
 vbrScale

Static Public Attributes

tuple numFrames = int()
tuple numBytes = int()
list toc = [0]
tuple vbrScale = int()

Detailed Description

Definition at line 281 of file mp3.py.


Member Function Documentation

def mp3.XingHeader.decode (   self,
  frame 
)

Definition at line 291 of file mp3.py.

00291 
00292    def decode(self, frame):
00293       # mp3 version
00294       version = (ord(frame[1]) >> 3) & 0x1;
00295       # channel mode.
00296       mode = (ord(frame[3]) >> 6) & 0x3;
00297 
00298       # Find the start of the Xing header.
00299       if version:
00300          if mode != 3:
00301             pos = 32 + 4;
00302          else:
00303             pos = 17 + 4;
00304       else:
00305          if mode != 3:
00306             pos = 17 + 4;
00307          else:
00308             pos = 9 + 4;
00309       head = frame[pos:pos+4]
00310       self.vbr = (head == 'Xing') and True or False
00311       if head not in ['Xing', 'Info']:
00312           return 0
00313       TRACE_MSG("%s header detected @ %x" % (head, pos));
00314       pos += 4;
00315 
00316       # Read Xing flags.
00317       headFlags = bin2dec(bytes2bin(frame[pos:pos + 4]));
00318       pos += 4;
00319       TRACE_MSG("%s header flags: 0x%x" % (head, headFlags));
00320 
00321       # Read frames header flag and value if present
00322       if headFlags & FRAMES_FLAG:
00323          self.numFrames = bin2dec(bytes2bin(frame[pos:pos + 4]));
00324          pos += 4;
00325          TRACE_MSG("%s numFrames: %d" % (head, self.numFrames));
00326 
00327       # Read bytes header flag and value if present
00328       if headFlags & BYTES_FLAG:
00329          self.numBytes = bin2dec(bytes2bin(frame[pos:pos + 4]));
00330          pos += 4;
00331          TRACE_MSG("%s numBytes: %d" % (head, self.numBytes));
00332 
00333       # Read TOC header flag and value if present
00334       if headFlags & TOC_FLAG:
00335          i = 0;
00336          self.toc = frame[pos:pos + 100];
00337          pos += 100;
00338          TRACE_MSG("%s TOC (100 bytes): PRESENT" % head);
00339       else:
00340          TRACE_MSG("%s TOC (100 bytes): NOT PRESENT" % head);
00341 
00342       # Read vbr scale header flag and value if present
00343       if headFlags & VBR_SCALE_FLAG and head == 'Xing':
00344          self.vbrScale = bin2dec(bytes2bin(frame[pos:pos + 4]));
00345          pos += 4;
00346          TRACE_MSG("%s vbrScale: %d" % (head, self.vbrScale));
00347 
00348       return 1;

Here is the caller graph for this function:


Member Data Documentation

tuple mp3.XingHeader.numBytes = int() [static]

Definition at line 283 of file mp3.py.

Definition at line 328 of file mp3.py.

tuple mp3.XingHeader.numFrames = int() [static]

Definition at line 282 of file mp3.py.

Definition at line 322 of file mp3.py.

list mp3.XingHeader.toc = [0] [static]

Definition at line 284 of file mp3.py.

Definition at line 335 of file mp3.py.

Definition at line 309 of file mp3.py.

tuple mp3.XingHeader.vbrScale = int() [static]

Definition at line 285 of file mp3.py.

Definition at line 343 of file mp3.py.


The documentation for this class was generated from the following file: