// Internal time base represented as integer #define AV_TIME_BASE 1000000 //微妙 // Internal time base represented as fractional value #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
/** * Convert an AVRational to a `double`. * @param a AVRational to convert * @return `a` in floating-point form * @see av_d2q() */ staticinlinedoubleav_q2d(AVRational a){ return a.num / (double) a.den; }
// 将a数值由bq时间基转成cq的时间基,通过返回结果获取以cq时间基表示的新数值 /** * Rescale a 64-bit integer by 2 rational numbers. * * The operation is mathematically equivalent to `a × bq / cq`. * * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF. * * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd() */ int64_tav_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
// ⽤于将AVPacket中各种时间值从⼀种时间基转换为另⼀种时间基。 /** * Convert valid timing fields (timestamps / durations) in a packet from one * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be * ignored. * * @param pkt packet on which the conversion will be performed * @param tb_src source timebase, in which the timing fields in pkt are * expressed * @param tb_dst destination timebase, to which the timing fields will be * converted */ voidav_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);