Ticket #10659: patch.diff

File patch.diff, 1.7 KB (added by typological, 3 years ago)
  • fftools/ffmpeg_mux.c

    diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
    index 7a924db..180fa42 100644
    a b static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)  
    9191        pkt->pts = pkt->dts;
    9292
    9393        pkt->duration = av_rescale_q(pkt->duration, pkt->time_base, ost->st->time_base);
     94    } else if (ost->type == AVMEDIA_TYPE_SUBTITLE && ost->par_in->codec_id == AV_CODEC_ID_ASS) {
     95        av_packet_rescale_ts_end(pkt, pkt->time_base, ost->st->time_base);
    9496    } else
    9597        av_packet_rescale_ts(pkt, pkt->time_base, ost->st->time_base);
    9698    pkt->time_base = ost->st->time_base;
  • libavcodec/avpacket.c

    diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
    index e29725c..3926590 100644
    a b int av_packet_make_writable(AVPacket *pkt)  
    524524    return 0;
    525525}
    526526
     527void av_packet_rescale_ts_end(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
     528{
     529    int64_t old_pts = pkt->pts;
     530    pkt->pts = av_rescale_q(pkt->pts, src_tb, dst_tb);
     531    if (pkt->dts != AV_NOPTS_VALUE)
     532        pkt->dts = av_rescale_q(pkt->dts, src_tb, dst_tb);
     533    pkt->duration = av_rescale_q(pkt->duration + old_pts, src_tb, dst_tb) - pkt->pts;
     534}
     535
    527536void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
    528537{
    529538    if (pkt->pts != AV_NOPTS_VALUE)
  • libavcodec/packet.h

    diff --git a/libavcodec/packet.h b/libavcodec/packet.h
    index b19409b..49be5cd 100644
    a b int av_packet_make_writable(AVPacket *pkt);  
    839839 */
    840840void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
    841841
     842void av_packet_rescale_ts_end(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
     843
    842844/**
    843845 * @}
    844846 */