auto pan_filter = u8(generate_pan_filter_str(input_layout_, output_layout_, mix_config));
CASPAR_LOG(debug) << "[audio_channel_remapper] Using audio filter: " << pan_filter;
- auto logging_disabled = ffmpeg::temporary_disable_logging_for_thread(true);
+ auto quiet_logging = ffmpeg::temporary_enable_quiet_logging_for_thread(true);
filter_.reset(new ffmpeg::audio_filter(
boost::rational<int>(1, 1),
48000,
{
return make_version(::swscale_version());
}
-bool& get_disable_logging_for_thread()
+bool& get_quiet_logging_for_thread()
{
- static boost::thread_specific_ptr<bool> disable_logging_for_thread;
+ static boost::thread_specific_ptr<bool> quiet_logging_for_thread;
- auto local = disable_logging_for_thread.get();
+ auto local = quiet_logging_for_thread.get();
if (!local)
{
local = new bool(false);
- disable_logging_for_thread.reset(local);
+ quiet_logging_for_thread.reset(local);
}
return *local;
}
-void disable_logging_for_thread()
+bool is_logging_quiet_for_thread()
{
- get_disable_logging_for_thread() = true;
+ return get_quiet_logging_for_thread();
}
-bool is_logging_disabled_for_thread()
+std::shared_ptr<void> temporary_enable_quiet_logging_for_thread(bool enable)
{
- return get_disable_logging_for_thread();
-}
-
-std::shared_ptr<void> temporary_disable_logging_for_thread(bool disable)
-{
- if (!disable || is_logging_disabled_for_thread())
+ if (!enable || is_logging_quiet_for_thread())
return std::shared_ptr<void>();
- disable_logging_for_thread();
+ get_quiet_logging_for_thread() = true;
return std::shared_ptr<void>(nullptr, [](void*)
{
- get_disable_logging_for_thread() = false; // Only works correctly if destructed in same thread as original caller.
+ get_quiet_logging_for_thread() = false; // Only works correctly if destructed in same thread as original caller.
});
}
void log_for_thread(void* ptr, int level, const char* fmt, va_list vl)
{
ensure_gpf_handler_installed_for_thread("ffmpeg-thread");
- if (!get_disable_logging_for_thread()) // It does not matter what the value of the bool is
- log_callback(ptr, level, fmt, vl);
+
+ int min_level = is_logging_quiet_for_thread() ? AV_LOG_DEBUG : AV_LOG_FATAL;
+
+ log_callback(ptr, std::max(level, min_level), fmt, vl);
}
void init(core::module_dependencies dependencies)
dependencies.media_info_repo->register_extractor(
[](const std::wstring& file, const std::wstring& extension, core::media_info& info) -> bool
{
- // TODO: merge thumbnail generation from 2.0
- //auto disable_logging = temporary_disable_logging_for_thread(true);
+ auto quiet_logging = temporary_enable_quiet_logging_for_thread(true);
if (extension == L".WAV" || extension == L".MP3")
{
info.clip_type = L"AUDIO";
void init(core::module_dependencies dependencies);
void uninit();
-void disable_logging_for_thread();
-std::shared_ptr<void> temporary_disable_logging_for_thread(bool disable);
-bool is_logging_disabled_for_thread();
+std::shared_ptr<void> temporary_enable_quiet_logging_for_thread(bool enable);
+bool is_logging_quiet_for_thread();
}}
constraints_.width.set(video_decoder_->width());
constraints_.height.set(video_decoder_->height());
- if (!is_logging_disabled_for_thread())
+ if (is_logging_quiet_for_thread())
+ CASPAR_LOG(debug) << print() << L" " << video_decoder_->print();
+ else
CASPAR_LOG(info) << print() << L" " << video_decoder_->print();
}
catch(averror_stream_not_found&)
{
- //CASPAR_LOG(warning) << print() << " No video-stream found. Running without video.";
+ CASPAR_LOG(debug) << print() << " No video-stream found. Running without video.";
}
catch(...)
{
decode_next_frame();
- if (!is_logging_disabled_for_thread())
+ if (is_logging_quiet_for_thread())
+ CASPAR_LOG(debug) << print() << L" Initialized";
+ else
CASPAR_LOG(info) << print() << L" Initialized";
}
audio_graph_in_ = filt_asrc;
audio_graph_out_ = filt_asink;
- if (!is_logging_disabled_for_thread())
- CASPAR_LOG(info)
+ if (is_logging_quiet_for_thread())
+ CASPAR_LOG(trace)
<< u16(std::string("\n")
+ avfilter_graph_dump(
audio_graph_.get(),
nullptr));
+ else
+ CASPAR_LOG(debug)
+ << u16(std::string("\n")
+ + avfilter_graph_dump(
+ audio_graph_.get(),
+ nullptr));
}
void configure_filtergraph(
video_graph_in_ = filt_vsrc;
video_graph_out_ = filt_vsink;
- if (!is_logging_disabled_for_thread())
- CASPAR_LOG(info)
+ if (is_logging_quiet_for_thread())
+ CASPAR_LOG(trace)
<< u16(std::string("\n")
+ avfilter_graph_dump(
video_graph_.get(),
nullptr));
+ else
+ CASPAR_LOG(debug)
+ << u16(std::string("\n")
+ + avfilter_graph_dump(
+ video_graph_.get(),
+ nullptr));
}
void configure_filtergraph(
eof_ = false;
graph_->set_tag(diagnostics::tag_severity::INFO, "seek");
- if (!is_logging_disabled_for_thread())
+ if (is_logging_quiet_for_thread())
+ CASPAR_LOG(trace) << print() << " Seeking: " << target;
+ else
CASPAR_LOG(debug) << print() << " Seeking: " << target;
int flags = AVSEEK_FLAG_FRAME;
if (previous_frame_ && video->data[0] && is_frame_format_changed(*previous_frame_, *video))
{
// Fixes bug where avfilter crashes server on some DV files (starts in YUV420p but changes to YUV411p after the first frame).
- if (!ffmpeg::is_logging_disabled_for_thread())
+ if (ffmpeg::is_logging_quiet_for_thread())
+ CASPAR_LOG(debug) << L"[frame_muxer] Frame format has changed. Resetting display mode.";
+ else
CASPAR_LOG(info) << L"[frame_muxer] Frame format has changed. Resetting display mode.";
+
display_mode_ = display_mode::invalid;
}
if(display_mode_ == display_mode::invalid)
{
- if (!ffmpeg::is_logging_disabled_for_thread())
+ if (ffmpeg::is_logging_quiet_for_thread())
+ CASPAR_LOG(debug) << L"[frame_muxer] Auto-transcode: Failed to detect display-mode.";
+ else
CASPAR_LOG(warning) << L"[frame_muxer] Auto-transcode: Failed to detect display-mode.";
+
display_mode_ = display_mode::simple;
}
std::vector<AVPixelFormat>(),
u8(filter_str)));
- if (!ffmpeg::is_logging_disabled_for_thread())
+ if (ffmpeg::is_logging_quiet_for_thread())
+ CASPAR_LOG(debug) << L"[frame_muxer] " << display_mode_ << L" " << print_mode(frame->width, frame->height, in_fps_, frame->interlaced_frame > 0);
+ else
CASPAR_LOG(info) << L"[frame_muxer] " << display_mode_ << L" " << print_mode(frame->width, frame->height, in_fps_, frame->interlaced_frame > 0);
}