Ticket #1138: dts-seek-offset-fix.diff

File dts-seek-offset-fix.diff, 799 bytes (added by eelco, 14 months ago)
  • ffmpeg.c

    diff --git a/ffmpeg.c b/ffmpeg.c
    index 21f8a1b..28e22d9 100644
    a b static int output_packet(InputStream *ist, 
    22832283 
    22842284    AVPacket avpkt; 
    22852285 
     2286    // when the input stream has just been initialized, we correct the dts with 
     2287    // the pkt->pts to take into account seeking, but only if the stream is copied 
     2288    if (pkt != NULL && 
     2289        pkt->pts != AV_NOPTS_VALUE && 
     2290        !ist->decoding_needed && 
     2291        ist->dts != AV_NOPTS_VALUE && 
     2292        ist->next_dts == AV_NOPTS_VALUE && 
     2293        ist->pts == 0 && 
     2294        ist->next_pts == AV_NOPTS_VALUE) 
     2295        ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); 
     2296 
    22862297    if (ist->next_dts == AV_NOPTS_VALUE) 
    22872298        ist->next_dts = ist->dts; 
    22882299    if (ist->next_pts == AV_NOPTS_VALUE)