From: ronag Date: Thu, 2 Feb 2012 23:45:07 +0000 (+0000) Subject: git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches... X-Git-Tag: 2.1.0_Beta1~967 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=760d0bce0cbbaf2215030bf97cdf974ea02910ae;p=casparcg git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2196 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- diff --git a/common/enum_class.h b/common/enum_class.h index 2f16f2648..933f7cba1 100644 --- a/common/enum_class.h +++ b/common/enum_class.h @@ -24,10 +24,22 @@ public: return enum_class(static_cast(val_ & s.val_)); } + enum_class& operator&=(const enum_class& s) + { + val_ = static_cast(val_ & s.val_); + return *this; + } + enum_class operator|(const enum_class& s) const { return enum_class(static_cast(val_ | s.val_)); } + + enum_class& operator|=(const enum_class& s) + { + val_ = static_cast(val_ | s.val_); + return *this; + } //operator inner() //{ diff --git a/core/producer/layer.cpp b/core/producer/layer.cpp index 9f50928fa..0a53d39ee 100644 --- a/core/producer/layer.cpp +++ b/core/producer/layer.cpp @@ -60,20 +60,13 @@ public: is_paused_ = false; } - void load(const safe_ptr& producer, bool preview, const boost::optional& auto_play_delta) + void load(const safe_ptr& producer, const boost::optional& auto_play_delta) { background_ = producer; auto_play_delta_ = auto_play_delta; if(auto_play_delta_ && foreground_ == frame_producer::empty()) play(); - - if(preview) // Play the first frame and pause. - { - play(); - receive(frame_producer::flags::none); - pause(); - } } void play() @@ -101,14 +94,14 @@ public: is_paused_ = true; } - safe_ptr receive(int flags) + safe_ptr receive(frame_producer::flags flags) { try { if(is_paused_) return draw_frame::silence(foreground_->last_frame()); - auto frame = receive_and_follow(foreground_, flags); + auto frame = receive_and_follow(foreground_, flags.value()); if(frame == core::draw_frame::late()) return draw_frame::silence(foreground_->last_frame()); @@ -155,30 +148,24 @@ public: }; layer::layer() : impl_(new impl()){} -layer::layer(layer&& other) : impl_(std::move(other.impl_)){} -layer& layer::operator=(layer&& other) -{ - impl_ = std::move(other.impl_); - return *this; -} layer::layer(const layer& other) : impl_(new impl(*other.impl_)){} -layer& layer::operator=(const layer& other) +layer::layer(layer&& other) : impl_(std::move(other.impl_)){} +layer& layer::operator=(layer other) { - layer temp(other); - temp.swap(*this); + other.swap(*this); return *this; } void layer::swap(layer& other) { impl_.swap(other.impl_); } -void layer::load(const safe_ptr& frame_producer, bool preview, const boost::optional& auto_play_delta){return impl_->load(frame_producer, preview, auto_play_delta);} +void layer::load(const safe_ptr& frame_producer, const boost::optional& auto_play_delta){return impl_->load(frame_producer, auto_play_delta);} void layer::play(){impl_->play();} void layer::pause(){impl_->pause();} void layer::stop(){impl_->stop();} bool layer::is_paused() const{return impl_->is_paused_;} int64_t layer::frame_number() const{return impl_->frame_number_;} -safe_ptr layer::receive(int flags) {return impl_->receive(flags);} +safe_ptr layer::receive(frame_producer::flags flags) {return impl_->receive(flags);} safe_ptr layer::foreground() const { return impl_->foreground_;} safe_ptr layer::background() const { return impl_->background_;} bool layer::empty() const {return impl_->empty();} diff --git a/core/producer/layer.h b/core/producer/layer.h index e254c63c8..cef2bc272 100644 --- a/core/producer/layer.h +++ b/core/producer/layer.h @@ -21,6 +21,8 @@ #pragma once +#include "frame_producer.h" + #include #include @@ -37,14 +39,13 @@ class layer sealed { public: layer(); // nothrow - layer(layer&& other); // nothrow - layer& operator=(layer&& other); // nothrow layer(const layer&); - layer& operator=(const layer&); + layer(layer&& other); // nothrow + layer& operator=(layer other); // nothrow void swap(layer& other); // nothrow - void load(const safe_ptr& producer, bool preview, const boost::optional& auto_play_delta = nullptr); // nothrow + void load(const safe_ptr& producer, const boost::optional& auto_play_delta = nullptr); // nothrow void play(); // nothrow void pause(); // nothrow void stop(); // nothrow @@ -58,7 +59,7 @@ public: safe_ptr foreground() const; // nothrow safe_ptr background() const; // nothrow - safe_ptr receive(int flags); // nothrow + safe_ptr receive(frame_producer::flags flags); // nothrow boost::property_tree::wptree info() const; private: diff --git a/core/producer/stage.cpp b/core/producer/stage.cpp index 0667a4481..40298d5cf 100644 --- a/core/producer/stage.cpp +++ b/core/producer/stage.cpp @@ -72,7 +72,7 @@ public: { auto transform = transforms_[layer.first].fetch_and_tick(1); - int flags = frame_producer::flags::none; + frame_producer::flags flags = frame_producer::flags::none; if(format_desc2.field_mode != field_mode::progressive) { flags |= std::abs(transform.fill_scale[1] - 1.0) > 0.0001 ? frame_producer::flags::deinterlace : frame_producer::flags::none; @@ -146,11 +146,11 @@ public: }, high_priority); } - void load(int index, const safe_ptr& producer, bool preview, int auto_play_delta) + void load(int index, const safe_ptr& producer, int auto_play_delta) { executor_.begin_invoke([=] { - layers_[index].load(producer, preview, auto_play_delta); + layers_[index].load(producer, auto_play_delta); }, high_priority); } @@ -252,22 +252,22 @@ public: boost::unique_future info() { - return std::move(executor_.begin_invoke([this]() -> boost::property_tree::wptree + return executor_.begin_invoke([this]() -> boost::property_tree::wptree { boost::property_tree::wptree info; BOOST_FOREACH(auto& layer, layers_) info.add_child(L"layers.layer", layer.second.info()) .add(L"index", layer.first); return info; - }, high_priority)); + }, high_priority); } boost::unique_future info(int index) { - return std::move(executor_.begin_invoke([=]() -> boost::property_tree::wptree + return executor_.begin_invoke([=]() -> boost::property_tree::wptree { return layers_[index].info(); - }, high_priority)); + }, high_priority); } }; @@ -276,7 +276,7 @@ void stage::apply_transforms(const std::vector& transf void stage::apply_transform(int index, const std::function& transform, unsigned int mix_duration, const tweener& tween){impl_->apply_transform(index, transform, mix_duration, tween);} void stage::clear_transforms(int index){impl_->clear_transforms(index);} void stage::clear_transforms(){impl_->clear_transforms();} -void stage::load(int index, const safe_ptr& producer, bool preview, int auto_play_delta){impl_->load(index, producer, preview, auto_play_delta);} +void stage::load(int index, const safe_ptr& producer, int auto_play_delta){impl_->load(index, producer, auto_play_delta);} void stage::pause(int index){impl_->pause(index);} void stage::play(int index){impl_->play(index);} void stage::stop(int index){impl_->stop(index);} diff --git a/core/producer/stage.h b/core/producer/stage.h index c3e59da1f..bd8b67e53 100644 --- a/core/producer/stage.h +++ b/core/producer/stage.h @@ -55,7 +55,7 @@ public: void clear_transforms(int index); void clear_transforms(); - void load(int index, const safe_ptr& producer, bool preview = false, int auto_play_delta = -1); + void load(int index, const safe_ptr& producer, int auto_play_delta = -1); void pause(int index); void play(int index); void stop(int index); diff --git a/protocol/amcp/AMCPCommandsImpl.cpp b/protocol/amcp/AMCPCommandsImpl.cpp index 47753a720..d4cede6e0 100644 --- a/protocol/amcp/AMCPCommandsImpl.cpp +++ b/protocol/amcp/AMCPCommandsImpl.cpp @@ -749,7 +749,7 @@ bool LoadbgCommand::DoExecute() bool auto_play = std::find(_parameters.begin(), _parameters.end(), L"AUTO") != _parameters.end(); auto pFP2 = create_transition_producer(GetChannel()->get_video_format_desc().field_mode, pFP, transitionInfo); - GetChannel()->stage()->load(GetLayerIndex(), pFP2, false, auto_play ? transitionInfo.duration : -1); // TODO: LOOP + GetChannel()->stage()->load(GetLayerIndex(), pFP2, auto_play ? transitionInfo.duration : -1); // TODO: LOOP SetReplyString(TEXT("202 LOADBG OK\r\n"));