Skip to content

Commit

Permalink
fix build error after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
niklaspandersson committed Dec 6, 2024
1 parent 4356399 commit 46bf2f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions src/modules/ffmpeg/util/audio_resampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ extern "C" {

namespace caspar::ffmpeg {

AudioResampler::AudioResampler(int64_t sample_rate, AVSampleFormat in_sample_fmt)
: ctx(std::shared_ptr<SwrContext>(swr_alloc_set_opts(nullptr,
AV_CH_LAYOUT_7POINT1,
AV_SAMPLE_FMT_S32,
sample_rate,
AV_CH_LAYOUT_7POINT1,
in_sample_fmt,
sample_rate,
0,
nullptr),
[](SwrContext* ptr) { swr_free(&ptr); }))
AudioResampler::AudioResampler(int sample_rate, AVSampleFormat in_sample_fmt)
{
if (!ctx)
FF_RET(AVERROR(ENOMEM), "swr_alloc_set_opts");
AVChannelLayout channel_layout = AV_CHANNEL_LAYOUT_7POINT1;

SwrContext* raw_ctx = nullptr;
FF(swr_alloc_set_opts2(&raw_ctx,
&channel_layout,
AV_SAMPLE_FMT_S32,
sample_rate,
&channel_layout,
in_sample_fmt,
sample_rate,
0,
nullptr));

ctx = std::shared_ptr<SwrContext>(raw_ctx, [](SwrContext* ptr) { swr_free(&ptr); });

FF_RET(swr_init(ctx.get()), "swr_init");
}
Expand All @@ -35,4 +37,4 @@ caspar::array<int32_t> AudioResampler::convert(int frames, const void** src)
return result;
}

}; // namespace caspar::ffmpeg
}; // namespace caspar::ffmpeg
2 changes: 1 addition & 1 deletion src/modules/ffmpeg/util/audio_resampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AudioResampler
std::shared_ptr<SwrContext> ctx;

public:
AudioResampler(int64_t sample_rate, AVSampleFormat in_sample_fmt);
AudioResampler(int sample_rate, AVSampleFormat in_sample_fmt);

AudioResampler(const AudioResampler&) = delete;
AudioResampler& operator=(const AudioResampler&) = delete;
Expand Down

0 comments on commit 46bf2f3

Please sign in to comment.