Skip to content

Commit f9a91a5

Browse files
committed
FFmpegWriter: Replace AVRational casts with av_make_q()
Some compilers balk at the compound initializers in the cast form
1 parent 527acfe commit f9a91a5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/FFmpegWriter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ void FFmpegWriter::flush_encoders() {
811811
for (;;) {
812812

813813
// Increment PTS (in frames and scaled to the codec's timebase)
814-
write_video_count += av_rescale_q(1, (AVRational) {info.fps.den, info.fps.num}, video_codec_ctx->time_base);
814+
write_video_count += av_rescale_q(1, av_make_q(info.fps.den, info.fps.num), video_codec_ctx->time_base);
815815

816816
AVPacket pkt;
817817
av_init_packet(&pkt);
@@ -915,7 +915,7 @@ void FFmpegWriter::flush_encoders() {
915915
// for some reason, it requires me to multiply channels X 2
916916
write_audio_count += av_rescale_q(audio_input_position / (audio_codec_ctx->channels * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)), av_make_q(1, info.sample_rate), audio_codec_ctx->time_base);
917917
#else
918-
write_audio_count += av_rescale_q(audio_input_position / audio_codec_ctx->channels, (AVRational){1, info.sample_rate}, audio_codec_ctx->time_base);
918+
write_audio_count += av_rescale_q(audio_input_position / audio_codec_ctx->channels, av_make_q(1, info.sample_rate), audio_codec_ctx->time_base);
919919
#endif
920920

921921
AVPacket pkt;
@@ -1964,7 +1964,7 @@ bool FFmpegWriter::write_video_packet(std::shared_ptr<Frame> frame, AVFrame *fra
19641964
pkt.size = sizeof(AVPicture);
19651965

19661966
// Increment PTS (in frames and scaled to the codec's timebase)
1967-
write_video_count += av_rescale_q(1, (AVRational) {info.fps.den, info.fps.num}, video_codec_ctx->time_base);
1967+
write_video_count += av_rescale_q(1, av_make_q(info.fps.den, info.fps.num), video_codec_ctx->time_base);
19681968
pkt.pts = write_video_count;
19691969

19701970
/* write the compressed frame in the media file */
@@ -1991,7 +1991,7 @@ bool FFmpegWriter::write_video_packet(std::shared_ptr<Frame> frame, AVFrame *fra
19911991
uint8_t *video_outbuf = NULL;
19921992

19931993
// Increment PTS (in frames and scaled to the codec's timebase)
1994-
write_video_count += av_rescale_q(1, (AVRational) {info.fps.den, info.fps.num}, video_codec_ctx->time_base);
1994+
write_video_count += av_rescale_q(1, av_make_q(info.fps.den, info.fps.num), video_codec_ctx->time_base);
19951995

19961996
// Assign the initial AVFrame PTS from the frame counter
19971997
frame_final->pts = write_video_count;

0 commit comments

Comments
 (0)