private void parsePacket()
        throws MpegDecodeException, IOException
    {
        Statistics.startLog(PARSE_PACKET_STRING);
	System.out.println("Parsing packet");
        if(m_ioTool.getBits(24) != 0x1 )
        {
            Debug.println(Debug.ERROR, "Synchronization error in packet");
            throw new MpegDecodeException("Synchronization error in packet");
        }

        int streamId = m_ioTool.getBits(8);
        int pktLength = m_ioTool.getBits(16);

        if( streamId != PRIVATE_STREAM2 )
        {
            pktLength -= parseTimeStamps();
        }
                
        if(( streamId & 0xE0 ) == 0xC0 )
        {
            // Audio Stream
            //pktLength -= m_ioTool.getReadBytes();
            decodeAudio( pktLength );
        }
        else
        {
        
            if( (0xF0 & streamId) == 0xE0 )
            {
                decodeVideo(pktLength );
            }
            else if( ( 0xF0 & streamId ) == 0xF0 )
            {
                // Reserved Stream ID
                ;
            }
            else
            {
                switch(streamId)
                {
                case RESERVED_STREAM:
                case PRIVATE_STREAM1:
                case PADDING_STREAM:
                case PRIVATE_STREAM2:
                    break;
                default:
                    Debug.println(Debug.ERROR, "Unknown Stream: " + streamId);
                    throw new MpegDecodeException("Unknown Stream: " + streamId);
                }
            }
        }
        Statistics.endLog(PARSE_PACKET_STRING);
    }