mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
ffmpegdec: Add support for ffmpeg-5.1
This commit is contained in:
@@ -285,7 +285,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mSampleRate = samplerate;
|
mSampleRate = samplerate;
|
||||||
mChannels = av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
|
mChannels = 2; // AV_CHANNEL_LAYOUT_STEREO.nb_channels
|
||||||
|
|
||||||
#if !HAVE_ARM_HARDWARE
|
#if !HAVE_ARM_HARDWARE
|
||||||
audioDecoder->PrepareClipPlay(mChannels, mSampleRate, 16, 1);
|
audioDecoder->PrepareClipPlay(mChannels, mSampleRate, 16, 1);
|
||||||
@@ -300,11 +300,22 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state,
|
|||||||
#else
|
#else
|
||||||
get_packet_defaults(&rpacket);
|
get_packet_defaults(&rpacket);
|
||||||
#endif
|
#endif
|
||||||
|
#if LIBSWRESAMPLE_VERSION_INT < AV_VERSION_INT(4, 5, 100)
|
||||||
c->channel_layout = c->channel_layout ? c->channel_layout : AV_CH_LAYOUT_STEREO;
|
c->channel_layout = c->channel_layout ? c->channel_layout : AV_CH_LAYOUT_STEREO;
|
||||||
|
|
||||||
av_opt_set_int(swr, "in_channel_layout", c->channel_layout, 0);
|
av_opt_set_int(swr, "in_channel_layout", c->channel_layout, 0);
|
||||||
//av_opt_set_int(swr, "out_channel_layout", c->channel_layout, 0);
|
//av_opt_set_int(swr, "out_channel_layout", c->channel_layout, 0);
|
||||||
av_opt_set_int(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
|
av_opt_set_int(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
|
||||||
|
#else
|
||||||
|
if (!c->ch_layout.nb_channels) // Is this even possible?
|
||||||
|
c->ch_layout = AV_CHANNEL_LAYOUT_STEREO;
|
||||||
|
|
||||||
|
av_opt_set_chlayout(swr, "in_chlayout", &c->ch_layout, 0);
|
||||||
|
//av_opt_set_int(swr, "out_chlayout", c->ch_layout, 0);
|
||||||
|
AVChannelLayout out_chlayout = AV_CHANNEL_LAYOUT_STEREO;
|
||||||
|
av_opt_set_chlayout(swr, "out_chlayout", &out_chlayout, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
av_opt_set_int(swr, "in_sample_rate", c->sample_rate, 0);
|
av_opt_set_int(swr, "in_sample_rate", c->sample_rate, 0);
|
||||||
av_opt_set_int(swr, "out_sample_rate", c->sample_rate, 0);
|
av_opt_set_int(swr, "out_sample_rate", c->sample_rate, 0);
|
||||||
av_opt_set_sample_fmt(swr, "in_sample_fmt", c->sample_fmt, 0);
|
av_opt_set_sample_fmt(swr, "in_sample_fmt", c->sample_fmt, 0);
|
||||||
@@ -532,7 +543,11 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
|||||||
if (!codec)
|
if (!codec)
|
||||||
codec = avcodec_find_decoder(avc->streams[best_stream]->codecpar->codec_id);
|
codec = avcodec_find_decoder(avc->streams[best_stream]->codecpar->codec_id);
|
||||||
samplerate = avc->streams[best_stream]->codecpar->sample_rate;
|
samplerate = avc->streams[best_stream]->codecpar->sample_rate;
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 24, 100)
|
||||||
mChannels = av_get_channel_layout_nb_channels(avc->streams[best_stream]->codecpar->channel_layout);
|
mChannels = av_get_channel_layout_nb_channels(avc->streams[best_stream]->codecpar->channel_layout);
|
||||||
|
#else
|
||||||
|
mChannels = avc->streams[best_stream]->codecpar->ch_layout.nb_channels;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user