st->codec.sample_rate = get_v(bc) * (double)(st->codec.frame_rate_base / st->codec.frame_rate);
st->codec.sample_rate = (get_v(bc) * nom) / denom;
static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap){    NUTContext *nut = s->priv_data;    ByteIOContext *bc = &s->pb;    uint64_t tmp;    int cur_stream, nb_streams;        /* main header */    tmp = get_be64(bc);    if (tmp != MAIN_STARTCODE)	fprintf(stderr, "damaged? startcode!=1 (%Ld)\n", tmp);    get_packetheader(nut, bc);        tmp = get_v(bc);    if (tmp != 0)	fprintf(stderr, "bad version (%Ld)\n", tmp);        nb_streams = get_v(bc);    get_be32(bc); /* checkusm */        s->bit_rate = 0;        /* stream header */    for (cur_stream = 0; cur_stream < nb_streams; cur_stream++)    {	int class;	AVStream *st;		tmp = get_be64(bc);	if (tmp != STREAM_STARTCODE)	    fprintf(stderr, "damaged? startcode!=1 (%Ld)\n", tmp);	get_packetheader(nut, bc);	st = av_new_stream(s, get_v(bc));	if (!st)	    return AVERROR_NOMEM;	class = get_v(bc);	tmp = get_bi(bc);	switch(class)	{	    case 0:		st->codec.codec_type = CODEC_TYPE_VIDEO;		st->codec.codec_id = codec_get_bmp_id(tmp);		if (st->codec.codec_id == CODEC_ID_NONE)		    fprintf(stderr, "Unknown codec?!\n");		break;	    case 32:		st->codec.codec_type = CODEC_TYPE_AUDIO;		st->codec.codec_id = codec_get_wav_id(tmp);		if (st->codec.codec_id == CODEC_ID_NONE)		    fprintf(stderr, "Unknown codec?!\n");		break;	    default:		fprintf(stderr, "Unknown stream class (%d)\n", class);		return -1;	}	s->bit_rate += get_v(bc);	get_b(bc, NULL, 0); /* language code */	st->codec.frame_rate_base = get_v(bc);	st->codec.frame_rate = get_v(bc);	get_v(bc); /* FIXME: msb timestamp base */	get_v(bc); /* shuffle type */	get_byte(bc); /* flags */		get_v(bc); /* FIXME: codec specific data headers */		if (class == 0) /* VIDEO */	{	    st->codec.width = get_v(bc);	    st->codec.height = get_v(bc);	    get_v(bc); /* aspected w */	    get_v(bc); /* aspected h */	    get_v(bc); /* csp type */	    get_be32(bc); /* checksum */	}	if (class == 32) /* AUDIO */	{	    st->codec.sample_rate = get_v(bc) * (double)(st->codec.frame_rate_base / st->codec.frame_rate);	    st->codec.channels = get_v(bc);	    get_be32(bc); /* checksum */	}    }            return 0;}