/** * Reads and parses the next frame from the input source. * @return the Header describing details of the frame read, or null if the end of the stream has been reached. */ 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; }
if ((ex.getErrorCode()==INVALIDFRAME)) if ((e.getErrorCode()!=STREAM_EOF)) throw newBitstreamException(e.getErrorCode(), e); else if ((ex.getErrorCode()!=STREAM_EOF)) throw newBitstreamException(ex.getErrorCode(), ex);
if ((ex.getErrorCode()==INVALIDFRAME)) if ((e.getErrorCode()!=STREAM_EOF)) throw newBitstreamException(e.getErrorCode(), e); else if ((ex.getErrorCode()!=STREAM_EOF)) throw newBitstreamException(ex.getErrorCode(), ex);
if ((ex.getErrorCode()==INVALIDFRAME)) if ((e.getErrorCode()!=STREAM_EOF)) throw newBitstreamException(e.getErrorCode(), e); else if ((ex.getErrorCode()!=STREAM_EOF)) throw newBitstreamException(ex.getErrorCode(), ex);
if ((ex.getErrorCode() == INVALIDFRAME)) { if ((e.getErrorCode() != STREAM_EOF)) { throw newBitstreamException(e.getErrorCode(), e); } else if ((ex.getErrorCode() != STREAM_EOF)) { throw newBitstreamException(ex.getErrorCode(), ex);