- audio_decoder_.reset(new audio_decoder(input_.context(), format_desc.audio_sample_rate));
- channel_layout = get_audio_channel_layout(
- audio_decoder_->num_channels(),
- audio_decoder_->ffmpeg_channel_layout(),
- custom_channel_order);
- CASPAR_LOG(info) << print() << L" " << audio_decoder_->print();
+ auto stream = input_.context()->streams[stream_index];
+
+ if (stream->codec->codec_type != AVMediaType::AVMEDIA_TYPE_AUDIO)
+ continue;
+
+ try
+ {
+ audio_decoders_.push_back(std::unique_ptr<audio_decoder>(new audio_decoder(stream_index, input_.context(), format_desc.audio_sample_rate)));
+ audio_input_pads.emplace_back(
+ boost::rational<int>(1, format_desc.audio_sample_rate),
+ format_desc.audio_sample_rate,
+ AVSampleFormat::AV_SAMPLE_FMT_S32,
+ audio_decoders_.back()->ffmpeg_channel_layout());
+ CASPAR_LOG(info) << print() << L" " << audio_decoders_.back()->print();
+ }
+ catch (averror_stream_not_found&)
+ {
+ //CASPAR_LOG(warning) << print() << " No audio-stream found. Running without audio.";
+ }
+ catch (...)
+ {
+ CASPAR_LOG_CURRENT_EXCEPTION();
+ CASPAR_LOG(warning) << print() << " Failed to open audio-stream. Running without audio.";
+ }