improved render channel count system

This commit is contained in:
itsmattkc
2020-11-15 22:16:40 +11:00
parent ee5307336e
commit 0d0766e4fb
83 changed files with 1017 additions and 1132 deletions
-2
View File
@@ -24,8 +24,6 @@ set(OLIVE_SOURCES
audio/outputdeviceproxy.cpp
audio/outputmanager.h
audio/outputmanager.cpp
audio/sampleformat.h
audio/sampleformat.cpp
audio/tempoprocessor.h
audio/tempoprocessor.cpp
PARENT_SCOPE
+2 -30
View File
@@ -124,36 +124,8 @@ void AudioManager::SetOutputDevice(const QAudioDeviceInfo &info)
format.setChannelCount(output_params_.channel_count());
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
switch (output_params_.format()) {
case SampleFormat::SAMPLE_FMT_U8:
format.setSampleSize(8);
format.setSampleType(QAudioFormat::UnSignedInt);
break;
case SampleFormat::SAMPLE_FMT_S16:
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
break;
case SampleFormat::SAMPLE_FMT_S32:
format.setSampleSize(32);
format.setSampleType(QAudioFormat::SignedInt);
break;
case SampleFormat::SAMPLE_FMT_S64:
format.setSampleSize(64);
format.setSampleType(QAudioFormat::SignedInt);
break;
case SampleFormat::SAMPLE_FMT_FLT:
format.setSampleSize(32);
format.setSampleType(QAudioFormat::Float);
break;
case SampleFormat::SAMPLE_FMT_DBL:
format.setSampleSize(64);
format.setSampleType(QAudioFormat::Float);
break;
case SampleFormat::SAMPLE_FMT_COUNT:
case SampleFormat::SAMPLE_FMT_INVALID:
abort();
}
format.setSampleSize(output_params_.bits_per_sample());
format.setSampleType(AudioParams::GetQtSampleType(output_params_.format()));
if (info.isFormatSupported(format)) {
QMetaObject::invokeMethod(output_manager_,
-52
View File
@@ -1,52 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "sampleformat.h"
#include <QCoreApplication>
OLIVE_NAMESPACE_ENTER
const SampleFormat::Format SampleFormat::kInternalFormat = SAMPLE_FMT_FLT;
QString SampleFormat::GetSampleFormatName(const SampleFormat::Format &f)
{
switch (f) {
case SAMPLE_FMT_U8:
return QCoreApplication::translate("SampleFormat", "Unsigned 8-bit");
case SAMPLE_FMT_S16:
return QCoreApplication::translate("SampleFormat", "Signed 16-bit");
case SAMPLE_FMT_S32:
return QCoreApplication::translate("SampleFormat", "Signed 32-bit");
case SAMPLE_FMT_S64:
return QCoreApplication::translate("SampleFormat", "Signed 64-bit");
case SAMPLE_FMT_FLT:
return QCoreApplication::translate("SampleFormat", "32-bit Float");
case SAMPLE_FMT_DBL:
return QCoreApplication::translate("SampleFormat", "64-bit Float");
case SAMPLE_FMT_COUNT:
case SAMPLE_FMT_INVALID:
break;
}
return QCoreApplication::translate("SampleFormat", "Invalid");
}
OLIVE_NAMESPACE_EXIT
-56
View File
@@ -1,56 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SAMPLEFORMAT_H
#define SAMPLEFORMAT_H
#include <QString>
#include "common/define.h"
OLIVE_NAMESPACE_ENTER
class SampleFormat
{
public:
SampleFormat() = default;
enum Format {
SAMPLE_FMT_INVALID = -1,
SAMPLE_FMT_U8,
SAMPLE_FMT_S16,
SAMPLE_FMT_S32,
SAMPLE_FMT_S64,
SAMPLE_FMT_FLT,
SAMPLE_FMT_DBL,
SAMPLE_FMT_COUNT
};
static const Format kInternalFormat;
static QString GetSampleFormatName(const Format& f);
};
OLIVE_NAMESPACE_EXIT
#endif // SAMPLEFORMAT_H
+3 -3
View File
@@ -28,7 +28,7 @@ extern "C" {
#include <QDebug>
#include "codec/ffmpeg/ffmpegcommon.h"
#include "common/ffmpegutils.h"
OLIVE_NAMESPACE_ENTER
@@ -75,7 +75,7 @@ bool TempoProcessor::Open(const AudioParams &params, const double& speed)
1,
params_.sample_rate(),
params_.sample_rate(),
FFmpegCommon::GetFFmpegSampleFormat(params_.format()),
FFmpegUtils::GetFFmpegSampleFormat(params_.format()),
params.channel_layout());
// Create buffer and buffersink
@@ -171,7 +171,7 @@ void TempoProcessor::Push(const char *data, int length)
// Allocate a buffer for the number of samples we got
src_frame->sample_rate = params_.sample_rate();
src_frame->format = FFmpegCommon::GetFFmpegSampleFormat(params_.format());
src_frame->format = FFmpegUtils::GetFFmpegSampleFormat(params_.format());
src_frame->channel_layout = params_.channel_layout();
src_frame->nb_samples = params_.bytes_to_samples(length);
src_frame->pts = timestamp_;