diff --git a/src/accelerator/ogl/image/image_kernel.cpp b/src/accelerator/ogl/image/image_kernel.cpp index 86cea420fe..ad9ce38043 100644 --- a/src/accelerator/ogl/image/image_kernel.cpp +++ b/src/accelerator/ogl/image/image_kernel.cpp @@ -220,13 +220,14 @@ struct image_kernel::impl coord.vertex_y += f_p[1]; }; - auto const first_plane = params.pix_desc.planes.at(0); - if (params.geometry.mode() != core::frame_geometry::scale_mode::stretch && first_plane.width > 0 && first_plane.height > 0) { - auto width_scale = static_cast(params.target_width) / static_cast(first_plane.width); - auto height_scale = static_cast(params.target_height) / static_cast(first_plane.height); + auto const first_plane = params.pix_desc.planes.at(0); + if (params.geometry.mode() != core::frame_geometry::scale_mode::stretch && first_plane.width > 0 && + first_plane.height > 0) { + auto width_scale = static_cast(params.target_width) / static_cast(first_plane.width); + auto height_scale = static_cast(params.target_height) / static_cast(first_plane.height); double target_scale; - switch (params.geometry.mode()) { + switch (params.geometry.mode()) { case core::frame_geometry::scale_mode::fit: target_scale = std::min(width_scale, height_scale); f_s[0] *= target_scale / width_scale; @@ -253,8 +254,8 @@ struct image_kernel::impl break; default:; - } - } + } + } int corner = 0; for (auto& coord : coords) { diff --git a/src/accelerator/ogl/image/image_mixer.cpp b/src/accelerator/ogl/image/image_mixer.cpp index 4c750f3797..c1a1113351 100644 --- a/src/accelerator/ogl/image/image_mixer.cpp +++ b/src/accelerator/ogl/image/image_mixer.cpp @@ -95,13 +95,14 @@ class image_renderer return make_ready_future(array(buffer.data(), format_desc.size, true)); } - return flatten(ogl_->dispatch_async([=, layers = std::move(layers)]() mutable -> std::shared_future> { - auto target_texture = ogl_->create_texture(format_desc.width, format_desc.height, 4, depth_); + return flatten(ogl_->dispatch_async( + [=, layers = std::move(layers)]() mutable -> std::shared_future> { + auto target_texture = ogl_->create_texture(format_desc.width, format_desc.height, 4, depth_); - draw(target_texture, std::move(layers), format_desc); + draw(target_texture, std::move(layers), format_desc); - return ogl_->copy_async(target_texture); - })); + return ogl_->copy_async(target_texture); + })); } common::bit_depth depth() const { return depth_; } @@ -228,14 +229,13 @@ class image_renderer draw_params.target_width = format_desc.square_width; draw_params.target_height = format_desc.square_height; draw_params.pix_desc.format = core::pixel_format::bgra; - draw_params.pix_desc.planes = { - core::pixel_format_desc::plane(source_texture->width(), source_texture->height(), 4, source_texture->depth()) - }; - draw_params.textures = { spl::make_shared_ptr(source_texture) }; - draw_params.transform = core::image_transform(); - draw_params.blend_mode = blend_mode; - draw_params.background = target_texture; - draw_params.geometry = core::frame_geometry::get_default(); + draw_params.pix_desc.planes = {core::pixel_format_desc::plane( + source_texture->width(), source_texture->height(), 4, source_texture->depth())}; + draw_params.textures = {spl::make_shared_ptr(source_texture)}; + draw_params.transform = core::image_transform(); + draw_params.blend_mode = blend_mode; + draw_params.background = target_texture; + draw_params.geometry = core::frame_geometry::get_default(); kernel_.draw(std::move(draw_params)); } diff --git a/src/accelerator/ogl/util/device.cpp b/src/accelerator/ogl/util/device.cpp index 7598c2873d..a737101dd8 100644 --- a/src/accelerator/ogl/util/device.cpp +++ b/src/accelerator/ogl/util/device.cpp @@ -150,11 +150,14 @@ struct device::impl : public std::enable_shared_from_this auto task = task_type(std::forward(func)); auto future = task.get_future(); - boost::asio::spawn(service_, std::move(task) + boost::asio::spawn(service_, + std::move(task) #if BOOST_VERSION >= 108000 - , [](std::exception_ptr e) { - if (e) std::rethrow_exception(e); - } + , + [](std::exception_ptr e) { + if (e) + std::rethrow_exception(e); + } #endif ); return future; diff --git a/src/common/assert.h b/src/common/assert.h index b4ed822f8e..be8cd390c7 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -35,9 +35,8 @@ #define CASPAR_VERIFY(expr) \ do { \ if (!(expr)) { \ - CASPAR_LOG(warning) << "Assertion Failed: " << CASPAR_VERIFY_EXPR_STR(expr) << " " \ - << "file:" << __FILE__ << " " \ - << "line:" << __LINE__ << " "; \ + CASPAR_LOG(warning) << "Assertion Failed: " << CASPAR_VERIFY_EXPR_STR(expr) << " " << "file:" << __FILE__ \ + << " " << "line:" << __LINE__ << " "; \ _CASPAR_DBG_BREAK; \ } \ } while (0); diff --git a/src/common/ptree.h b/src/common/ptree.h index 1f69eaab3e..99be2246c4 100644 --- a/src/common/ptree.h +++ b/src/common/ptree.h @@ -25,8 +25,8 @@ #include #include -#include #include +#include #include #include diff --git a/src/core/consumer/output.h b/src/core/consumer/output.h index de5d5c1ab8..00979634e3 100644 --- a/src/core/consumer/output.h +++ b/src/core/consumer/output.h @@ -29,7 +29,9 @@ #include -namespace caspar::diagnostics { class graph; } +namespace caspar::diagnostics { +class graph; +} namespace caspar { namespace core { diff --git a/src/core/diagnostics/osd_graph.cpp b/src/core/diagnostics/osd_graph.cpp index 758dfcce71..1dedf084d6 100644 --- a/src/core/diagnostics/osd_graph.cpp +++ b/src/core/diagnostics/osd_graph.cpp @@ -75,7 +75,8 @@ auto& get_default_font() if (auto pipe = popen(cmd.data(), "r")) { char buf[128]; path.clear(); - while (fgets(buf, sizeof(buf), pipe)) path += buf; + while (fgets(buf, sizeof(buf), pipe)) + path += buf; } } #endif diff --git a/src/core/frame/draw_frame.cpp b/src/core/frame/draw_frame.cpp index 86abd670b7..9f1803244f 100644 --- a/src/core/frame/draw_frame.cpp +++ b/src/core/frame/draw_frame.cpp @@ -99,8 +99,9 @@ draw_frame::draw_frame(mutable_frame&& frame) draw_frame::draw_frame(std::vector frames) { auto frame_size = frames.size(); - impl_ = std::make_unique(std::move(frames)); - if (frame_size > 1) impl_->transform_.image_transform.layer_depth = 1; + impl_ = std::make_unique(std::move(frames)); + if (frame_size > 1) + impl_->transform_.image_transform.layer_depth = 1; } draw_frame::~draw_frame() {} draw_frame& draw_frame::operator=(draw_frame other) diff --git a/src/core/frame/geometry.cpp b/src/core/frame/geometry.cpp index 016abdd3da..03571d5176 100644 --- a/src/core/frame/geometry.cpp +++ b/src/core/frame/geometry.cpp @@ -40,8 +40,9 @@ bool frame_geometry::coord::operator==(const frame_geometry::coord& other) const struct frame_geometry::impl { - impl(frame_geometry::geometry_type type, frame_geometry::scale_mode mode, std::vector data) : - type_{type}, mode_{mode} + impl(frame_geometry::geometry_type type, frame_geometry::scale_mode mode, std::vector data) + : type_{type} + , mode_{mode} { if (type == geometry_type::quad && data.size() != 4) CASPAR_THROW_EXCEPTION(invalid_argument() << msg_info("The number of coordinates needs to be 4")); @@ -54,9 +55,10 @@ struct frame_geometry::impl std::vector data_; }; -frame_geometry::frame_geometry(geometry_type type, scale_mode mode, std::vector data) : - impl_{new impl{type, mode, std::move(data)}} -{ } +frame_geometry::frame_geometry(geometry_type type, scale_mode mode, std::vector data) + : impl_{new impl{type, mode, std::move(data)}} +{ +} frame_geometry::geometry_type frame_geometry::type() const { return impl_->type_; } frame_geometry::scale_mode frame_geometry::mode() const { return impl_->mode_; } @@ -71,7 +73,7 @@ const frame_geometry frame_geometry::get_default(scale_mode mode) {1.0, 1.0, 1.0, 1.0}, // lower right {0.0, 1.0, 0.0, 1.0} // lower left }; - return frame_geometry{ frame_geometry::geometry_type::quad, mode, std::move(data) }; + return frame_geometry{frame_geometry::geometry_type::quad, mode, std::move(data)}; } const frame_geometry frame_geometry::get_default_vflip(scale_mode mode) { @@ -82,46 +84,43 @@ const frame_geometry frame_geometry::get_default_vflip(scale_mode mode) {1.0, 1.0, 1.0, 0.0}, // lower right {0.0, 1.0, 0.0, 0.0} // lower left }; - return frame_geometry{ frame_geometry::geometry_type::quad, mode, std::move(data) }; + return frame_geometry{frame_geometry::geometry_type::quad, mode, std::move(data)}; } -frame_geometry::scale_mode scale_mode_from_string(const std::wstring& str) { - auto str2 = boost::to_lower_copy(str); - if (str2 == L"fit") { - return frame_geometry::scale_mode::fit; - } - else if (str2 == L"fill") { - return frame_geometry::scale_mode::fill; - } - else if (str2 == L"original") { - return frame_geometry::scale_mode::original; - } - else if (str2 == L"hfill") { - return frame_geometry::scale_mode::hfill; - } - else if (str2 == L"vfill") { - return frame_geometry::scale_mode::vfill; - } - else { - return frame_geometry::scale_mode::stretch; - } +frame_geometry::scale_mode scale_mode_from_string(const std::wstring& str) +{ + auto str2 = boost::to_lower_copy(str); + if (str2 == L"fit") { + return frame_geometry::scale_mode::fit; + } else if (str2 == L"fill") { + return frame_geometry::scale_mode::fill; + } else if (str2 == L"original") { + return frame_geometry::scale_mode::original; + } else if (str2 == L"hfill") { + return frame_geometry::scale_mode::hfill; + } else if (str2 == L"vfill") { + return frame_geometry::scale_mode::vfill; + } else { + return frame_geometry::scale_mode::stretch; + } } -std::wstring scale_mode_to_string(frame_geometry::scale_mode mode) { - switch (mode) { - case frame_geometry::scale_mode::fit: - return L"FIT"; - case frame_geometry::scale_mode::fill: - return L"FILL"; - case frame_geometry::scale_mode::original: - return L"ORIGINAL"; - case frame_geometry::scale_mode::hfill: - return L"HFILL"; - case frame_geometry::scale_mode::vfill: - return L"VFILL"; - default: - return L"STRETCH"; - } +std::wstring scale_mode_to_string(frame_geometry::scale_mode mode) +{ + switch (mode) { + case frame_geometry::scale_mode::fit: + return L"FIT"; + case frame_geometry::scale_mode::fill: + return L"FILL"; + case frame_geometry::scale_mode::original: + return L"ORIGINAL"; + case frame_geometry::scale_mode::hfill: + return L"HFILL"; + case frame_geometry::scale_mode::vfill: + return L"VFILL"; + default: + return L"STRETCH"; + } } }} // namespace caspar::core diff --git a/src/core/frame/geometry.h b/src/core/frame/geometry.h index 48ae95a82f..56a853e652 100644 --- a/src/core/frame/geometry.h +++ b/src/core/frame/geometry.h @@ -75,6 +75,6 @@ class frame_geometry }; frame_geometry::scale_mode scale_mode_from_string(const std::wstring&); -std::wstring scale_mode_to_string(frame_geometry::scale_mode); +std::wstring scale_mode_to_string(frame_geometry::scale_mode); }} // namespace caspar::core diff --git a/src/core/fwd.h b/src/core/fwd.h index ae9add8f74..a928cc222d 100644 --- a/src/core/fwd.h +++ b/src/core/fwd.h @@ -20,25 +20,67 @@ */ #pragma once -namespace caspar::accelerator { class accelerator; } -namespace caspar::accelerator::ogl { class device; } +namespace caspar::accelerator { +class accelerator; +} +namespace caspar::accelerator::ogl { +class device; +} -namespace caspar::core { class stage; } -namespace caspar::core { class mixer; } -namespace caspar::core { class output; } -namespace caspar::core { class image_mixer; } -namespace caspar::core { struct video_format_desc; } -namespace caspar::core { class frame_factory; } -namespace caspar::core { class frame_producer; } -namespace caspar::core { class frame_consumer; } -namespace caspar::core { class draw_frame; } -namespace caspar::core { class mutable_frame; } -namespace caspar::core { class const_frame; } -namespace caspar::core { class video_channel; } -namespace caspar::core { struct pixel_format_desc; } -namespace caspar::core { class cg_producer_registry; } -namespace caspar::core { struct frame_transform; } -namespace caspar::core { struct frame_producer_dependencies; } -namespace caspar::core { struct module_dependencies; } -namespace caspar::core { class frame_producer_registry; } -namespace caspar::core { class video_format_repository; } +namespace caspar::core { +class stage; +} +namespace caspar::core { +class mixer; +} +namespace caspar::core { +class output; +} +namespace caspar::core { +class image_mixer; +} +namespace caspar::core { +struct video_format_desc; +} +namespace caspar::core { +class frame_factory; +} +namespace caspar::core { +class frame_producer; +} +namespace caspar::core { +class frame_consumer; +} +namespace caspar::core { +class draw_frame; +} +namespace caspar::core { +class mutable_frame; +} +namespace caspar::core { +class const_frame; +} +namespace caspar::core { +class video_channel; +} +namespace caspar::core { +struct pixel_format_desc; +} +namespace caspar::core { +class cg_producer_registry; +} +namespace caspar::core { +struct frame_transform; +} +namespace caspar::core { +struct frame_producer_dependencies; +} +namespace caspar::core { +struct module_dependencies; +} +namespace caspar::core { +class frame_producer_registry; +} +namespace caspar::core { +class video_format_repository; +} diff --git a/src/core/mixer/audio/audio_mixer.h b/src/core/mixer/audio/audio_mixer.h index 785139fe61..4a7bbe81bf 100644 --- a/src/core/mixer/audio/audio_mixer.h +++ b/src/core/mixer/audio/audio_mixer.h @@ -30,7 +30,9 @@ #include -namespace caspar::diagnostics { class graph; } +namespace caspar::diagnostics { +class graph; +} namespace caspar { namespace core { diff --git a/src/core/mixer/mixer.h b/src/core/mixer/mixer.h index 252d80c2fd..75e49ef45a 100644 --- a/src/core/mixer/mixer.h +++ b/src/core/mixer/mixer.h @@ -27,7 +27,9 @@ #include #include -namespace caspar::diagnostics { class graph; } +namespace caspar::diagnostics { +class graph; +} namespace caspar { namespace core { diff --git a/src/core/producer/route/route_producer.cpp b/src/core/producer/route/route_producer.cpp index 1cd4e40b66..e96c3174ed 100644 --- a/src/core/producer/route/route_producer.cpp +++ b/src/core/producer/route/route_producer.cpp @@ -41,7 +41,7 @@ namespace caspar { namespace core { class route_producer : public frame_producer , public route_control - , public std::enable_shared_from_this + , public std::enable_shared_from_this { spl::shared_ptr graph_; @@ -50,7 +50,7 @@ class route_producer caspar::timer produce_timer_; caspar::timer consume_timer_; - std::shared_ptr route_; + std::shared_ptr route_; std::optional> frame_; int source_channel_; @@ -91,29 +91,30 @@ class route_producer void connect_slot() { - auto weak_self = weak_from_this(); - connection_ = route_->signal.connect([weak_self](const core::draw_frame& frame1, const core::draw_frame& frame2) { - if (auto self = weak_self.lock()) { - auto frame1b = frame1; - if (!frame1b) { - // We got a frame, so ensure it is a real frame (otherwise the layer gets confused) - frame1b = core::draw_frame::push(frame1); - } - auto frame2b = frame2; - if (!frame2b) { - // Ensure that any interlaced channel will repeat frames instead of showing black. - // Note: doing 50p -> 50i will result in dropping to 25p and frame doubling. - frame2b = frame1b; - } - - if (!self->buffer_.try_push(std::make_pair(frame1b, frame2b))) { - self->graph_->set_tag(diagnostics::tag_severity::WARNING, "dropped-frame"); - } - self->graph_->set_value("produce-time", self->produce_timer_.elapsed() * self->route_->format_desc.fps * 0.5); - self->produce_timer_.restart(); - } - } - ); + auto weak_self = weak_from_this(); + connection_ = + route_->signal.connect([weak_self](const core::draw_frame& frame1, const core::draw_frame& frame2) { + if (auto self = weak_self.lock()) { + auto frame1b = frame1; + if (!frame1b) { + // We got a frame, so ensure it is a real frame (otherwise the layer gets confused) + frame1b = core::draw_frame::push(frame1); + } + auto frame2b = frame2; + if (!frame2b) { + // Ensure that any interlaced channel will repeat frames instead of showing black. + // Note: doing 50p -> 50i will result in dropping to 25p and frame doubling. + frame2b = frame1b; + } + + if (!self->buffer_.try_push(std::make_pair(frame1b, frame2b))) { + self->graph_->set_tag(diagnostics::tag_severity::WARNING, "dropped-frame"); + } + self->graph_->set_value("produce-time", + self->produce_timer_.elapsed() * self->route_->format_desc.fps * 0.5); + self->produce_timer_.restart(); + } + }); } draw_frame last_frame(const core::video_field field) override @@ -211,7 +212,7 @@ spl::shared_ptr create_route_producer(const core::frame_pr } auto buffer = get_param(L"BUFFER", params, 0); - auto rp = spl::make_shared((*channel_it)->route(layer, mode), buffer, channel, layer); + auto rp = spl::make_shared((*channel_it)->route(layer, mode), buffer, channel, layer); rp->connect_slot(); return rp; } diff --git a/src/core/producer/stage.h b/src/core/producer/stage.h index 1081a8e104..2edfcff6b2 100644 --- a/src/core/producer/stage.h +++ b/src/core/producer/stage.h @@ -38,7 +38,9 @@ #include #include -namespace caspar::diagnostics { class graph; } +namespace caspar::diagnostics { +class graph; +} namespace caspar { namespace core { diff --git a/src/modules/artnet/consumer/artnet_consumer.cpp b/src/modules/artnet/consumer/artnet_consumer.cpp index a372b74fc3..e60cdcb26f 100644 --- a/src/modules/artnet/consumer/artnet_consumer.cpp +++ b/src/modules/artnet/consumer/artnet_consumer.cpp @@ -273,7 +273,7 @@ std::vector get_fixtures_ptree(const boost::property_tree::wptree& ptre user_error() << msg_info( L"Fixture channel count must be at least enough channels for current color mode")); - f.fixtureChannels = (unsigned short) fixtureChannels; + f.fixtureChannels = (unsigned short)fixtureChannels; box b{}; diff --git a/src/modules/bluefish/producer/bluefish_producer.cpp b/src/modules/bluefish/producer/bluefish_producer.cpp index d0f56c912e..3b4b3d9eb2 100644 --- a/src/modules/bluefish/producer/bluefish_producer.cpp +++ b/src/modules/bluefish/producer/bluefish_producer.cpp @@ -445,14 +445,14 @@ struct bluefish_producer auto src_audio = alloc_frame(); // video - src_video->format = AV_PIX_FMT_RGB24; - src_video->width = width; - src_video->height = height; - src_video->interlaced_frame = !is_progressive; - src_video->top_field_first = height != 486; - src_video->key_frame = 1; - //src_video->display_picture_number = frames_captured; - src_video->pts = capture_ts; + src_video->format = AV_PIX_FMT_RGB24; + src_video->width = width; + src_video->height = height; + src_video->interlaced_frame = !is_progressive; + src_video->top_field_first = height != 486; + src_video->key_frame = 1; + // src_video->display_picture_number = frames_captured; + src_video->pts = capture_ts; void* video_bytes = reserved_frames_.front()->image_data(); if (reserved_frames_.front() && video_bytes) { diff --git a/src/modules/ffmpeg/consumer/ffmpeg_consumer.cpp b/src/modules/ffmpeg/consumer/ffmpeg_consumer.cpp index c6cc9fba94..785d44f715 100644 --- a/src/modules/ffmpeg/consumer/ffmpeg_consumer.cpp +++ b/src/modules/ffmpeg/consumer/ffmpeg_consumer.cpp @@ -292,9 +292,9 @@ struct Stream } else if (codec->type == AVMEDIA_TYPE_AUDIO) { st->time_base = {1, av_buffersink_get_sample_rate(sink)}; - enc->sample_fmt = static_cast(av_buffersink_get_format(sink)); - enc->sample_rate = av_buffersink_get_sample_rate(sink); - enc->time_base = st->time_base; + enc->sample_fmt = static_cast(av_buffersink_get_format(sink)); + enc->sample_rate = av_buffersink_get_sample_rate(sink); + enc->time_base = st->time_base; #if FFMPEG_NEW_CHANNEL_LAYOUT FF(av_buffersink_get_ch_layout(sink, &enc->ch_layout)); diff --git a/src/modules/ffmpeg/producer/av_input.cpp b/src/modules/ffmpeg/producer/av_input.cpp index ef67cc0b01..32d5181bab 100644 --- a/src/modules/ffmpeg/producer/av_input.cpp +++ b/src/modules/ffmpeg/producer/av_input.cpp @@ -163,8 +163,7 @@ void Input::internal_reset() auto ic2 = std::shared_ptr(ic, [](AVFormatContext* ctx) { avformat_close_input(&ctx); }); for (auto& p : to_map(&options)) { - CASPAR_LOG(warning) << "av_input[" + filename_ + "]" - << " Unused option " << p.first << "=" << p.second; + CASPAR_LOG(warning) << "av_input[" + filename_ + "]" << " Unused option " << p.first << "=" << p.second; } FF(avformat_find_stream_info(ic2.get(), nullptr)); diff --git a/src/modules/ffmpeg/producer/av_producer.cpp b/src/modules/ffmpeg/producer/av_producer.cpp index e02b9b553a..f0118aba92 100644 --- a/src/modules/ffmpeg/producer/av_producer.cpp +++ b/src/modules/ffmpeg/producer/av_producer.cpp @@ -667,13 +667,13 @@ struct AVProducer::Impl std::string afilter_; std::string vfilter_; - int seekable_ = 2; + int seekable_ = 2; core::frame_geometry::scale_mode scale_mode_; - int64_t frame_count_ = 0; - bool frame_flush_ = true; - int64_t frame_time_ = AV_NOPTS_VALUE; - int64_t frame_duration_ = AV_NOPTS_VALUE; - core::draw_frame frame_; + int64_t frame_count_ = 0; + bool frame_flush_ = true; + int64_t frame_time_ = AV_NOPTS_VALUE; + int64_t frame_duration_ = AV_NOPTS_VALUE; + core::draw_frame frame_; std::deque buffer_; mutable boost::mutex buffer_mutex_; @@ -788,7 +788,7 @@ struct AVProducer::Impl } { - const auto start = start_.load(); + const auto start = start_.load(); if (duration_ == AV_NOPTS_VALUE && input_->duration > 0) { if (start != AV_NOPTS_VALUE) { duration_ = input_->duration - start; @@ -919,8 +919,7 @@ struct AVProducer::Impl } frame.frame = core::draw_frame( - make_frame(this, *frame_factory_, frame.video, frame.audio, get_color_space(frame.video), scale_mode_) - ); + make_frame(this, *frame_factory_, frame.video, frame.audio, get_color_space(frame.video), scale_mode_)); frame.frame_count = frame_count_++; graph_->set_value("decode-time", decode_timer.elapsed() * format_desc_.fps * 0.5); diff --git a/src/modules/ffmpeg/producer/ffmpeg_producer.cpp b/src/modules/ffmpeg/producer/ffmpeg_producer.cpp index 7c43bdf58b..da7bdf3e48 100644 --- a/src/modules/ffmpeg/producer/ffmpeg_producer.cpp +++ b/src/modules/ffmpeg/producer/ffmpeg_producer.cpp @@ -91,7 +91,8 @@ struct ffmpeg_producer : public core::frame_producer loop, seekable, scale_mode)) - { } + { + } ~ffmpeg_producer() { @@ -222,10 +223,7 @@ boost::tribool has_valid_extension(const boost::filesystem::path& filename) return boost::tribool(boost::indeterminate); } -bool has_invalid_protocol(const std::wstring& filename) -{ - return boost::algorithm::istarts_with(filename, L"ndi://"); -} +bool has_invalid_protocol(const std::wstring& filename) { return boost::algorithm::istarts_with(filename, L"ndi://"); } bool is_readable(const boost::filesystem::path& filename) { diff --git a/src/modules/ffmpeg/util/av_util.cpp b/src/modules/ffmpeg/util/av_util.cpp index 4a3d1b55f7..800ae9fd06 100644 --- a/src/modules/ffmpeg/util/av_util.cpp +++ b/src/modules/ffmpeg/util/av_util.cpp @@ -43,11 +43,11 @@ std::shared_ptr alloc_packet() return packet; } -core::mutable_frame make_frame(void* tag, - core::frame_factory& frame_factory, - std::shared_ptr video, - std::shared_ptr audio, - core::color_space color_space, +core::mutable_frame make_frame(void* tag, + core::frame_factory& frame_factory, + std::shared_ptr video, + std::shared_ptr audio, + core::color_space color_space, core::frame_geometry::scale_mode scale_mode) { std::vector data_map; // TODO(perf) when using data_map, avoid uploading duplicate planes @@ -210,7 +210,7 @@ core::pixel_format_desc pixel_format_desc(AVPixelFormat pix_fmt, av_image_fill_pointers(dummy_pict_data, pix_fmt, height, NULL, linesizes); auto size2 = static_cast(dummy_pict_data[2] - dummy_pict_data[1]); #endif - auto h2 = size2 / linesizes[1]; + auto h2 = size2 / linesizes[1]; desc.planes.push_back(core::pixel_format_desc::plane(linesizes[0], height, 1, depth)); desc.planes.push_back(core::pixel_format_desc::plane(linesizes[1], h2, 1, depth)); @@ -334,9 +334,9 @@ std::shared_ptr make_av_audio_frame(const core::const_frame& frame, con av_frame->channels = format_desc.audio_channels; av_frame->channel_layout = av_get_default_channel_layout(av_frame->channels); #endif - av_frame->sample_rate = format_desc.audio_sample_rate; - av_frame->format = AV_SAMPLE_FMT_S32; - av_frame->nb_samples = static_cast(buffer.size() / format_desc.audio_channels); + av_frame->sample_rate = format_desc.audio_sample_rate; + av_frame->format = AV_SAMPLE_FMT_S32; + av_frame->nb_samples = static_cast(buffer.size() / format_desc.audio_channels); FF(av_frame_get_buffer(av_frame.get(), 32)); std::memcpy(av_frame->data[0], buffer.data(), buffer.size() * sizeof(buffer.data()[0])); @@ -371,8 +371,8 @@ std::map to_map(AVDictionary** dict) return map; } - -uint64_t get_channel_layout_mask_for_channels(int channel_count) { +uint64_t get_channel_layout_mask_for_channels(int channel_count) +{ #if FFMPEG_NEW_CHANNEL_LAYOUT AVChannelLayout layout = AV_CHANNEL_LAYOUT_STEREO; av_channel_layout_default(&layout, channel_count); diff --git a/src/modules/ffmpeg/util/av_util.h b/src/modules/ffmpeg/util/av_util.h index 84fcdb60cb..e23bcc5b00 100644 --- a/src/modules/ffmpeg/util/av_util.h +++ b/src/modules/ffmpeg/util/av_util.h @@ -33,7 +33,7 @@ core::mutable_frame make_frame(void* tag, std::shared_ptr video, std::shared_ptr audio, core::color_space color_space = core::color_space::bt709, - core::frame_geometry::scale_mode = core::frame_geometry::scale_mode::stretch); + core::frame_geometry::scale_mode = core::frame_geometry::scale_mode::stretch); std::shared_ptr make_av_video_frame(const core::const_frame& frame, const core::video_format_desc& format_des); std::shared_ptr make_av_audio_frame(const core::const_frame& frame, const core::video_format_desc& format_des); diff --git a/src/modules/html/html.cpp b/src/modules/html/html.cpp index 74714a2f4a..04f380ef1f 100644 --- a/src/modules/html/html.cpp +++ b/src/modules/html/html.cpp @@ -116,9 +116,8 @@ class renderer_application if (!frame->IsMain()) return; - caspar_log(browser, - boost::log::trivial::trace, - "context for frame " + frame->GetIdentifier().ToString() + " created"); + caspar_log( + browser, boost::log::trivial::trace, "context for frame " + frame->GetIdentifier().ToString() + " created"); contexts_.push_back(context); auto window = context->GetGlobal(); diff --git a/src/modules/image/consumer/image_consumer.cpp b/src/modules/image/consumer/image_consumer.cpp index 655c2cea00..169f7c42c4 100644 --- a/src/modules/image/consumer/image_consumer.cpp +++ b/src/modules/image/consumer/image_consumer.cpp @@ -45,8 +45,8 @@ #include #include -#include "../util/image_view.h" #include "../util/image_algorithms.h" +#include "../util/image_view.h" namespace caspar { namespace image { diff --git a/src/modules/image/producer/image_producer.cpp b/src/modules/image/producer/image_producer.cpp index 051eccb959..c90effab38 100644 --- a/src/modules/image/producer/image_producer.cpp +++ b/src/modules/image/producer/image_producer.cpp @@ -64,16 +64,27 @@ struct image_producer : public core::frame_producer const uint32_t length_ = 0; core::draw_frame frame_; - image_producer(const spl::shared_ptr& frame_factory, std::wstring description, uint32_t length, core::frame_geometry::scale_mode scale_mode) : - description_(std::move(description)), frame_factory_(frame_factory), length_(length) + image_producer(const spl::shared_ptr& frame_factory, + std::wstring description, + uint32_t length, + core::frame_geometry::scale_mode scale_mode) + : description_(std::move(description)) + , frame_factory_(frame_factory) + , length_(length) { load(load_image(description_), scale_mode); CASPAR_LOG(info) << print() << L" Initialized"; } - image_producer(const spl::shared_ptr& frame_factory, const void* png_data, size_t size, uint32_t length, core::frame_geometry::scale_mode scale_mode) : - description_(L"png from memory"), frame_factory_(frame_factory), length_(length) + image_producer(const spl::shared_ptr& frame_factory, + const void* png_data, + size_t size, + uint32_t length, + core::frame_geometry::scale_mode scale_mode) + : description_(L"png from memory") + , frame_factory_(frame_factory) + , length_(length) { load(load_png_from_memory(png_data, size), scale_mode); @@ -86,7 +97,7 @@ struct image_producer : public core::frame_producer core::pixel_format_desc desc(core::pixel_format::bgra); desc.planes.emplace_back(FreeImage_GetWidth(bitmap.get()), FreeImage_GetHeight(bitmap.get()), 4); - auto frame = frame_factory_->create_frame(this, desc); + auto frame = frame_factory_->create_frame(this, desc); frame.geometry() = core::frame_geometry::get_default(scale_mode); std::copy_n(FreeImage_GetBits(bitmap.get()), frame.image_data(0).size(), frame.image_data(0).begin()); @@ -123,7 +134,7 @@ spl::shared_ptr create_producer(const core::frame_producer return core::frame_producer::empty(); } - auto length = get_param(L"LENGTH", params, std::numeric_limits::max()); + auto length = get_param(L"LENGTH", params, std::numeric_limits::max()); auto scale_mode = core::scale_mode_from_string(get_param(L"SCALE_MODE", params, L"STRETCH")); auto filename = find_file_within_dir_or_absolute(env::media_folder(), params.at(0), is_valid_file); diff --git a/src/modules/image/util/image_loader.cpp b/src/modules/image/util/image_loader.cpp index e95d506ca4..859539c912 100644 --- a/src/modules/image/util/image_loader.cpp +++ b/src/modules/image/util/image_loader.cpp @@ -68,7 +68,8 @@ std::shared_ptr load_image(const std::wstring& filename) #ifdef WIN32 auto bitmap = std::shared_ptr(FreeImage_LoadU(fif, filename.c_str(), JPEG_EXIFROTATE), FreeImage_Unload); #else - auto bitmap = std::shared_ptr(FreeImage_Load(fif, u8(filename).c_str(), JPEG_EXIFROTATE), FreeImage_Unload); + auto bitmap = + std::shared_ptr(FreeImage_Load(fif, u8(filename).c_str(), JPEG_EXIFROTATE), FreeImage_Unload); #endif if (FreeImage_GetBPP(bitmap.get()) != 32) { @@ -94,7 +95,8 @@ std::shared_ptr load_png_from_memory(const void* memory_location, size auto memory = std::unique_ptr( FreeImage_OpenMemory(static_cast(const_cast(memory_location)), static_cast(size)), FreeImage_CloseMemory); - auto bitmap = std::shared_ptr(FreeImage_LoadFromMemory(fif, memory.get(), JPEG_EXIFROTATE), FreeImage_Unload); + auto bitmap = + std::shared_ptr(FreeImage_LoadFromMemory(fif, memory.get(), JPEG_EXIFROTATE), FreeImage_Unload); if (FreeImage_GetBPP(bitmap.get()) != 32) { bitmap = std::shared_ptr(FreeImage_ConvertTo32Bits(bitmap.get()), FreeImage_Unload); diff --git a/src/modules/newtek/util/ndi.cpp b/src/modules/newtek/util/ndi.cpp index 404e58ca64..203dc2e450 100644 --- a/src/modules/newtek/util/ndi.cpp +++ b/src/modules/newtek/util/ndi.cpp @@ -109,7 +109,7 @@ NDIlib_v5* load_library() } NDIlib_find_create_t find_instance_options = {}; - find_instance_options.show_local_sources = true; + find_instance_options.show_local_sources = true; find_instance.reset(new NDIlib_find_instance_t(ndi_lib->NDIlib_find_create_v2(&find_instance_options)), [](NDIlib_find_instance_t* p) { ndi_lib->NDIlib_find_destroy(*p); }); diff --git a/src/modules/oal/consumer/oal_consumer.cpp b/src/modules/oal/consumer/oal_consumer.cpp index 8977928c90..81a9461e00 100644 --- a/src/modules/oal/consumer/oal_consumer.cpp +++ b/src/modules/oal/consumer/oal_consumer.cpp @@ -248,16 +248,16 @@ struct oal_consumer : public core::frame_consumer std::future send(core::video_field field, core::const_frame frame) override { executor_.begin_invoke([=] { - auto dst = std::shared_ptr(av_frame_alloc(), [](AVFrame* ptr) { av_frame_free(&ptr); }); - dst->format = AV_SAMPLE_FMT_S16; - dst->sample_rate = format_desc_.audio_sample_rate; + auto dst = std::shared_ptr(av_frame_alloc(), [](AVFrame* ptr) { av_frame_free(&ptr); }); + dst->format = AV_SAMPLE_FMT_S16; + dst->sample_rate = format_desc_.audio_sample_rate; #if FFMPEG_NEW_CHANNEL_LAYOUT av_channel_layout_default(&dst->ch_layout, 2); #else dst->channels = 2; dst->channel_layout = av_get_default_channel_layout(dst->channels); #endif - dst->nb_samples = duration_; + dst->nb_samples = duration_; if (av_frame_get_buffer(dst.get(), 32) < 0) { // TODO FF error CASPAR_THROW_EXCEPTION(invalid_argument()); @@ -280,16 +280,16 @@ struct oal_consumer : public core::frame_consumer return; } - auto src = std::shared_ptr(av_frame_alloc(), [](AVFrame* ptr) { av_frame_free(&ptr); }); - src->format = AV_SAMPLE_FMT_S32; - src->sample_rate = format_desc_.audio_sample_rate; + auto src = std::shared_ptr(av_frame_alloc(), [](AVFrame* ptr) { av_frame_free(&ptr); }); + src->format = AV_SAMPLE_FMT_S32; + src->sample_rate = format_desc_.audio_sample_rate; #if FFMPEG_NEW_CHANNEL_LAYOUT av_channel_layout_default(&src->ch_layout, format_desc_.audio_channels); #else src->channels = format_desc_.audio_channels; src->channel_layout = av_get_default_channel_layout(src->channels); #endif - src->nb_samples = static_cast(frame.audio_data().size() / format_desc_.audio_channels); + src->nb_samples = static_cast(frame.audio_data().size() / format_desc_.audio_channels); src->extended_data[0] = const_cast(reinterpret_cast(frame.audio_data().data())); src->linesize[0] = static_cast(frame.audio_data().size() * sizeof(int32_t)); diff --git a/src/protocol/amcp/amcp_command_context.h b/src/protocol/amcp/amcp_command_context.h index 7f357af013..54206010a7 100644 --- a/src/protocol/amcp/amcp_command_context.h +++ b/src/protocol/amcp/amcp_command_context.h @@ -29,7 +29,9 @@ #include #include -namespace caspar::protocol::osc { class client; } +namespace caspar::protocol::osc { +class client; +} namespace caspar { namespace protocol { namespace amcp { diff --git a/src/shell/windows_specific.cpp b/src/shell/windows_specific.cpp index b0bf62fd2d..b1a33a31c8 100644 --- a/src/shell/windows_specific.cpp +++ b/src/shell/windows_specific.cpp @@ -36,7 +36,7 @@ #include // NOTE: This is needed in order to make CComObject work since this is not a real ATL project. -CComModule _AtlModule; +CComModule _AtlModule; extern __declspec(selectany) CAtlModule* _pAtlModule = &_AtlModule; extern "C" {