diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-06-26 00:06:53 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-07-03 11:31:34 +0200 |
commit | 759dfd56845d66665b47c6596691093768868af7 (patch) | |
tree | f305b0b4ae576b4092b0817acec26d7784cc6389 | |
parent | 4ec46b1160eb549a551823c168905b43922add31 (diff) | |
download | ffmpeg-759dfd56845d66665b47c6596691093768868af7.tar.gz |
examples/muxing: make more compact audio/video_time computation
-rw-r--r-- | doc/examples/muxing.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c index a8a0edacbe..c4ffee8cfc 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_time = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den; - else - audio_time = 0.0; - - if (video_st) - video_time = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den; - else - video_time = 0.0; + audio_time = audio_st ? audio_st->pts.val * av_q2d(audio_st->time_base) : 0.0; + video_time = video_st ? video_st->pts.val * av_q2d(video_st->time_base) : 0.0; if ((!audio_st || audio_time >= STREAM_DURATION) && (!video_st || video_time >= STREAM_DURATION)) |