st->codec.frame_rate = framerate; st->codec.frame_rate_base = AV_TIME_BASE; av_set_pts_info(st, 64, AV_TIME_BASE, framerate);
av_set_pts_info(st, 64, framerate.den, framerate.num); st->codec.frame_rate = framerate.num; st->codec.frame_rate_base = framerate.den;
static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap){    NSVContext *nsv = s->priv_data;    ByteIOContext *pb = &s->pb;    uint32_t vtag, atag;    uint16_t vwidth, vheight;    uint32_t framerate;    uint16_t unknown;    AVStream *st;    NSVStream *nst;    PRINT(("%s()\n", __FUNCTION__));    vtag = get_le32(pb);    atag = get_le32(pb);    vwidth = get_le16(pb);    vheight = get_le16(pb);    framerate = (uint8_t)get_byte(pb);    /* XXX how big must the table be ? */    /* seems there is more to that... */    PRINT(("NSV NSVs framerate code %2x\n", framerate));    framerate = (framerate & 0x80)?(nsv_framerate_table[framerate & 0x7F]):(framerate*AV_TIME_BASE);    unknown = get_le16(pb);#ifdef DEBUG    print_tag("NSV NSVs vtag", vtag, 0);    print_tag("NSV NSVs atag", atag, 0);    PRINT(("NSV NSVs vsize %dx%d\n", vwidth, vheight));    PRINT(("NSV NSVs framerate %2x\n", framerate));#endif        /* XXX change to ap != NULL ? */    if (s->nb_streams == 0) { /* streams not yet published, let's do that */        nsv->vtag = vtag;        nsv->atag = atag;        nsv->vwidth = vwidth;        nsv->vheight = vwidth;        if (vtag != T_NONE) {            st = av_new_stream(s, NSV_ST_VIDEO);            if (!st)                goto fail;            nst = av_mallocz(sizeof(NSVStream));            if (!nst)                goto fail;            st->priv_data = nst;            st->codec.codec_type = CODEC_TYPE_VIDEO;            st->codec.codec_tag = vtag;            st->codec.codec_id = codec_get_id(nsv_codec_video_tags, vtag);            st->codec.width = vwidth;            st->codec.height = vheight;            st->codec.bits_per_sample = 24; /* depth XXX */            st->codec.frame_rate = framerate;            st->codec.frame_rate_base = AV_TIME_BASE;            av_set_pts_info(st, 64, AV_TIME_BASE, framerate);            st->start_time = 0;            st->duration = nsv->duration;        }        if (atag != T_NONE) {#ifndef DISABLE_AUDIO            st = av_new_stream(s, NSV_ST_AUDIO);            if (!st)                goto fail;            nst = av_mallocz(sizeof(NSVStream));            if (!nst)                goto fail;            st->priv_data = nst;            st->codec.codec_type = CODEC_TYPE_AUDIO;            st->codec.codec_tag = atag;            st->codec.codec_id = codec_get_id(nsv_codec_audio_tags, atag);            st->start_time = 0;            st->duration = nsv->duration;                        st->need_parsing = 1; /* for PCM we will read a chunk later and put correct info */            /* XXX:FIXME */            //st->codec.channels = 2; //XXX:channels;            //st->codec.sample_rate = 1000;            //av_set_pts_info(st, 64, 1, st->codec.sample_rate);#endif        }#ifdef CHECK_SUBSEQUENT_NSVS    } else {        if (nsv->vtag != vtag || nsv->atag != atag || nsv->vwidth != vwidth || nsv->vheight != vwidth) {            PRINT(("NSV NSVs header values differ from the first one!!!\n"));            //return -1;        }#endif /* CHECK_SUBSEQUENT_NSVS */    }    nsv->state = NSV_HAS_READ_NSVS;    return 0;fail:    /* XXX */    nsv->state = NSV_UNSYNC;    return -1;}