Skip to content

Commit

Permalink
Fix Fedora build
Browse files Browse the repository at this point in the history
  • Loading branch information
complexlogic committed Feb 26, 2023
1 parent f7d2e8a commit 673ee7e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ extern "C" {
#include "output.hpp"
#include "tag.hpp"

#define output_fferror(e, msg) char errbuf[256]; av_strerror(e, errbuf, sizeof(errbuf)); output_error(msg ": {}", errbuf)
#define output_fferror(e, msg) char errbuf[256]; av_strerror(e, errbuf, sizeof(errbuf)); output_error(msg ": {}", errbuf)
#define OLD_CHANNEL_LAYOUT LIBAVUTIL_VERSION_MAJOR < 57 || (LIBAVUTIL_VERSION_MAJOR == 57 && LIBAVUTIL_VERSION_MINOR < 18)
#define OUTPUT_FORMAT AV_SAMPLE_FMT_S16

extern bool multithread;
Expand Down Expand Up @@ -257,7 +258,7 @@ bool ScanJob::Track::scan(const Config &config, std::mutex *m)
repeat = false;
} while (repeat);
codec_id = codec->id;
#if LIBAVCODEC_VERSION_MAJOR < 59
#if OLD_CHANNEL_LAYOUT
nb_channels = codec_ctx->channels;
#else
nb_channels = codec_ctx->ch_layout.nb_channels;
Expand All @@ -275,7 +276,7 @@ bool ScanJob::Track::scan(const Config &config, std::mutex *m)

// Only initialize swresample if we need to convert the format
if (codec_ctx->sample_fmt != OUTPUT_FORMAT) {
#if LIBAVCODEC_VERSION_MAJOR < 59
#if OLD_CHANNEL_LAYOUT
if (!codec_ctx->channel_layout)
codec_ctx->channel_layout = av_get_default_channel_layout(codec_ctx->channels);
swr = swr_alloc_set_opts(nullptr,
Expand Down Expand Up @@ -353,7 +354,7 @@ bool ScanJob::Track::scan(const Config &config, std::mutex *m)
if ((rc = avcodec_send_packet(codec_ctx, packet)) == 0) {
while ((rc = avcodec_receive_frame(codec_ctx, frame)) >= 0) {
pos = frame->pkt_dts*av_q2d(format_ctx->streams[stream_id]->time_base);
#if LIBAVCODEC_VERSION_MAJOR < 59
#if OLD_CHANNEL_LAYOUT
if (frame->channels == nb_channels) {
#else
if (frame->ch_layout.nb_channels == nb_channels) {
Expand Down

0 comments on commit 673ee7e

Please sign in to comment.