[FFmpeg-devel] [PATCH] examples/muxing: make more compact audio_t/video_t computation

Stefano Sabatini stefasab at gmail.com
Wed Jul 3 11:34:40 CEST 2013


On date Wednesday 2013-06-26 00:07:50 +0200, Stefano Sabatini encoded:
> ---
>  doc/examples/muxing.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
> index b904916..7754c6e 100644
> --- a/doc/examples/muxing.c
> +++ b/doc/examples/muxing.c
> @@ -460,15 +460,8 @@ int main(int argc, char **argv)
>          frame->pts = 0;
>      for (;;) {
>          /* Compute current audio and video time. */
> -        if (audio_st)
> -            audio_t = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
> -        else
> -            audio_t = 0.0;
> -
> -        if (video_st)
> -            video_t = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
> -        else
> -            video_t = 0.0;
> +        audio_t = audio_st ? audio_st->pts.val * av_q2d(audio_st->time_base) : 0.0;
> +        video_t = video_st ? video_st->pts.val * av_q2d(video_st->time_base) : 0.0;

Applied.
-- 
FFmpeg = Foolish and Formidable MultiPurpose Easy Gadget


More information about the ffmpeg-devel mailing list