Skip to content

Commit

Permalink
Record speaker with resample filter in Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyet committed Aug 14, 2023
1 parent 805aebb commit 72276c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions RecordCore/src/FFmpegHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ std::string FFmpegHelper::getAudioDevice(AudioCaptureDevice type) {
::CoUninitialize();
#elif __linux__
QString dev;
if (AudioCaptureDevice_Speaker == type) {
if (AudioCaptureDevice::Speaker == type) {
// ret = "alsa_output.pci-0000_02_02.0.analog-stereo.monitor";
dev = "alsa_output";
} else if (AudioCaptureDevice_Microphone == type) {
} else if (AudioCaptureDevice::Microphone == type) {
// ret = "alsa_input.pci-0000_02_02.0.analog-stereo";
dev = "alsa_input";
}
Expand Down
9 changes: 6 additions & 3 deletions RecordCore/src/filter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "filter.h"

#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
Expand All @@ -12,12 +15,12 @@ extern "C" {
namespace onlyet {

void format_pad_arg(char* arg, int size, const FILTER_CTX& ctx) {
sprintf_s(arg, size, "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%I64x",
snprintf(arg, size, "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%lld",
ctx.time_base.num,
ctx.time_base.den,
ctx.sample_rate,
av_get_sample_fmt_name(ctx.sample_fmt),
av_get_default_channel_layout(ctx.nb_channel));
(long long int)av_get_default_channel_layout(ctx.nb_channel));
}

} // namespace onlyet
} // namespace onlyet

0 comments on commit 72276c2

Please sign in to comment.