试图解决编译错误
# Conflicts: # app/codec/encoder.cpp # app/codec/encoder.h # app/codec/ffmpeg/ffmpegdecoder.cpp # ext/core
This commit is contained in:
@@ -439,9 +439,9 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, CancelAtom *can
|
||||
} else if (avstream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
|
||||
// Create an audio stream object
|
||||
uint64_t channel_layout = avstream->codecpar->channel_layout;
|
||||
if (!channel_layout) {
|
||||
channel_layout = static_cast<uint64_t>(av_get_default_channel_layout(avstream->codecpar->channels));
|
||||
AVChannelLayout &channel_layout = avstream->codecpar->ch_layout;
|
||||
if (!av_channel_layout_check(&channel_layout)) {
|
||||
av_channel_layout_default(&channel_layout,avstream->codecpar->ch_layout.nb_channels);
|
||||
}
|
||||
|
||||
if (avstream->duration == AV_NOPTS_VALUE || duration_guessed_from_bitrate) {
|
||||
@@ -551,22 +551,23 @@ bool FFmpegDecoder::ConformAudioInternal(const QVector<QString> &filenames, cons
|
||||
instance_.Seek(0);
|
||||
|
||||
// Handle NULL channel layout
|
||||
uint64_t channel_layout = ValidateChannelLayout(instance_.avstream());
|
||||
if (!channel_layout) {
|
||||
AVChannelLayout channel_layout = ValidateChannelLayout(instance_.avstream());
|
||||
if (!av_channel_layout_check(&channel_layout)) {
|
||||
qCritical() << "Failed to determine channel layout of audio file, could not conform";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create resampling context
|
||||
SwrContext* resampler = swr_alloc_set_opts(nullptr,
|
||||
params.channel_layout(),
|
||||
FFmpegUtils::GetFFmpegSampleFormat(params.format()),
|
||||
params.sample_rate(),
|
||||
channel_layout,
|
||||
static_cast<AVSampleFormat>(instance_.avstream()->codecpar->format),
|
||||
instance_.avstream()->codecpar->sample_rate,
|
||||
0,
|
||||
nullptr);
|
||||
std::shared_ptr<AVChannelLayout> layout=params.channel_layout();
|
||||
SwrContext* resampler;
|
||||
swr_alloc_set_opts2(&resampler,
|
||||
layout.get(),
|
||||
FFmpegUtils::GetFFmpegSampleFormat(params.format()),
|
||||
params.sample_rate(),
|
||||
&channel_layout,
|
||||
static_cast<AVSampleFormat>(instance_.avstream()->codecpar->format),
|
||||
instance_.avstream()->codecpar->sample_rate,
|
||||
0,
|
||||
nullptr);
|
||||
|
||||
swr_init(resampler);
|
||||
|
||||
@@ -689,13 +690,14 @@ int FFmpegDecoder::GetNativeChannelCount(AVPixelFormat pix_fmt)
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t FFmpegDecoder::ValidateChannelLayout(AVStream* stream)
|
||||
AVChannelLayout FFmpegDecoder::ValidateChannelLayout(AVStream* stream)
|
||||
{
|
||||
if (stream->codecpar->channel_layout) {
|
||||
return stream->codecpar->channel_layout;
|
||||
if (av_channel_layout_check(&stream->codecpar->ch_layout)) {
|
||||
return stream->codecpar->ch_layout;
|
||||
}
|
||||
|
||||
return av_get_default_channel_layout(stream->codecpar->channels);
|
||||
AVChannelLayout layout;
|
||||
av_channel_layout_default(&layout,stream->codecpar->ch_layout.nb_channels);
|
||||
return layout;
|
||||
}
|
||||
|
||||
const char *FFmpegDecoder::GetInterlacingModeInFFmpeg(VideoParams::Interlacing interlacing)
|
||||
|
||||
Reference in New Issue
Block a user