fix: fix exceptions when import video
This commit is contained in:
@@ -66,7 +66,7 @@ bool AudioProcessor::Open(const AudioParams &from, const AudioParams &to, double
|
||||
from.sample_rate(),
|
||||
from.sample_rate(),
|
||||
from_fmt_,
|
||||
from.channel_layout());
|
||||
from.channel_layout().u.mask);
|
||||
|
||||
int r;
|
||||
|
||||
@@ -97,11 +97,11 @@ bool AudioProcessor::Open(const AudioParams &from, const AudioParams &to, double
|
||||
|
||||
for (int i=0;i<=whole;i++) {
|
||||
double filter_tempo = (i == whole) ? std::pow(base, speed_log) : base;
|
||||
|
||||
/*
|
||||
if (qFuzzyCompare(filter_tempo, 1.0)) {
|
||||
// This filter would do nothing
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
previous_filter = CreateTempoFilter(filter_graph_,
|
||||
previous_filter,
|
||||
@@ -159,7 +159,9 @@ bool AudioProcessor::Open(const AudioParams &from, const AudioParams &to, double
|
||||
Close();
|
||||
return false;
|
||||
}
|
||||
|
||||
char *dump = avfilter_graph_dump(filter_graph_, nullptr);
|
||||
qDebug() << dump;
|
||||
av_free(dump);
|
||||
r = avfilter_graph_config(filter_graph_, nullptr);
|
||||
if (r < 0) {
|
||||
qCritical() << "Failed to configure graph:" << r;
|
||||
|
||||
@@ -512,6 +512,7 @@ void ViewerWidget::UpdateAudioProcessor()
|
||||
AudioParams ap = GetConnectedNode()->GetAudioParams();
|
||||
ap.set_format(ViewerOutput::kDefaultSampleFormat);
|
||||
|
||||
uint64_t layout=OLIVE_CONFIG("AudioOutputChannelLayout").toULongLong();
|
||||
AudioParams packed(OLIVE_CONFIG("AudioOutputSampleRate").toInt(),
|
||||
OLIVE_CONFIG("AudioOutputChannelLayout").toULongLong(),
|
||||
SampleFormat::from_string(OLIVE_CONFIG("AudioOutputSampleFormat").toString().toStdString()));
|
||||
@@ -981,7 +982,7 @@ void ViewerWidget::PlayInternal(int speed, bool in_to_out_only)
|
||||
}
|
||||
|
||||
AudioParams ap = GetConnectedNode()->GetAudioParams();
|
||||
if (ap.is_valid()) {
|
||||
if (ap.is_valid() && ap.channel_count() != 0) {
|
||||
UpdateAudioProcessor();
|
||||
|
||||
AudioManager::instance()->SetOutputNotifyInterval(audio_processor_.to().time_to_bytes(kAudioPlaybackInterval));
|
||||
|
||||
Reference in New Issue
Block a user