public HashMap getTags(RandomAccessFile s) throws IOException {
		long offset = 0;
		int  retry  = 64;
		boolean need_tags = true;
		boolean need_id = true;

		HashMap tags = new HashMap();
		HashMap identification = new HashMap();
		
		for( ; retry > 0 ; retry-- ) {
			PageInfo pi = parse_stream_page(s, offset);
			if(pi.type == OGG_TYPE_IDENTIFICATION) {
				identification = parse_ogg_vorbis_identification(s, offset+pi.header_len, pi.payload_len);
				need_id = false;
			} else if(pi.type == OGG_TYPE_COMMENT) {
				tags = parse_ogg_vorbis_comment(s, offset+pi.header_len, pi.payload_len);
				need_tags = false;
			}
			offset += pi.header_len + pi.payload_len;
			if (need_tags == false && need_id == false) {
				break;
			}
		}

		// Calculate duration in seconds
		// Note that this calculation is WRONG: We would have to get the last
		// packet to calculate the real length - but this is goot enough.
		if (identification.containsKey("bitrate_nominal")) {
			int br_nom = (Integer)identification.get("bitrate_nominal") / 8;
			long file_length = s.length();
			if (file_length > 0 && br_nom > 0) {
				tags.put("duration", (int)(file_length/br_nom));
			}
		}

		return tags;
	}