Revision abb785f1 libavformat/idroq.c

View differences:

libavformat/idroq.c
46 46
    int width;
47 47
    int height;
48 48
    int audio_channels;
49
    int framerate;
50
    int frame_pts_inc;
51 49

  
52 50
    int video_stream_index;
53 51
    int audio_stream_index;
......
71 69
{
72 70
    RoqDemuxContext *roq = s->priv_data;
73 71
    ByteIOContext *pb = s->pb;
72
    int framerate;
74 73
    AVStream *st;
75 74
    unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
76 75

  
......
78 77
    if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
79 78
        RoQ_CHUNK_PREAMBLE_SIZE)
80 79
        return AVERROR(EIO);
81
    roq->framerate = AV_RL16(&preamble[6]);
82
    roq->frame_pts_inc = 90000 / roq->framerate;
80
    framerate = AV_RL16(&preamble[6]);
83 81

  
84 82
    /* init private context parameters */
85 83
    roq->width = roq->height = roq->audio_channels = roq->video_pts =
......
89 87
    st = av_new_stream(s, 0);
90 88
    if (!st)
91 89
        return AVERROR(ENOMEM);
92
    /* set the pts reference (1 pts = 1/90000) */
93
    av_set_pts_info(st, 33, 1, 90000);
90
    av_set_pts_info(st, 63, 1, framerate);
94 91
    roq->video_stream_index = st->index;
95 92
    st->codec->codec_type = CODEC_TYPE_VIDEO;
96 93
    st->codec->codec_id = CODEC_ID_ROQ;
......
161 158
            if (ret != chunk_size)
162 159
                return AVERROR(EIO);
163 160
            pkt->stream_index = roq->video_stream_index;
164
            pkt->pts = roq->video_pts;
161
            pkt->pts = roq->video_pts++;
165 162

  
166
            roq->video_pts += roq->frame_pts_inc;
167 163
            packet_read = 1;
168 164
            break;
169 165

  
......
173 169
                AVStream *st = av_new_stream(s, 1);
174 170
                if (!st)
175 171
                    return AVERROR(ENOMEM);
176
                av_set_pts_info(st, 33, 1, 90000);
172
                av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
177 173
                roq->audio_stream_index = st->index;
178 174
                st->codec->codec_type = CODEC_TYPE_AUDIO;
179 175
                st->codec->codec_id = CODEC_ID_ROQ_DPCM;
......
194 190

  
195 191
            if (chunk_type == RoQ_QUAD_VQ) {
196 192
                pkt->stream_index = roq->video_stream_index;
197
                pkt->pts = roq->video_pts;
198
                roq->video_pts += roq->frame_pts_inc;
193
                pkt->pts = roq->video_pts++;
199 194
            } else {
200 195
                pkt->stream_index = roq->audio_stream_index;
201 196
                pkt->pts = roq->audio_frame_count;
202
                pkt->pts *= 90000;
203
                pkt->pts /= RoQ_AUDIO_SAMPLE_RATE;
204 197
                roq->audio_frame_count += (chunk_size / roq->audio_channels);
205 198
            }
206 199

  

Also available in: Unified diff