From 5b95131743c6f9415733ae95699425295f440d2a Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Mon, 6 Nov 2023 19:04:42 +0100 Subject: [PATCH] Revert "BUILD: replace codecParams->ch_layout.nb_channels by codecParams->channels, it seems the old way of doing things no longer compiles..." This reverts commit 7f3071caa885b6ad03afd2c7d87a7f5260eae751. --- src/Lib/AbstractMediaContext.hh | 2 +- src/Lib/Audio.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Lib/AbstractMediaContext.hh b/src/Lib/AbstractMediaContext.hh index 8fbaff3d..43b32715 100644 --- a/src/Lib/AbstractMediaContext.hh +++ b/src/Lib/AbstractMediaContext.hh @@ -84,7 +84,7 @@ protected: VIVY_LOG_CTOR() << "Codec: " << VIVY_LOG_QUOTED(codec->name) << ", id: " << codecId; VIVY_LOG_CTOR() << "Sample rate: " << codecParams->sample_rate; VIVY_LOG_CTOR() << "Bit rate: " << codecParams->bit_rate; - VIVY_LOG_CTOR() << "Channels: " << codecParams->channels; + VIVY_LOG_CTOR() << "Channels: " << codecParams->ch_layout.nb_channels; } public: diff --git a/src/Lib/Audio.cc b/src/Lib/Audio.cc index 8478438c..fba13efe 100644 --- a/src/Lib/Audio.cc +++ b/src/Lib/Audio.cc @@ -31,7 +31,7 @@ AudioStream::AudioStream(const AVCodec *streamCodec, AVFormatContext *formatPtr, : Super(streamCodec, formatPtr, streamArg, index) { SwrContext *s = dataSwrContext.get(); - av_opt_set_int(s, "in_channel_count", codecContext->channels, 0); + av_opt_set_int(s, "in_channel_count", codecContext->ch_layout.nb_channels, 0); av_opt_set_int(s, "out_channel_count", 1, 0); av_opt_set_int(s, "out_channel_layout", AV_CH_LAYOUT_MONO, 0); av_opt_set_int(s, "in_sample_rate", codecContext->sample_rate, 0); @@ -58,7 +58,7 @@ AudioStream::getProperties() const noexcept QJsonObject ret = Super::getProperties(); ret.insert("Sample rate", codecParams->sample_rate); ret.insert("Bit rate", static_cast<int>(codecParams->bit_rate)); - ret.insert("Channels", codecParams->channels); + ret.insert("Channels", codecParams->ch_layout.nb_channels); return ret; } @@ -128,7 +128,7 @@ AudioStream::decodeData() dataPtr = reinterpret_cast<double *>( realloc(dataPtr, (dataSize + static_cast<size_t>(dataFrame->nb_samples)) * sizeof(double))); - memcpy(&dataPtr[dataSize], buffer, frame_count * sizeof(double)); + memcpy(dataPtr + dataSize, buffer, frame_count * sizeof(double)); dataSize += frame_count; } } @@ -154,7 +154,7 @@ AudioStream::cleanUpData() noexcept int AudioStream::getChannels() const noexcept { - return codecContext->channels; + return codecContext->ch_layout.nb_channels; } // Get the sample rate -- GitLab