public Header readFrame ( ) throws BitstreamException { Header result = null ; try { result = readNextFrame ( ) ; // E.B, Parse VBR (if any) first frame. if ( firstframe == true ) { result . parseVBR ( frame_bytes ) ; firstframe = false ; } } catch ( BitstreamException ex ) { if ( ( ex . getErrorCode ( ) == INVALIDFRAME ) ) { // Try to skip this frame. //System.out.println("INVALIDFRAME"); try { closeFrame ( ) ; result = readNextFrame ( ) ; } catch ( BitstreamException e ) { if ( ( e . getErrorCode ( ) != STREAM_EOF ) ) { // wrap original exception so stack trace is maintained. throw newBitstreamException ( e . getErrorCode ( ) , e ) ; } } } else if ( ( ex . getErrorCode ( ) != STREAM_EOF ) ) { // wrap original exception so stack trace is maintained. throw newBitstreamException ( ex . getErrorCode ( ) , ex ) ; } } return result ; }
Reads and parses the next frame from the input source .