public static OggAudioStreamHeaders create(OggPacket firstPacket) {
        if (firstPacket.isBeginningOfStream() &&
                firstPacket.getData() != null &&
                firstPacket.getData().length > 10) {
            int sid = firstPacket.getSid();
            if (VorbisPacketFactory.isVorbisStream(firstPacket)) {
                return new OggAudioStreamHeaders(sid, 
                        OggStreamIdentifier.OGG_VORBIS,
                        (VorbisInfo)VorbisPacketFactory.create(firstPacket));
            }
            if (SpeexPacketFactory.isSpeexStream(firstPacket)) {
                return new OggAudioStreamHeaders(sid, 
                        OggStreamIdentifier.SPEEX_AUDIO,
                        (SpeexInfo)SpeexPacketFactory.create(firstPacket));
            }
            if (OpusPacketFactory.isOpusStream(firstPacket)) {
                return new OggAudioStreamHeaders(sid, 
                        OggStreamIdentifier.OPUS_AUDIO,
                        (OpusInfo)OpusPacketFactory.create(firstPacket));
            }
            if (FlacFirstOggPacket.isFlacStream(firstPacket)) {
                FlacFirstOggPacket flac = new FlacFirstOggPacket(firstPacket);
                return new OggAudioStreamHeaders(sid, 
                        OggStreamIdentifier.OGG_FLAC,
                        flac.getInfo());
            }
            throw new IllegalArgumentException("Unsupported stream of type " + OggStreamIdentifier.identifyType(firstPacket));
        } else {
            throw new IllegalArgumentException("May only be called for the first packet in a stream, with data");
        }
    }