From 43ae371313a3c53de31c4ef3708fc1eb0272a6cb Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Wed, 24 Jan 2024 16:20:49 +0100 Subject: [PATCH] Revert "Change deprecated LIBAVUTIL_VERSION_MAJOR" --- src/QtAVPlayer/qavaudiocodec.cpp | 2 +- src/QtAVPlayer/qavaudiofilter.cpp | 2 +- src/QtAVPlayer/qavaudioframe.cpp | 8 ++++---- src/QtAVPlayer/qavaudioinputfilter.cpp | 8 ++++---- src/QtAVPlayer/qavframe.cpp | 2 +- src/QtAVPlayer/qavvideofilter.cpp | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/QtAVPlayer/qavaudiocodec.cpp b/src/QtAVPlayer/qavaudiocodec.cpp index ee918c06..a5441df3 100644 --- a/src/QtAVPlayer/qavaudiocodec.cpp +++ b/src/QtAVPlayer/qavaudiocodec.cpp @@ -37,7 +37,7 @@ QAVAudioFormat QAVAudioCodec::audioFormat() const format.setSampleFormat(QAVAudioFormat::Float); format.setSampleRate(d->avctx->sample_rate); -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 format.setChannelCount(d->avctx->channels); #else format.setChannelCount(d->avctx->ch_layout.nb_channels); diff --git a/src/QtAVPlayer/qavaudiofilter.cpp b/src/QtAVPlayer/qavaudiofilter.cpp index 9c9b205f..488f94e6 100644 --- a/src/QtAVPlayer/qavaudiofilter.cpp +++ b/src/QtAVPlayer/qavaudiofilter.cpp @@ -109,7 +109,7 @@ int QAVAudioFilter::read(QAVFrame &frame) if (ret < 0) break; -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 if (!out.frame()->pkt_duration) out.frame()->pkt_duration = d->sourceFrame.frame()->pkt_duration; #else diff --git a/src/QtAVPlayer/qavaudioframe.cpp b/src/QtAVPlayer/qavaudioframe.cpp index 89f12438..bd502db4 100644 --- a/src/QtAVPlayer/qavaudioframe.cpp +++ b/src/QtAVPlayer/qavaudioframe.cpp @@ -121,7 +121,7 @@ QByteArray QAVAudioFrame::data() const const auto fmt = format(); AVSampleFormat outFormat = AV_SAMPLE_FMT_NONE; -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 int64_t outChannelLayout = av_get_default_channel_layout(fmt.channelCount()); #else AVChannelLayout outChannelLayout; @@ -147,7 +147,7 @@ QByteArray QAVAudioFrame::data() const return {}; } -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 int64_t channelLayout = (frame->channel_layout && frame->channels == av_get_channel_layout_nb_channels(frame->channel_layout)) ? frame->channel_layout : av_get_default_channel_layout(frame->channels); @@ -159,7 +159,7 @@ QByteArray QAVAudioFrame::data() const if (needsConvert && (fmt != d->outAudioFormat || frame->sample_rate != d->inSampleRate || !d->swr_ctx)) { swr_free(&d->swr_ctx); -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 d->swr_ctx = swr_alloc_set_opts(nullptr, outChannelLayout, outFormat, outSampleRate, channelLayout, AVSampleFormat(frame->format), frame->sample_rate, @@ -198,7 +198,7 @@ QByteArray QAVAudioFrame::data() const d->data = QByteArray((const char *)d->audioBuf, size); } else { int size = av_samples_get_buffer_size(nullptr, -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 frame->channels, #else outChannelLayout.nb_channels, diff --git a/src/QtAVPlayer/qavaudioinputfilter.cpp b/src/QtAVPlayer/qavaudioinputfilter.cpp index 8dc44446..3bcfc7ad 100644 --- a/src/QtAVPlayer/qavaudioinputfilter.cpp +++ b/src/QtAVPlayer/qavaudioinputfilter.cpp @@ -33,7 +33,7 @@ class QAVAudioInputFilterPrivate : public QAVInOutFilterPrivate AVSampleFormat format = AV_SAMPLE_FMT_NONE; int sample_rate = 0; -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 uint64_t channel_layout = 0; int channels = 0; #else @@ -54,7 +54,7 @@ QAVAudioInputFilter::QAVAudioInputFilter(const QAVFrame &frame) const auto & stream = frame.stream().stream(); d->format = frm->format != AV_SAMPLE_FMT_NONE ? AVSampleFormat(frm->format) : AVSampleFormat(stream->codecpar->format); d->sample_rate = frm->sample_rate ? frm->sample_rate : stream->codecpar->sample_rate; -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 d->channel_layout = frm->channel_layout ? frm->channel_layout : stream->codecpar->channel_layout; d->channels = frm->channels ? frm->channels : stream->codecpar->channels; #else @@ -76,7 +76,7 @@ QAVAudioInputFilter &QAVAudioInputFilter::operator=(const QAVAudioInputFilter &o QAVInOutFilter::operator=(other); d->format = other.d_func()->format; d->sample_rate = other.d_func()->sample_rate; -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 d->channel_layout = other.d_func()->channel_layout; d->channels = other.d_func()->channels; #else @@ -96,7 +96,7 @@ int QAVAudioInputFilter::configure(AVFilterGraph *graph, AVFilterInOut *in) d->sample_rate, av_get_sample_fmt_name(AVSampleFormat(d->format))); -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 if (d->channel_layout) av_bprintf(&args, ":channel_layout=0x%" PRIx64, d->channel_layout); else diff --git a/src/QtAVPlayer/qavframe.cpp b/src/QtAVPlayer/qavframe.cpp index 52739588..cc7e73b6 100644 --- a/src/QtAVPlayer/qavframe.cpp +++ b/src/QtAVPlayer/qavframe.cpp @@ -110,7 +110,7 @@ double QAVFramePrivate::duration() const return frameRate.den && frameRate.num ? av_q2d(AVRational{frameRate.den, frameRate.num}) : -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 frame->pkt_duration #else frame->duration diff --git a/src/QtAVPlayer/qavvideofilter.cpp b/src/QtAVPlayer/qavvideofilter.cpp index d31aef18..16c8046c 100644 --- a/src/QtAVPlayer/qavvideofilter.cpp +++ b/src/QtAVPlayer/qavvideofilter.cpp @@ -103,7 +103,7 @@ int QAVVideoFilter::read(QAVFrame &frame) if (ret < 0) break; -#if LIBAVUTIL_VERSION_MAJOR < 57 +#if LIBAVUTIL_VERSION_MAJOR < 58 if (!out.frame()->pkt_duration) out.frame()->pkt_duration = d->sourceFrame.frame()->pkt_duration; #else