On Wed, Jun 18, 2014 at 3:53 AM, Anton Khirnov <[email protected]> wrote:
> ---
> doc/APIchanges | 3 +++
> libavcodec/avcodec.h | 13 +++++++++++++
> libavcodec/avpacket.c | 13 +++++++++++++
> libavcodec/version.h | 2 +-
> 4 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 952ee51..7401acb 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil: 2013-12-xx
>
> API changes, most recent first:
>
> +2014-06-xx - xxxxxxx - lavc 55.55.0 - avcodec.h
> + Add av_packet_rescale_ts() to simplify timestamp conversion.
\o/
> 2014-04-xx - xxxxxxx - lavc 55.54.0 - avcodec.h
> Add AVCodecContext.side_data_only_packets to allow encoders to output
> packets
> with only side data. This option may become mandatory in the future, so all
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 0396ea5..cc74aee 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3421,6 +3421,19 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src);
> int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
>
> /**
> + * 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
> + */
> +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational
> tb_dst);
> +
> +/**
> * @}
> */
>
> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> index 052aaf8..cccfed1 100644
> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -25,6 +25,7 @@
> #include "libavutil/common.h"
> #include "libavutil/internal.h"
> #include "libavutil/mem.h"
> +#include "libavutil/mathematics.h"
small nit: order
> #include "avcodec.h"
> #if FF_API_DESTRUCT_PACKET
>
> @@ -380,3 +381,15 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src)
> *dst = *src;
> av_init_packet(src);
> }
> +
> +void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational
> dst_tb)
> +{
> + if (pkt->pts != AV_NOPTS_VALUE)
> + pkt->pts = av_rescale_q(pkt->pts, src_tb, dst_tb);
> + if (pkt->dts != AV_NOPTS_VALUE)
> + pkt->dts = av_rescale_q(pkt->dts, src_tb, dst_tb);
> + if (pkt->duration > 0)
> + pkt->duration = av_rescale_q(pkt->duration, src_tb, dst_tb);
> + if (pkt->convergence_duration > 0)
> + pkt->convergence_duration = av_rescale_q(pkt->convergence_duration,
> src_tb, dst_tb);
> +}
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index c02540a..dee6615 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
> #include "libavutil/version.h"
>
> #define LIBAVCODEC_VERSION_MAJOR 55
> -#define LIBAVCODEC_VERSION_MINOR 54
> +#define LIBAVCODEC_VERSION_MINOR 55
> #define LIBAVCODEC_VERSION_MICRO 0
>
> #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
Looks good.
--
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel