On 2012-02-02 14:43:03 +0100, Anton Khirnov wrote:
> Right now those muxers use the default timebase in all cases(1/90000).
>
> This patch avoid unnecessary rescaling and makes the printed timestamps
> more readable.
>
> Obviously changes the results of many FATE tests.
> ---
> The full patch is about 2MB large, so I cut off most of it.
have you verified that only the timestamps differ? git diff --word-diff
will be helpful.
[...]
> diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
> index d845e79..6153a28 100644
> --- a/libavformat/framecrcenc.c
> +++ b/libavformat/framecrcenc.c
> @@ -21,6 +21,7 @@
>
> #include "libavutil/adler32.h"
> #include "avformat.h"
> +#include "internal.h"
>
> static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
> {
> @@ -39,6 +40,7 @@ AVOutputFormat ff_framecrc_muxer = {
> .extensions = "",
> .audio_codec = CODEC_ID_PCM_S16LE,
> .video_codec = CODEC_ID_RAWVIDEO,
> + .write_header = ff_set_tb_from_codec,
> .write_packet = framecrc_write_packet,
> .flags = AVFMT_VARIABLE_FPS,
> };
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 559e710..1f7983c 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -307,4 +307,9 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
> uint64_t channel_layout, int32_t sample_rate,
> int32_t width, int32_t height);
>
> +/**
> + * Set the timebase for each stream from the corresponding codec timebase.
> + */
> +void ff_set_tb_from_codec(AVFormatContext *s);
> +
> #endif /* AVFORMAT_INTERNAL_H */
> diff --git a/libavformat/md5enc.c b/libavformat/md5enc.c
> index 4509c18..10b81c5 100644
> --- a/libavformat/md5enc.c
> +++ b/libavformat/md5enc.c
> @@ -21,6 +21,7 @@
>
> #include "libavutil/md5.h"
> #include "avformat.h"
> +#include "internal.h"
>
> #define PRIVSIZE 512
>
> @@ -102,6 +103,7 @@ AVOutputFormat ff_framemd5_muxer = {
> .priv_data_size = PRIVSIZE,
> .audio_codec = CODEC_ID_PCM_S16LE,
> .video_codec = CODEC_ID_RAWVIDEO,
> + .write_header = ff_set_tb_from_codec,
> .write_packet = framemd5_write_packet,
> .flags = AVFMT_VARIABLE_FPS,
> };
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index e10348d..f8043b5 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -3883,3 +3883,12 @@ const struct AVCodecTag
> *avformat_get_riff_audio_tags(void)
> {
> return ff_codec_wav_tags;
> }
> +
> +void ff_set_tb_from_codec(AVFormatContext *s)
> +{
> + int i;
> + for (i = 0; i < s->nb_streams; i++) {
> + AVStream *st = s->streams[i];
> + avpriv_set_pts_info(st, 64, st->codec->time_base.num,
> st->codec->time_base.den);
Are codec timestamps even 64 bit if they are generated from a format
which wraps sooner?
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel