Revision 69ae8acb out-stream-avf.c

View differences:

out-stream-avf.c
122 122
    frame_header_parse(data + header_size + FRAME_HEADER_SIZE * i,
123 123
                       &frame_size, &pts, &dts);
124 124
    dprintf("Frame %d PTS1: %d\n", i, pts);
125
    pts += (pts < prev_pts - (1 << 15)) ? ((prev_pts >> 16) + 1) << 16 : (prev_pts >> 16) << 16;
126
    dprintf(" PTS2: %d\n", pts);
127
    prev_pts = pts;
128
    dts += (dts < prev_dts - (1 << 15)) ? ((prev_dts >> 16) + 1) << 16 : (prev_dts >> 16) << 16;
129
    prev_dts = dts;
130
    dprintf("Frame %d has size %d --- PTS: %lld DTS: %lld\n", i, frame_size,
131
                                             av_rescale_q(pts, outctx->streams[0]->codec->time_base, AV_TIME_BASE_Q),
132
                                             av_rescale_q(dts, outctx->streams[0]->codec->time_base, AV_TIME_BASE_Q));
133 125
    av_init_packet(&pkt);
134 126
    pkt.stream_index = 0;	// FIXME!
135
    pkt.pts = av_rescale_q(pts, outctx->streams[0]->codec->time_base, outctx->streams[0]->time_base);
127
    if (pts != -1) {
128
      pts += (pts < prev_pts - (1 << 15)) ? ((prev_pts >> 16) + 1) << 16 : (prev_pts >> 16) << 16;
129
      dprintf(" PTS2: %d\n", pts);
130
      prev_pts = pts;
131
      dts += (dts < prev_dts - (1 << 15)) ? ((prev_dts >> 16) + 1) << 16 : (prev_dts >> 16) << 16;
132
      prev_dts = dts;
133
      dprintf("Frame %d has size %d --- PTS: %lld DTS: %lld\n", i, frame_size,
134
                                             av_rescale_q(pts, outctx->streams[0]->codec->time_base, AV_TIME_BASE_Q),
135
                                             av_rescale_q(dts, outctx->streams[0]->codec->time_base, AV_TIME_BASE_Q));
136
      pkt.pts = av_rescale_q(pts, outctx->streams[0]->codec->time_base, outctx->streams[0]->time_base);
137
    } else {
138
      pkt.pts = AV_NOPTS_VALUE;
139
    }
136 140
    pkt.dts = av_rescale_q(dts, outctx->streams[0]->codec->time_base, outctx->streams[0]->time_base);
137 141
    pkt.data = p;
138 142
    p += frame_size;

Also available in: Unified diff