From f4d375d15b2555b2cf7a048fc024960809b72d48 Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Mon, 25 Apr 2022 19:40:58 +0100 Subject: [PATCH] chore: format --- src/common/except.h | 5 +- src/common/os/linux/thread.cpp | 8 +- src/common/os/thread.h | 4 +- src/common/os/windows/thread.cpp | 5 +- src/core/consumer/frame_consumer.cpp | 3 +- src/core/producer/stage.cpp | 15 +- src/core/producer/stage.h | 4 +- .../transition/transition_producer.cpp | 1 - .../bluefish/consumer/bluefish_consumer.cpp | 12 +- .../decklink/producer/decklink_producer.cpp | 4 +- src/modules/ffmpeg/producer/av_input.cpp | 2 +- src/modules/ffmpeg/producer/av_input.h | 2 +- src/modules/ffmpeg/producer/av_producer.cpp | 51 ++-- .../ffmpeg/producer/ffmpeg_producer.cpp | 30 +- src/modules/ffmpeg/util/av_assert.h | 6 +- src/modules/ffmpeg/util/av_util.cpp | 46 +-- src/modules/flash/producer/flash_producer.cpp | 12 +- .../image/producer/image_scroll_producer.cpp | 261 +++++++++--------- .../image/producer/image_scroll_producer.h | 47 ++-- .../newtek/consumer/newtek_ndi_consumer.cpp | 35 ++- .../newtek/producer/newtek_ndi_producer.cpp | 11 +- .../screen/consumer/screen_consumer.cpp | 8 +- src/protocol/amcp/AMCPCommand.h | 9 +- src/protocol/amcp/AMCPProtocolStrategy.cpp | 17 +- src/protocol/amcp/amcp_command_repository.cpp | 20 +- src/protocol/amcp/amcp_command_repository.h | 4 +- src/protocol/util/tokenize.h | 2 +- src/shell/main.cpp | 5 +- src/shell/server.cpp | 1 - tools/update-format.sh | 2 +- 30 files changed, 299 insertions(+), 333 deletions(-) diff --git a/src/common/except.h b/src/common/except.h index 072a91e87f..e4c3ee6add 100644 --- a/src/common/except.h +++ b/src/common/except.h @@ -145,8 +145,7 @@ struct not_supported : virtual user_error #define CASPAR_THROW_EXCEPTION(x) \ ::boost::throw_exception(::boost::enable_error_info(x) \ - << ::boost::throw_function(BOOST_CURRENT_FUNCTION) \ - << ::boost::throw_file(__FILE__) << ::boost::throw_line((int)__LINE__) \ - << stacktrace_info()) + << ::boost::throw_function(BOOST_CURRENT_FUNCTION) << ::boost::throw_file(__FILE__) \ + << ::boost::throw_line((int)__LINE__) << stacktrace_info()) } // namespace caspar diff --git a/src/common/os/linux/thread.cpp b/src/common/os/linux/thread.cpp index e927ee501b..17e12c5747 100644 --- a/src/common/os/linux/thread.cpp +++ b/src/common/os/linux/thread.cpp @@ -7,9 +7,10 @@ namespace caspar { void set_thread_name(const std::wstring& name) { pthread_setname_np(pthread_self(), u8(name).c_str()); } -void set_thread_realtime_priority() { - pthread_t handle = pthread_self(); - int policy; +void set_thread_realtime_priority() +{ + pthread_t handle = pthread_self(); + int policy; struct sched_param param; if (pthread_getschedparam(handle, &policy, ¶m) != 0) return; @@ -17,5 +18,4 @@ void set_thread_realtime_priority() { pthread_setschedparam(handle, SCHED_FIFO, ¶m); } - } // namespace caspar diff --git a/src/common/os/thread.h b/src/common/os/thread.h index 56735986fd..3b3fac7176 100644 --- a/src/common/os/thread.h +++ b/src/common/os/thread.h @@ -6,6 +6,4 @@ namespace caspar { void set_thread_name(const std::wstring& name); void set_thread_realtime_priority(); -} - - +} // namespace caspar diff --git a/src/common/os/windows/thread.cpp b/src/common/os/windows/thread.cpp index cc9d4b1f32..d905d329fa 100644 --- a/src/common/os/windows/thread.cpp +++ b/src/common/os/windows/thread.cpp @@ -33,9 +33,6 @@ inline void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) void set_thread_name(const std::wstring& name) { SetThreadName(GetCurrentThreadId(), u8(name).c_str()); } -void set_thread_realtime_priority() { - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); -} - +void set_thread_realtime_priority() { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); } } // namespace caspar diff --git a/src/core/consumer/frame_consumer.cpp b/src/core/consumer/frame_consumer.cpp index 6c2342837d..55d8adfc34 100644 --- a/src/core/consumer/frame_consumer.cpp +++ b/src/core/consumer/frame_consumer.cpp @@ -108,8 +108,7 @@ class destroy_consumer_proxy : public frame_consumer pointer_guard.reset(); counter--; - }) - .detach(); + }).detach(); } std::future send(const_frame frame) override { return consumer_->send(std::move(frame)); } diff --git a/src/core/producer/stage.cpp b/src/core/producer/stage.cpp index 18110e509e..35e51de10f 100644 --- a/src/core/producer/stage.cpp +++ b/src/core/producer/stage.cpp @@ -63,7 +63,8 @@ struct stage::impl : public std::enable_shared_from_this if (0 == depth) routeSources.clear(); - if (std::find_if(layerVec.begin(), layerVec.end(), [l](std::pair p) { return p.first == l; }) != layerVec.end()) { + if (std::find_if(layerVec.begin(), layerVec.end(), [l](std::pair p) { return p.first == l; }) != + layerVec.end()) { return; } @@ -88,7 +89,8 @@ struct stage::impl : public std::enable_shared_from_this layerOK = false; } - if (std::find_if(layerVec.begin(), layerVec.end(), [l](std::pair p) { return p.first == l; }) == layerVec.end()) { + if (std::find_if(layerVec.begin(), layerVec.end(), [l](std::pair p) { return p.first == l; }) == + layerVec.end()) { layerVec.push_back(std::make_pair(l, layerOK)); } } @@ -140,8 +142,9 @@ struct stage::impl : public std::enable_shared_from_this auto& layer = p->second; auto& tween = tweens_[p->first]; - layer_frame res = {}; - res.foreground = draw_frame::push(l.second ? layer.receive(format_desc, nb_samples) : draw_frame(), tween.fetch()); + layer_frame res = {}; + res.foreground = draw_frame::push(l.second ? layer.receive(format_desc, nb_samples) : draw_frame(), + tween.fetch()); res.has_background = layer.has_background(); if (std::find(fetch_background.begin(), fetch_background.end(), p->first) != fetch_background.end()) { @@ -230,8 +233,8 @@ struct stage::impl : public std::enable_shared_from_this { return executor_.begin_invoke([=] { get_layer(index).load(producer, preview, auto_play); }); } - - std::future preview(int index) + + std::future preview(int index) { return executor_.begin_invoke([=] { get_layer(index).preview(); }); } diff --git a/src/core/producer/stage.h b/src/core/producer/stage.h index b8d276d816..e2963b79ef 100644 --- a/src/core/producer/stage.h +++ b/src/core/producer/stage.h @@ -65,12 +65,12 @@ class stage final std::future apply_transforms(const std::vector& transforms); std::future - apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration, const tweener& tween); + apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration, const tweener& tween); std::future clear_transforms(int index); std::future clear_transforms(); std::future get_current_transform(int index); std::future - load(int index, const spl::shared_ptr& producer, bool preview = false, bool auto_play = false); + load(int index, const spl::shared_ptr& producer, bool preview = false, bool auto_play = false); std::future preview(int index); std::future pause(int index); std::future resume(int index); diff --git a/src/core/producer/transition/transition_producer.cpp b/src/core/producer/transition/transition_producer.cpp index 02b3d61ae1..4a3d7fa39a 100644 --- a/src/core/producer/transition/transition_producer.cpp +++ b/src/core/producer/transition/transition_producer.cpp @@ -171,7 +171,6 @@ class transition_producer : public frame_producer dst_frame.transform().image_transform.clip_scale[0] = delta; } else { dst_frame.transform().image_transform.clip_translation[0] = (1.0 - delta); - } } diff --git a/src/modules/bluefish/consumer/bluefish_consumer.cpp b/src/modules/bluefish/consumer/bluefish_consumer.cpp index e08cea2642..a922b66871 100644 --- a/src/modules/bluefish/consumer/bluefish_consumer.cpp +++ b/src/modules/bluefish/consumer/bluefish_consumer.cpp @@ -167,9 +167,9 @@ struct bluefish_consumer const int channel_index_; const configuration config_; - spl::shared_ptr blue_ = create_blue(config_.device_index); + spl::shared_ptr blue_ = create_blue(config_.device_index); spl::shared_ptr watchdog_bvc_ = create_blue(config_.device_index); - + std::mutex exception_mutex_; std::exception_ptr exception_; @@ -239,7 +239,7 @@ struct bluefish_consumer // Specify the video channel setup_hardware_output_channel(); // ie stream id - model_name_ = get_card_desc(*blue_.get(), (int)config_.device_index); + model_name_ = get_card_desc(*blue_.get(), (int)config_.device_index); // disable the video output while we do all the config. disable_video_output(); @@ -317,7 +317,7 @@ struct bluefish_consumer SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST); #endif } - + configure_watchdog(); enable_video_output(); } @@ -382,8 +382,8 @@ struct bluefish_consumer blue_prop = EPOCH_WATCHDOG_TIMER_SET_MACRO(enum_blue_app_watchdog_timer_start_stop, (unsigned int)0); blue_->set_card_property32(EPOCH_APP_WATCHDOG_TIMER, blue_prop); } - - // Setting up the watchdog properties + + // Setting up the watchdog properties unsigned int watchdog_timer_gpo_port = 1; // GPO port to use: 0 = none, 1 = port A, 2 = port B blue_prop = EPOCH_WATCHDOG_TIMER_SET_MACRO(enum_blue_app_watchdog_enable_gpo_on_active, watchdog_timer_gpo_port); diff --git a/src/modules/decklink/producer/decklink_producer.cpp b/src/modules/decklink/producer/decklink_producer.cpp index e30c6d8bcd..e9f61c7cd6 100644 --- a/src/modules/decklink/producer/decklink_producer.cpp +++ b/src/modules/decklink/producer/decklink_producer.cpp @@ -402,8 +402,8 @@ class decklink_producer : public IDeckLinkInputCallback } HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID*) override { return E_NOINTERFACE; } - ULONG STDMETHODCALLTYPE AddRef() override { return 1; } - ULONG STDMETHODCALLTYPE Release() override { return 1; } + ULONG STDMETHODCALLTYPE AddRef() override { return 1; } + ULONG STDMETHODCALLTYPE Release() override { return 1; } HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents notificationEvents, IDeckLinkDisplayMode* newDisplayMode, diff --git a/src/modules/ffmpeg/producer/av_input.cpp b/src/modules/ffmpeg/producer/av_input.cpp index c08dcfa70a..8e93a5f555 100644 --- a/src/modules/ffmpeg/producer/av_input.cpp +++ b/src/modules/ffmpeg/producer/av_input.cpp @@ -8,8 +8,8 @@ #include #include -#include #include +#include #include diff --git a/src/modules/ffmpeg/producer/av_input.h b/src/modules/ffmpeg/producer/av_input.h index f858c7336c..a907839354 100644 --- a/src/modules/ffmpeg/producer/av_input.h +++ b/src/modules/ffmpeg/producer/av_input.h @@ -13,8 +13,8 @@ #include -#include #include +#include struct AVPacket; struct AVFormatContext; diff --git a/src/modules/ffmpeg/producer/av_producer.cpp b/src/modules/ffmpeg/producer/av_producer.cpp index ecf9ab3aef..fc369a96b2 100644 --- a/src/modules/ffmpeg/producer/av_producer.cpp +++ b/src/modules/ffmpeg/producer/av_producer.cpp @@ -17,10 +17,10 @@ #include #include #include +#include #include #include #include -#include #include #include @@ -77,23 +77,23 @@ class Decoder Decoder(const Decoder&) = delete; Decoder& operator=(const Decoder&) = delete; - AVStream* st = nullptr; - int64_t next_pts = AV_NOPTS_VALUE; - std::atomic eof = { false }; + AVStream* st = nullptr; + int64_t next_pts = AV_NOPTS_VALUE; + std::atomic eof = {false}; std::queue> input; - mutable boost::mutex input_mutex; - boost::condition_variable input_cond; - int input_capacity = 2; + mutable boost::mutex input_mutex; + boost::condition_variable input_cond; + int input_capacity = 2; std::queue> output; - mutable boost::mutex output_mutex; - boost::condition_variable output_cond; - int output_capacity = 8; + mutable boost::mutex output_mutex; + boost::condition_variable output_cond; + int output_capacity = 8; boost::thread thread; -public: + public: std::shared_ptr ctx; Decoder() = default; @@ -140,12 +140,11 @@ class Decoder FF(avcodec_open2(ctx.get(), codec, nullptr)); - thread = boost::thread([=]() - { + thread = boost::thread([=]() { try { while (!thread.interruption_requested()) { auto av_frame = alloc_frame(); - auto ret = avcodec_receive_frame(ctx.get(), av_frame.get()); + auto ret = avcodec_receive_frame(ctx.get(), av_frame.get()); if (ret == AVERROR(EAGAIN)) { std::shared_ptr packet; @@ -159,8 +158,8 @@ class Decoder } else if (ret == AVERROR_EOF) { avcodec_flush_buffers(ctx.get()); av_frame->pts = next_pts; - next_pts = AV_NOPTS_VALUE; - eof = true; + next_pts = AV_NOPTS_VALUE; + eof = true; { boost::unique_lock lock(output_mutex); @@ -181,13 +180,13 @@ class Decoder auto duration_pts = av_frame->pkt_duration; if (duration_pts <= 0) { if (ctx->codec_type == AVMEDIA_TYPE_VIDEO) { - const auto ticks = - av_stream_get_parser(st) ? av_stream_get_parser(st)->repeat_pict + 1 : ctx->ticks_per_frame; - duration_pts = static_cast(AV_TIME_BASE) * ctx->framerate.den * ticks / - ctx->framerate.num / ctx->ticks_per_frame; - duration_pts = av_rescale_q(duration_pts, { 1, AV_TIME_BASE }, st->time_base); + const auto ticks = av_stream_get_parser(st) ? av_stream_get_parser(st)->repeat_pict + 1 + : ctx->ticks_per_frame; + duration_pts = static_cast(AV_TIME_BASE) * ctx->framerate.den * ticks / + ctx->framerate.num / ctx->ticks_per_frame; + duration_pts = av_rescale_q(duration_pts, {1, AV_TIME_BASE}, st->time_base); } else if (ctx->codec_type == AVMEDIA_TYPE_AUDIO) { - duration_pts = av_rescale_q(av_frame->nb_samples, { 1, ctx->sample_rate }, st->time_base); + duration_pts = av_rescale_q(av_frame->nb_samples, {1, ctx->sample_rate}, st->time_base); } } @@ -570,7 +569,7 @@ struct Filter auto av_frame = alloc_frame(); auto ret = nb_samples >= 0 ? av_buffersink_get_samples(sink, av_frame.get(), nb_samples) - : av_buffersink_get_frame(sink, av_frame.get()); + : av_buffersink_get_frame(sink, av_frame.get()); if (ret == AVERROR(EAGAIN)) { return false; @@ -802,13 +801,12 @@ struct AVProducer::Impl std::vector> futures; - if (!video_filter_.frame) { futures.push_back(video_executor_->begin_invoke([&]() { return video_filter_(); })); } if (!audio_filter_.frame) { - futures.push_back(audio_executor_->begin_invoke([&]() { return audio_filter_(audio_cadence[0]); })); + futures.push_back(audio_executor_->begin_invoke([&]() { return audio_filter_(audio_cadence[0]); })); } for (auto& future : futures) { @@ -1027,8 +1025,7 @@ struct AVProducer::Impl private: bool want_packet() { - return std::any_of( - decoders_.begin(), decoders_.end(), [](auto& p) { return p.second.want_packet(); }); + return std::any_of(decoders_.begin(), decoders_.end(), [](auto& p) { return p.second.want_packet(); }); } bool schedule() diff --git a/src/modules/ffmpeg/producer/ffmpeg_producer.cpp b/src/modules/ffmpeg/producer/ffmpeg_producer.cpp index 15353e3d93..29a8519765 100644 --- a/src/modules/ffmpeg/producer/ffmpeg_producer.cpp +++ b/src/modules/ffmpeg/producer/ffmpeg_producer.cpp @@ -97,8 +97,7 @@ struct ffmpeg_producer : public core::frame_producer } catch (...) { CASPAR_LOG_CURRENT_EXCEPTION(); } - }) - .detach(); + }).detach(); } // frame_producer @@ -196,18 +195,9 @@ struct ffmpeg_producer : public core::frame_producer boost::tribool has_valid_extension(const std::wstring& filename) { - static const auto invalid_exts = {L".tga", - L".tiff", - L".tif", - L".jp2", - L".jpx", - L".j2k", - L".j2c", - L".swf", - L".ct", - L".html", - L".htm"}; - static const auto valid_exts = {L".m2t", L".m2ts", L".mov", L".mp4", L".dv", L".flv", L".mpg", L".dnxhd", + static const auto invalid_exts = { + L".tga", L".tiff", L".tif", L".jp2", L".jpx", L".j2k", L".j2c", L".swf", L".ct", L".html", L".htm"}; + static const auto valid_exts = {L".m2t", L".m2ts", L".mov", L".mp4", L".dv", L".flv", L".mpg", L".dnxhd", L".h264", L".prores", L".mkv", L".mxf", L".ts", L".mp3", L".wav", L".wma", L".nut", L".flac", L".opus", L".ogg", L".ogv", L".oga", L".webm", L".webp"}; @@ -351,8 +341,16 @@ spl::shared_ptr create_producer(const core::frame_producer auto afilter = boost::to_lower_copy(get_param(L"AF", params, get_param(L"FILTER", params, L""))); try { - auto producer = spl::make_shared( - dependencies.frame_factory, dependencies.format_desc, name, path, vfilter, afilter, start, duration, loop, seekable); + auto producer = spl::make_shared(dependencies.frame_factory, + dependencies.format_desc, + name, + path, + vfilter, + afilter, + start, + duration, + loop, + seekable); return core::create_destroy_proxy(std::move(producer)); } catch (...) { CASPAR_LOG_CURRENT_EXCEPTION(); diff --git a/src/modules/ffmpeg/util/av_assert.h b/src/modules/ffmpeg/util/av_assert.h index 272f309d60..6001b481c6 100644 --- a/src/modules/ffmpeg/util/av_assert.h +++ b/src/modules/ffmpeg/util/av_assert.h @@ -10,8 +10,7 @@ struct ffmpeg_error_t : virtual caspar_exception using ffmpeg_errn_info = boost::error_info; -} -} // namespace caspar::ffmpeg +}} // namespace caspar::ffmpeg #define THROW_ON_ERROR_STR_(call) #call #define THROW_ON_ERROR_STR(call) THROW_ON_ERROR_STR_(call) @@ -19,8 +18,7 @@ using ffmpeg_errn_info = boost::error_info; #define FF_RET(ret, func) \ if (ret < 0) { \ CASPAR_THROW_EXCEPTION(caspar::ffmpeg::ffmpeg_error_t() \ - << boost::errinfo_api_function(func) \ - << caspar::ffmpeg::ffmpeg_errn_info(ret) \ + << boost::errinfo_api_function(func) << caspar::ffmpeg::ffmpeg_errn_info(ret) \ << boost::errinfo_errno(AVUNERROR(ret))); \ } diff --git a/src/modules/ffmpeg/util/av_util.cpp b/src/modules/ffmpeg/util/av_util.cpp index 31a5533557..9ac6874160 100644 --- a/src/modules/ffmpeg/util/av_util.cpp +++ b/src/modules/ffmpeg/util/av_util.cpp @@ -50,31 +50,33 @@ core::mutable_frame make_frame(void* tag, auto frame = frame_factory.create_frame(tag, pix_desc); - tbb::parallel_invoke([&]() { - if (video) { - for (int n = 0; n < static_cast(pix_desc.planes.size()); ++n) { - auto frame_plan_index = data_map.empty() ? n : data_map.at(n); - - tbb::parallel_for(0, pix_desc.planes[n].height, [&](int y) { - std::memcpy(frame.image_data(n).begin() + y * pix_desc.planes[n].linesize, - video->data[frame_plan_index] + y * video->linesize[frame_plan_index], - pix_desc.planes[n].linesize); - }); + tbb::parallel_invoke( + [&]() { + if (video) { + for (int n = 0; n < static_cast(pix_desc.planes.size()); ++n) { + auto frame_plan_index = data_map.empty() ? n : data_map.at(n); + + tbb::parallel_for(0, pix_desc.planes[n].height, [&](int y) { + std::memcpy(frame.image_data(n).begin() + y * pix_desc.planes[n].linesize, + video->data[frame_plan_index] + y * video->linesize[frame_plan_index], + pix_desc.planes[n].linesize); + }); + } } - } - }, [&]() { - if (audio) { - // TODO This is a bit of a hack - frame.audio_data() = std::vector(audio->nb_samples * 8, 0); - auto dst = frame.audio_data().data(); - auto src = reinterpret_cast(audio->data[0]); - for (auto i = 0; i < audio->nb_samples; i++) { - for (auto j = 0; j < std::min(8, audio->channels); ++j) { - dst[i * 8 + j] = src[i * audio->channels + j]; + }, + [&]() { + if (audio) { + // TODO This is a bit of a hack + frame.audio_data() = std::vector(audio->nb_samples * 8, 0); + auto dst = frame.audio_data().data(); + auto src = reinterpret_cast(audio->data[0]); + for (auto i = 0; i < audio->nb_samples; i++) { + for (auto j = 0; j < std::min(8, audio->channels); ++j) { + dst[i * 8 + j] = src[i * audio->channels + j]; + } } } - } - }); + }); return frame; } diff --git a/src/modules/flash/producer/flash_producer.cpp b/src/modules/flash/producer/flash_producer.cpp index 6c0510dbef..2064766c9c 100644 --- a/src/modules/flash/producer/flash_producer.cpp +++ b/src/modules/flash/producer/flash_producer.cpp @@ -49,8 +49,8 @@ #include #include #include -#include #include +#include #include #include @@ -160,10 +160,10 @@ std::mutex& get_global_init_destruct_mutex() std::wstring url_from_path(std::wstring in) { - DWORD out_length = INTERNET_MAX_URL_LENGTH * 2; - PWSTR out_buf = (PWSTR)malloc(out_length + 4); + DWORD out_length = INTERNET_MAX_URL_LENGTH * 2; + PWSTR out_buf = (PWSTR)malloc(out_length + 4); CASPAR_SCOPE_EXIT { free(out_buf); }; - HRESULT ret = UrlCreateFromPathW(in.c_str(), out_buf, &out_length, NULL); + HRESULT ret = UrlCreateFromPathW(in.c_str(), out_buf, &out_length, NULL); if (SUCCEEDED(ret)) { return std::wstring(out_buf); } else { @@ -593,8 +593,8 @@ spl::shared_ptr create_swf_producer(const core::frame_prod swf_t::header_t header(filename); - const auto url = url_from_path(filename); - auto producer = spl::make_shared( + const auto url = url_from_path(filename); + auto producer = spl::make_shared( dependencies.frame_factory, dependencies.format_desc, url, header.frame_width, header.frame_height); producer->call({L"start_rendering"}).get(); diff --git a/src/modules/image/producer/image_scroll_producer.cpp b/src/modules/image/producer/image_scroll_producer.cpp index f76a52619c..94d5b1e634 100644 --- a/src/modules/image/producer/image_scroll_producer.cpp +++ b/src/modules/image/producer/image_scroll_producer.cpp @@ -1,24 +1,24 @@ /* -* Copyright (c) 2011 Sveriges Television AB -* -* This file is part of CasparCG (www.casparcg.com). -* -* CasparCG is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -* Author: Robert Nagy, ronag89@gmail.com -* Author: Helge Norberg, helge.norberg@svt.se -*/ + * Copyright (c) 2011 Sveriges Television AB + * + * This file is part of CasparCG (www.casparcg.com). + * + * CasparCG is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CasparCG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CasparCG. If not, see . + * + * Author: Robert Nagy, ronag89@gmail.com + * Author: Helge Norberg, helge.norberg@svt.se + */ #include "image_scroll_producer.h" @@ -29,58 +29,54 @@ #endif #include +#include "../util/image_algorithms.h" #include "../util/image_loader.h" #include "../util/image_view.h" -#include "../util/image_algorithms.h" #include -#include #include +#include #include #include #include #include +#include #include -#include #include -#include -#include -#include -#include #include +#include +#include +#include +#include #include +#include +#include #include #include #include #include -#include -#include #include #include #include -namespace caspar { -namespace image { +namespace caspar { namespace image { // Like tweened_transform but for speed class speed_tweener { - double source_ = 0.0; - double dest_ = 0.0; - int duration_ = 0; - int time_ = 0; - tweener tweener_; -public: + double source_ = 0.0; + double dest_ = 0.0; + int duration_ = 0; + int time_ = 0; + tweener tweener_; + + public: speed_tweener() = default; - speed_tweener( - double source, - double dest, - int duration, - const tweener& tween) + speed_tweener(double source, double dest, int duration, const tweener& tween) : source_(source) , dest_(dest) , duration_(duration) @@ -89,17 +85,14 @@ class speed_tweener { } - double dest() const - { - return dest_; - } + double dest() const { return dest_; } double fetch() const { if (time_ == duration_) return dest_; - double delta = dest_ - source_; + double delta = dest_ - source_; double result = tweener_(time_, source_, delta, duration_); return result; @@ -114,33 +107,32 @@ class speed_tweener struct image_scroll_producer : public core::frame_producer { - core::monitor::state state_; - - const std::wstring filename_; - std::vector frames_; - core::video_format_desc format_desc_; - int width_; - int height_; - - double delta_ = 0.0; - speed_tweener speed_; - boost::optional end_time_; - core::draw_frame frame_; - - int start_offset_x_ = 0; - int start_offset_y_ = 0; - bool progressive_; - - explicit image_scroll_producer( - const spl::shared_ptr& frame_factory, - const core::video_format_desc& format_desc, - const std::wstring& filename, - double s, - double duration, - boost::optional end_time, - int motion_blur_px = 0, - bool premultiply_with_alpha = false, - bool progressive = false) + core::monitor::state state_; + + const std::wstring filename_; + std::vector frames_; + core::video_format_desc format_desc_; + int width_; + int height_; + + double delta_ = 0.0; + speed_tweener speed_; + boost::optional end_time_; + core::draw_frame frame_; + + int start_offset_x_ = 0; + int start_offset_y_ = 0; + bool progressive_; + + explicit image_scroll_producer(const spl::shared_ptr& frame_factory, + const core::video_format_desc& format_desc, + const std::wstring& filename, + double s, + double duration, + boost::optional end_time, + int motion_blur_px = 0, + bool premultiply_with_alpha = false, + bool progressive = false) : filename_(filename) , format_desc_(format_desc) , end_time_(std::move(end_time)) @@ -154,10 +146,10 @@ struct image_scroll_producer : public core::frame_producer auto bitmap = load_image(filename_); FreeImage_FlipVertical(bitmap.get()); - width_ = FreeImage_GetWidth(bitmap.get()); + width_ = FreeImage_GetWidth(bitmap.get()); height_ = FreeImage_GetHeight(bitmap.get()); - bool vertical = width_ == format_desc_.width; + bool vertical = width_ == format_desc_.width; bool horizontal = height_ == format_desc_.height; if (!vertical && !horizontal) @@ -180,8 +172,8 @@ struct image_scroll_producer : public core::frame_producer speed_ = speed_tweener(speed, speed, 0, tweener(L"linear")); - auto bytes = FreeImage_GetBits(bitmap.get()); - auto count = width_ * height_ * 4; + auto bytes = FreeImage_GetBits(bitmap.get()); + auto count = width_ * height_ * 4; image_view original_view(bytes, width_, height_); if (premultiply_with_alpha) @@ -196,12 +188,12 @@ struct image_scroll_producer : public core::frame_producer angle *= 2; // Left else if (vertical && speed > 0) angle *= 3; // Down - else if (horizontal && speed > 0) + else if (horizontal && speed > 0) angle = 0.0; // Right blurred_copy.reset(new uint8_t[count]); image_view blurred_view(blurred_copy.get(), width_, height_); - caspar::tweener blur_tweener(L"easeInQuad"); + caspar::tweener blur_tweener(L"easeInQuad"); blur(original_view, blurred_view, angle, motion_blur_px, blur_tweener); bytes = blurred_copy.get(); bitmap.reset(); @@ -216,7 +208,9 @@ struct image_scroll_producer : public core::frame_producer auto frame = frame_factory->create_frame(this, desc); if (count >= frame.image_data(0).size()) { - std::copy_n(bytes + count - frame.image_data(0).size(), frame.image_data(0).size(), frame.image_data(0).begin()); + std::copy_n(bytes + count - frame.image_data(0).size(), + frame.image_data(0).size(), + frame.image_data(0).begin()); count -= static_cast(frame.image_data(0).size()); } else { memset(frame.image_data(0).begin(), 0, frame.image_data(0).size()); @@ -239,7 +233,9 @@ struct image_scroll_producer : public core::frame_producer auto frame = frame_factory->create_frame(this, desc); if (count >= frame.image_data(0).size()) { for (int y = 0; y < height_; ++y) - std::copy_n(bytes + i * format_desc_.width * 4 + y * width_ * 4, format_desc_.width * 4, frame.image_data(0).begin() + y * format_desc_.width * 4); + std::copy_n(bytes + i * format_desc_.width * 4 + y * width_ * 4, + format_desc_.width * 4, + frame.image_data(0).begin() + y * format_desc_.width * 4); ++i; count -= static_cast(frame.image_data(0).size()); @@ -247,7 +243,9 @@ struct image_scroll_producer : public core::frame_producer memset(frame.image_data(0).begin(), 0, frame.image_data(0).size()); auto width2 = width_ % format_desc_.width; for (int y = 0; y < height_; ++y) - std::copy_n(bytes + i * format_desc_.width * 4 + y * width_ * 4, width2 * 4, frame.image_data(0).begin() + y * format_desc_.width * 4); + std::copy_n(bytes + i * format_desc_.width * 4 + y * width_ * 4, + width2 * 4, + frame.image_data(0).begin() + y * format_desc_.width * 4); count = 0; } @@ -259,7 +257,7 @@ struct image_scroll_producer : public core::frame_producer // Set the relative positions of the image fragments. for (size_t n = 0; n < frames_.size(); ++n) { - double translation = -(static_cast(n) + 1.0); + double translation = -(static_cast(n) + 1.0); frames_[n].transform().image_transform.fill_translation[0] = translation; } } @@ -290,10 +288,10 @@ struct image_scroll_producer : public core::frame_producer if (params.size() == 1) return make_ready_future(boost::lexical_cast(-speed_.fetch())); - auto val = boost::lexical_cast(params.at(1)); - int duration = params.size() > 2 ? boost::lexical_cast(params.at(2)) : 0; - std::wstring tween = params.size() > 3 ? params.at(3) : L"linear"; - speed_ = speed_tweener(speed_.fetch(), -val, duration, tween); + auto val = boost::lexical_cast(params.at(1)); + int duration = params.size() > 2 ? boost::lexical_cast(params.at(2)) : 0; + std::wstring tween = params.size() > 3 ? params.at(3) : L"linear"; + speed_ = speed_tweener(speed_.fetch(), -val, duration, tween); } return make_ready_future(L""); @@ -308,14 +306,16 @@ struct image_scroll_producer : public core::frame_producer auto& fill_translation = frame.transform().image_transform.fill_translation; if (width_ == format_desc_.width) { - auto motion_offset_in_screens = (static_cast(start_offset_y_) + delta_) / static_cast(format_desc_.height); + auto motion_offset_in_screens = + (static_cast(start_offset_y_) + delta_) / static_cast(format_desc_.height); auto vertical_offset = fill_translation[1] + motion_offset_in_screens; if (vertical_offset < -1.0 || vertical_offset > 1.0) { continue; } } else { - auto motion_offset_in_screens = (static_cast(start_offset_x_) + delta_) / static_cast(format_desc_.width); + auto motion_offset_in_screens = + (static_cast(start_offset_x_) + delta_) / static_cast(format_desc_.width); auto horizontal_offset = fill_translation[0] + motion_offset_in_screens; if (horizontal_offset < -1.0 || horizontal_offset > 1.0) { @@ -336,22 +336,20 @@ struct image_scroll_producer : public core::frame_producer return core::draw_frame::empty(); core::draw_frame result(get_visible()); - auto& fill_translation = result.transform().image_transform.fill_translation; + auto& fill_translation = result.transform().image_transform.fill_translation; if (width_ == format_desc_.width) { if (static_cast(std::abs(delta_)) >= height_ + format_desc_.height && allow_eof) return core::draw_frame::empty(); - fill_translation[1] = - static_cast(start_offset_y_) / static_cast(format_desc_.height) - + delta_ / static_cast(format_desc_.height); + fill_translation[1] = static_cast(start_offset_y_) / static_cast(format_desc_.height) + + delta_ / static_cast(format_desc_.height); } else { if (static_cast(std::abs(delta_)) >= width_ + format_desc_.width && allow_eof) return core::draw_frame::empty(); - fill_translation[0] = - static_cast(start_offset_x_) / static_cast(format_desc_.width) - + (delta_) / static_cast(format_desc_.width); + fill_translation[0] = static_cast(start_offset_x_) / static_cast(format_desc_.width) + + (delta_) / static_cast(format_desc_.width); } return result; @@ -373,7 +371,7 @@ struct image_scroll_producer : public core::frame_producer if (end_time_) { boost::posix_time::ptime now(boost::posix_time::second_clock::local_time()); - auto diff = *end_time_ - now; + auto diff = *end_time_ - now; auto seconds = diff.total_seconds(); set_speed(-speed_from_duration(static_cast(seconds))); @@ -382,10 +380,7 @@ struct image_scroll_producer : public core::frame_producer delta_ += speed_.fetch_and_tick(); } - void set_speed(double speed) - { - speed_ = speed_tweener(speed, speed, 0, tweener(L"linear")); - } + void set_speed(double speed) { speed_ = speed_tweener(speed, speed, 0, tweener(L"linear")); } core::draw_frame receive_impl(int nb_samples) override { @@ -393,34 +388,26 @@ struct image_scroll_producer : public core::frame_producer return frame_; } - std::wstring print() const override - { - return L"image_scroll_producer[" + filename_ + L"]"; - } + std::wstring print() const override { return L"image_scroll_producer[" + filename_ + L"]"; } - std::wstring name() const override - { - return L"image-scroll"; - } + std::wstring name() const override { return L"image-scroll"; } uint32_t nb_frames() const override { if (width_ == format_desc_.width) { auto length = (height_ + format_desc_.height * 2); - return static_cast(length / std::abs(speed_.fetch()));// + length % std::abs(delta_)); + return static_cast(length / std::abs(speed_.fetch())); // + length % std::abs(delta_)); } else { auto length = (width_ + format_desc_.width * 2); - return static_cast(length / std::abs(speed_.fetch()));// + length % std::abs(delta_)); + return static_cast(length / std::abs(speed_.fetch())); // + length % std::abs(delta_)); } } - core::monitor::state& state() - { - return state_; - } + core::monitor::state& state() { return state_; } }; -spl::shared_ptr create_scroll_producer(const core::frame_producer_dependencies& dependencies, const std::vector& params) +spl::shared_ptr create_scroll_producer(const core::frame_producer_dependencies& dependencies, + const std::vector& params) { if (boost::contains(params.at(0), L"://")) { return core::frame_producer::empty(); @@ -428,17 +415,19 @@ spl::shared_ptr create_scroll_producer(const core::frame_p std::wstring filename = env::media_folder() + params.at(0); - auto ext = std::find_if(supported_extensions().begin(), supported_extensions().end(), [&](const std::wstring& ex) -> bool { - auto file = caspar::find_case_insensitive(boost::filesystem::path(filename).replace_extension(ex).wstring()); + auto ext = + std::find_if(supported_extensions().begin(), supported_extensions().end(), [&](const std::wstring& ex) -> bool { + auto file = + caspar::find_case_insensitive(boost::filesystem::path(filename).replace_extension(ex).wstring()); - return static_cast(file); - }); + return static_cast(file); + }); if (ext == supported_extensions().end()) return core::frame_producer::empty(); - double duration = 0.0; - double speed = get_param(L"SPEED", params, 0.0); + double duration = 0.0; + double speed = get_param(L"SPEED", params, 0.0); boost::optional end_time; if (speed == 0) @@ -458,19 +447,17 @@ spl::shared_ptr create_scroll_producer(const core::frame_p int motion_blur_px = get_param(L"BLUR", params, 0); bool premultiply_with_alpha = contains_param(L"PREMULTIPLY", params); - bool progressive = contains_param(L"PROGRESSIVE", params); - - return spl::make_shared( - dependencies.frame_factory, - dependencies.format_desc, - *caspar::find_case_insensitive(filename + *ext), - -speed, - -duration, - end_time, - motion_blur_px, - premultiply_with_alpha, - progressive); + bool progressive = contains_param(L"PROGRESSIVE", params); + + return spl::make_shared(dependencies.frame_factory, + dependencies.format_desc, + *caspar::find_case_insensitive(filename + *ext), + -speed, + -duration, + end_time, + motion_blur_px, + premultiply_with_alpha, + progressive); } -} -} +}} // namespace caspar::image diff --git a/src/modules/image/producer/image_scroll_producer.h b/src/modules/image/producer/image_scroll_producer.h index c6f73b7029..dcdd7fecc5 100644 --- a/src/modules/image/producer/image_scroll_producer.h +++ b/src/modules/image/producer/image_scroll_producer.h @@ -1,24 +1,24 @@ #pragma once /* -* Copyright (c) 2011 Sveriges Television AB -* -* This file is part of CasparCG (www.casparcg.com). -* -* CasparCG is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -* Author: Robert Nagy, ronag89@gmail.com -*/ + * Copyright (c) 2011 Sveriges Television AB + * + * This file is part of CasparCG (www.casparcg.com). + * + * CasparCG is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CasparCG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CasparCG. If not, see . + * + * Author: Robert Nagy, ronag89@gmail.com + */ #pragma once @@ -27,10 +27,9 @@ #include #include -namespace caspar { -namespace image { +namespace caspar { namespace image { -spl::shared_ptr create_scroll_producer(const core::frame_producer_dependencies& dependencies, const std::vector& params); +spl::shared_ptr create_scroll_producer(const core::frame_producer_dependencies& dependencies, + const std::vector& params); -} -} +}} // namespace caspar::image diff --git a/src/modules/newtek/consumer/newtek_ndi_consumer.cpp b/src/modules/newtek/consumer/newtek_ndi_consumer.cpp index e4fb600ea0..fc7f249963 100644 --- a/src/modules/newtek/consumer/newtek_ndi_consumer.cpp +++ b/src/modules/newtek/consumer/newtek_ndi_consumer.cpp @@ -33,8 +33,8 @@ #include #include -#include #include +#include #include #include #include @@ -95,7 +95,8 @@ struct newtek_ndi_consumer : public core::frame_consumer diagnostics::register_graph(graph_); } - ~newtek_ndi_consumer() { + ~newtek_ndi_consumer() + { if (send_thread.joinable()) { send_thread.interrupt(); send_thread.join(); @@ -113,7 +114,7 @@ struct newtek_ndi_consumer : public core::frame_consumer auto tmp_name = u8(name_); NDI_send_create_desc.p_ndi_name = tmp_name.c_str(); - //NDI defaults to clocking on video, however it's very jittery. + // NDI defaults to clocking on video, however it's very jittery. NDI_send_create_desc.clock_video = false; NDI_send_create_desc.clock_audio = false; @@ -144,15 +145,14 @@ struct newtek_ndi_consumer : public core::frame_consumer graph_->set_text(print()); // CASPAR_VERIFY(ndi_send_instance_); - send_thread = boost::thread([=]() - { + send_thread = boost::thread([=]() { set_thread_realtime_priority(); set_thread_name(L"NDI-SEND: " + name_); CASPAR_LOG(info) << L"Starting ndi-send thread for ndi output: " << name_; try { - auto buffer_size = buffer_.size(); - //Buffer a few frames to keep NDI going when caspar is slow on a few frames - //This can be removed when CasparCG doesn't periodally slows down on frames + auto buffer_size = buffer_.size(); + // Buffer a few frames to keep NDI going when caspar is slow on a few frames + // This can be removed when CasparCG doesn't periodally slows down on frames while (!send_thread.interruption_requested()) { { std::unique_lock lock(buffer_mutex_); @@ -165,12 +165,11 @@ struct newtek_ndi_consumer : public core::frame_consumer } } - //Use steady clock to generate a near perfect NDI tick time. + // Use steady clock to generate a near perfect NDI tick time. auto frametimeUs = static_cast(1000000 / format_desc_.fps); - auto time_point = std::chrono::steady_clock::now(); + auto time_point = std::chrono::steady_clock::now(); time_point += std::chrono::microseconds(frametimeUs); - while (!send_thread.interruption_requested()) - { + while (!send_thread.interruption_requested()) { core::const_frame frame; { std::unique_lock lock(buffer_mutex_); @@ -205,7 +204,7 @@ struct newtek_ndi_consumer : public core::frame_consumer time_point += std::chrono::microseconds(frametimeUs); } } catch (boost::thread_interrupted) { - //NOTHING + // NOTHING } }); } @@ -215,11 +214,11 @@ struct newtek_ndi_consumer : public core::frame_consumer return executor_.begin_invoke([=] { graph_->set_value("tick-time", tick_timer_.elapsed() * format_desc_.fps * 0.5); tick_timer_.restart(); - { - std::unique_lock lock(buffer_mutex_); - buffer_.push(std::move(frame)); - } - worker_cond_.notify_all(); + { + std::unique_lock lock(buffer_mutex_); + buffer_.push(std::move(frame)); + } + worker_cond_.notify_all(); return true; }); } diff --git a/src/modules/newtek/producer/newtek_ndi_producer.cpp b/src/modules/newtek/producer/newtek_ndi_producer.cpp index b21ec27b04..7708d753cb 100644 --- a/src/modules/newtek/producer/newtek_ndi_producer.cpp +++ b/src/modules/newtek/producer/newtek_ndi_producer.cpp @@ -151,13 +151,12 @@ struct newtek_ndi_producer : public core::frame_producer frame_timer_.restart(); NDIlib_video_frame_v2_t video_frame; NDIlib_audio_frame_v2_t audio_frame; - ndi_lib_->framesync_capture_video( - ndi_framesync_, &video_frame, NDIlib_frame_format_type_progressive); + ndi_lib_->framesync_capture_video(ndi_framesync_, &video_frame, NDIlib_frame_format_type_progressive); ndi_lib_->framesync_capture_audio(ndi_framesync_, - &audio_frame, - format_desc_.audio_sample_rate, - format_desc_.audio_channels, - format_desc_.audio_cadence[++cadence_counter_ %= cadence_length_]); + &audio_frame, + format_desc_.audio_sample_rate, + format_desc_.audio_channels, + format_desc_.audio_cadence[++cadence_counter_ %= cadence_length_]); CASPAR_SCOPE_EXIT { diff --git a/src/modules/screen/consumer/screen_consumer.cpp b/src/modules/screen/consumer/screen_consumer.cpp index e4fa411e4e..0a54338138 100644 --- a/src/modules/screen/consumer/screen_consumer.cpp +++ b/src/modules/screen/consumer/screen_consumer.cpp @@ -228,10 +228,10 @@ struct screen_consumer thread_ = std::thread([this] { try { - const auto window_style = config_.borderless ? sf::Style::None - : config_.windowed ? sf::Style::Resize | sf::Style::Close - : sf::Style::Fullscreen; - sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); + const auto window_style = config_.borderless ? sf::Style::None + : config_.windowed ? sf::Style::Resize | sf::Style::Close + : sf::Style::Fullscreen; + sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); sf::VideoMode mode( config_.sbs_key ? screen_width_ * 2 : screen_width_, screen_height_, desktop.bitsPerPixel); window_.create(mode, diff --git a/src/protocol/amcp/AMCPCommand.h b/src/protocol/amcp/AMCPCommand.h index 3e5ea7e793..16a843eadd 100644 --- a/src/protocol/amcp/AMCPCommand.h +++ b/src/protocol/amcp/AMCPCommand.h @@ -89,11 +89,11 @@ class AMCPCommand const std::wstring request_id_; public: - AMCPCommand(const command_context& ctx, + AMCPCommand(const command_context& ctx, const amcp_command_func& command, int min_num_params, const std::wstring& name, - const std::wstring& request_id) + const std::wstring& request_id) : ctx_(ctx) , command_(command) , min_num_params_(min_num_params) @@ -104,10 +104,7 @@ class AMCPCommand using ptr_type = std::shared_ptr; - const std::wstring Execute() - { - return command_(ctx_); - } + const std::wstring Execute() { return command_(ctx_); } int minimum_parameters() const { return min_num_params_; } diff --git a/src/protocol/amcp/AMCPProtocolStrategy.cpp b/src/protocol/amcp/AMCPProtocolStrategy.cpp index e1bd5bfaec..97efb48170 100644 --- a/src/protocol/amcp/AMCPProtocolStrategy.cpp +++ b/src/protocol/amcp/AMCPProtocolStrategy.cpp @@ -119,8 +119,8 @@ struct AMCPProtocolStrategy::impl std::wstring request_id; std::wstring command_name; - error_state err = parse_command_string(client, tokens, request_id, command_name); - if (err!= error_state::no_error) { + error_state err = parse_command_string(client, tokens, request_id, command_name); + if (err != error_state::no_error) { std::wstringstream answer; if (!request_id.empty()) @@ -143,19 +143,18 @@ struct AMCPProtocolStrategy::impl answer << L"500 FAILED\r\n"; break; default: - CASPAR_THROW_EXCEPTION(programming_error() - << msg_info(L"Unhandled error_state enum constant " + - std::to_wstring(static_cast(err)))); + CASPAR_THROW_EXCEPTION(programming_error() << msg_info(L"Unhandled error_state enum constant " + + std::to_wstring(static_cast(err)))); } client->send(answer.str()); } } private: - error_state parse_command_string(ClientInfoPtr client, - std::list tokens, - std::wstring& request_id, - std::wstring& command_name) + error_state parse_command_string(ClientInfoPtr client, + std::list tokens, + std::wstring& request_id, + std::wstring& command_name) { try { // Discard GetSwitch diff --git a/src/protocol/amcp/amcp_command_repository.cpp b/src/protocol/amcp/amcp_command_repository.cpp index f6f887ce5a..115e069ea6 100644 --- a/src/protocol/amcp/amcp_command_repository.cpp +++ b/src/protocol/amcp/amcp_command_repository.cpp @@ -44,8 +44,8 @@ AMCPCommand::ptr_type find_command(const std::map& tokens, std::wstring& channel_spec, in } } - struct amcp_command_repository::impl { std::vector channels; @@ -137,11 +136,10 @@ struct amcp_command_repository::impl } } - AMCPCommand::ptr_type create_command(const std::wstring& name, const std::wstring& request_id, - IO::ClientInfoPtr client, - std::list& tokens) const + IO::ClientInfoPtr client, + std::list& tokens) const { command_context ctx(std::move(client), channel_context(), @@ -160,11 +158,11 @@ struct amcp_command_repository::impl } AMCPCommand::ptr_type create_channel_command(const std::wstring& name, - const std::wstring& request_id, - IO::ClientInfoPtr client, - unsigned int channel_index, - int layer_index, - std::list& tokens) const + const std::wstring& request_id, + IO::ClientInfoPtr client, + unsigned int channel_index, + int layer_index, + std::list& tokens) const { auto channel = channels.at(channel_index); diff --git a/src/protocol/amcp/amcp_command_repository.h b/src/protocol/amcp/amcp_command_repository.h index a7e00c1e43..0326614a62 100644 --- a/src/protocol/amcp/amcp_command_repository.h +++ b/src/protocol/amcp/amcp_command_repository.h @@ -55,8 +55,8 @@ class amcp_command_repository std::list& tokens) const; std::shared_ptr - parse_command(IO::ClientInfoPtr client, std::list tokens, const std::wstring& request_id) const; - bool check_channel_lock(IO::ClientInfoPtr client, int channel_index) const; + parse_command(IO::ClientInfoPtr client, std::list tokens, const std::wstring& request_id) const; + bool check_channel_lock(IO::ClientInfoPtr client, int channel_index) const; const std::vector& channels() const; diff --git a/src/protocol/util/tokenize.h b/src/protocol/util/tokenize.h index c28e1c4831..203718d0ac 100644 --- a/src/protocol/util/tokenize.h +++ b/src/protocol/util/tokenize.h @@ -19,8 +19,8 @@ #pragma once -#include #include +#include namespace caspar { namespace IO { diff --git a/src/shell/main.cpp b/src/shell/main.cpp index 6452dfbbe3..d7f923db79 100644 --- a/src/shell/main.cpp +++ b/src/shell/main.cpp @@ -155,8 +155,7 @@ auto run(const std::wstring& config_file_name, std::atomic& should_wait_fo amcp->parse(wcmd); } } - }) - .detach(); + }).detach(); future.wait(); caspar_server.reset(); @@ -217,7 +216,7 @@ int main(int argc, char** argv) // Increase process priority. increase_process_priority(); - std::wstring config_file_name(L"casparcg.config"); + std::wstring config_file_name(L"casparcg.config"); try { // Configure environment properties from configuration. diff --git a/src/shell/server.cpp b/src/shell/server.cpp index ff32515670..f13eacbab7 100644 --- a/src/shell/server.cpp +++ b/src/shell/server.cpp @@ -308,7 +308,6 @@ struct server::impl void setup_controllers(const boost::property_tree::wptree& pt) { - using boost::property_tree::wptree; for (auto& xml_controller : pt | witerate_children(L"configuration.controllers") | welement_context_iteration) { auto name = xml_controller.first; diff --git a/tools/update-format.sh b/tools/update-format.sh index 72d535267c..08c4b4a625 100755 --- a/tools/update-format.sh +++ b/tools/update-format.sh @@ -7,7 +7,7 @@ SOURCE_FILES=`find ./src/ \( -name \*.cpp -type f -or -name \*.h -type f \) -not BAD_FILES=0 for SOURCE_FILE in $SOURCE_FILES do - export FORMATTING_ISSUE_COUNT=`clang-format-6.0 $CLANG_ARGS $SOURCE_FILE | grep offset | wc -l` + export FORMATTING_ISSUE_COUNT=`clang-format $CLANG_ARGS $SOURCE_FILE | grep offset | wc -l` if [ "$FORMATTING_ISSUE_COUNT" -gt "0" ]; then echo "Source file $SOURCE_FILE contains formatting issues." BAD_FILES=1