Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Change deprecated LIBAVUTIL_VERSION_MAJOR" #439

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/QtAVPlayer/qavaudiocodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/QtAVPlayer/qavaudiofilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/QtAVPlayer/qavaudioframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/QtAVPlayer/qavaudioinputfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/QtAVPlayer/qavframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/QtAVPlayer/qavvideofilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading