Revision 03c03afd libavformat/ipmovie.c

View differences:

libavformat/ipmovie.c
93 93
    unsigned char *buf;
94 94
    int buf_size;
95 95

  
96
    float fps;
97
    int frame_pts_inc;
96
    uint64_t frame_pts_inc;
98 97

  
99 98
    unsigned int video_width;
100 99
    unsigned int video_height;
......
126 125
    AVPacket *pkt) {
127 126

  
128 127
    int chunk_type;
129
    int64_t audio_pts = 0;
130 128

  
131 129
    if (s->audio_chunk_offset) {
132 130

  
......
139 137
        url_fseek(pb, s->audio_chunk_offset, SEEK_SET);
140 138
        s->audio_chunk_offset = 0;
141 139

  
142
        /* figure out the audio pts */
143
        audio_pts = 90000;
144
        audio_pts *= s->audio_frame_count;
145
        audio_pts /= s->audio_sample_rate;
146

  
147 140
        if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size))
148 141
            return CHUNK_EOF;
149 142

  
150 143
        pkt->stream_index = s->audio_stream_index;
151
        pkt->pts = audio_pts;
144
        pkt->pts = s->audio_frame_count;
152 145

  
153 146
        /* audio frame maintenance */
154 147
        if (s->audio_type != CODEC_ID_INTERPLAY_DPCM)
......
159 152
                (s->audio_chunk_size - 6) / s->audio_channels;
160 153

  
161 154
        debug_ipmovie("sending audio frame with pts %"PRId64" (%d audio frames)\n",
162
            audio_pts, s->audio_frame_count);
155
            pkt->pts, s->audio_frame_count);
163 156

  
164 157
        chunk_type = CHUNK_VIDEO;
165 158

  
......
327 320
                chunk_type = CHUNK_BAD;
328 321
                break;
329 322
            }
330
            s->fps = 1000000.0 / (AV_RL32(&scratch[0]) * AV_RL16(&scratch[4]));
331
            s->frame_pts_inc = 90000 / s->fps;
323
            s->frame_pts_inc = ((uint64_t)AV_RL32(&scratch[0])) * AV_RL16(&scratch[4]);
332 324
            debug_ipmovie("  %.2f frames/second (timer div = %d, subdiv = %d)\n",
333
                s->fps, AV_RL32(&scratch[0]), AV_RL16(&scratch[4]));
325
                1000000.0/s->frame_pts_inc, AV_RL32(&scratch[0]), AV_RL16(&scratch[4]));
334 326
            break;
335 327

  
336 328
        case OPCODE_INIT_AUDIO_BUFFERS:
......
554 546
    st = av_new_stream(s, 0);
555 547
    if (!st)
556 548
        return AVERROR(ENOMEM);
557
    av_set_pts_info(st, 33, 1, 90000);
549
    av_set_pts_info(st, 63, 1, 1000000);
558 550
    ipmovie->video_stream_index = st->index;
559 551
    st->codec->codec_type = CODEC_TYPE_VIDEO;
560 552
    st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO;
......
569 561
        st = av_new_stream(s, 0);
570 562
        if (!st)
571 563
            return AVERROR(ENOMEM);
572
        av_set_pts_info(st, 33, 1, 90000);
564
        av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
573 565
        ipmovie->audio_stream_index = st->index;
574 566
        st->codec->codec_type = CODEC_TYPE_AUDIO;
575 567
        st->codec->codec_id = ipmovie->audio_type;

Also available in: Unified diff