Exemple #1
0
	safe_ptr<basic_frame> receive(int hints)
	{		
		try
		{
			if(is_paused_)
				return disable_audio(foreground_->last_frame());
		
			auto frame = receive_and_follow(foreground_, hints);
			if(frame == core::basic_frame::late())
				return foreground_->last_frame();

			auto frames_left = static_cast<int64_t>(foreground_->nb_frames()) - static_cast<int64_t>(++frame_number_) - static_cast<int64_t>(auto_play_delta_);
			if(auto_play_delta_ > -1 && frames_left < 1)
			{
				play();
				return receive(hints);
			}
				
			return frame;
		}
		catch(...)
		{
			CASPAR_LOG_CURRENT_EXCEPTION();
			stop();
			return core::basic_frame::empty();
		}
	}
Exemple #2
0
	safe_ptr<basic_frame> receive()
	{		
		try
		{
			if(is_paused_)
				return disable_audio(foreground_->last_frame());
		
			auto frame = receive_and_follow(foreground_, frame_producer::NO_HINT);
			if(frame == core::basic_frame::late())
				return foreground_->last_frame();

			auto frames_left = foreground_->nb_frames() - (++frame_number_) - auto_play_delta_;
			if(auto_play_delta_ > -1 && frames_left < 1)
			{
				play();
				return receive();
			}
				
			return frame;
		}
		catch(...)
		{
			CASPAR_LOG_CURRENT_EXCEPTION();
			stop();
			return core::basic_frame::empty();
		}
	}
Exemple #3
0
	safe_ptr<basic_frame> receive(int hints)
	{		
		try
		{
			monitor_subject_ << monitor::message("/paused") % is_paused_;

			if(is_paused_)
			{
				if(foreground_->last_frame() == basic_frame::empty())
					foreground_->receive(frame_producer::NO_HINT);

				return disable_audio(foreground_->last_frame());
			}

			auto foreground = foreground_;

			auto frame = receive_and_follow(foreground, hints);

			if(foreground != foreground_)
				set_foreground(foreground);

			if(frame == core::basic_frame::late())
				return foreground_->last_frame();

			auto frames_left = static_cast<int64_t>(foreground_->nb_frames()) - static_cast<int64_t>(++frame_number_) - static_cast<int64_t>(auto_play_delta_);
			if(auto_play_delta_ > -1 && frames_left < 1)
			{
				play();
				return receive(hints);
			}
				
			return frame;
		}
		catch(...)
		{
			CASPAR_LOG_CURRENT_EXCEPTION();
			stop();
			return core::basic_frame::empty();
		}
	}
	virtual safe_ptr<basic_frame> receive(int hints) override
	{
		if(++current_frame_ >= info_.duration)
			return basic_frame::eof();
		
		auto dest = basic_frame::empty();
		auto source = basic_frame::empty();

		tbb::parallel_invoke(
		[&]
		{
			dest = receive_and_follow(dest_producer_, hints);
			if(dest == core::basic_frame::late())
				dest = dest_producer_->last_frame();
		},
		[&]
		{
			source = receive_and_follow(source_producer_, hints);
			if(source == core::basic_frame::late())
				source = source_producer_->last_frame();
		});

		monitor_subject_ << monitor::message("/transition/frame") % static_cast<std::int32_t>(current_frame_) % static_cast<std::int32_t>(info_.duration)
						 << monitor::message("/transition/type") % [&]() -> std::string
																{
																	switch(info_.type)
																	{
																	case transition::mix:	return "mix";
																	case transition::wipe:	return "wipe";
																	case transition::slide:	return "slide";
																	case transition::push:	return "push";
																	case transition::cut:	return "cut";
																	default:				return "n/a";
																	}
																}();

		return compose(dest, source);
	}
Exemple #5
0
	virtual safe_ptr<basic_frame> receive(int hints)
	{
		if(++current_frame_ >= info_.duration)
			return basic_frame::eof();
		
		auto dest = basic_frame::empty();
		auto source = basic_frame::empty();

		tbb::parallel_invoke(
		[&]
		{
			dest = receive_and_follow(dest_producer_, hints);
			if(dest == core::basic_frame::late())
				dest = dest_producer_->last_frame();
		},
		[&]
		{
			source = receive_and_follow(source_producer_, hints);
			if(source == core::basic_frame::late())
				source = source_producer_->last_frame();
		});

		return compose(dest, source);
	}
	last_frame_producer(const safe_ptr<frame_producer>& producer) 
		: print_(producer->print())
		, frame_(producer->last_frame() != basic_frame::eof() ? producer->last_frame() : basic_frame::empty())
		, nb_frames_(producer->nb_frames())
	{
	}