struct not_supported : virtual caspar_exception {};
struct not_implemented : virtual caspar_exception {};
+struct user_error : virtual caspar_exception {};
+
#define CASPAR_THROW_EXCEPTION(e) BOOST_THROW_EXCEPTION(e << call_stack_info(caspar::get_call_stack()))
}
namespace caspar { namespace ffmpeg {
+struct seek_out_of_range : virtual user_error {};
+
std::wstring get_relative_or_original(
const std::wstring& filename,
const boost::filesystem::path& relative_to)
CASPAR_LOG(warning) << print() << " Failed to open audio-stream. Running without audio.";
}
+ if (start_ > file_nb_frames())
+ CASPAR_THROW_EXCEPTION(seek_out_of_range() << msg_info("SEEK out of range"));
+
muxer_.reset(new frame_muxer(fps_, frame_factory, format_desc_, channel_layout, filter));
decode_next_frame();
void seek(uint32_t target)
{
- seek_target_ = std::min(target, file_nb_frames());
+ if (target > file_nb_frames())
+ CASPAR_THROW_EXCEPTION(seek_out_of_range() << msg_info("SEEK out of range"));
+
+ seek_target_ = target;
input_.seek(*seek_target_);
muxer_->clear();
CASPAR_LOG(error) << L"File not found. No match found for parameters. Check syntax.";
pCurrentCommand->SetReplyString(L"404 " + pCurrentCommand->print() + L" FAILED\r\n");
}
+ catch (const user_error& e)
+ {
+ CASPAR_LOG(error) << *boost::get_error_info<msg_info_t>(e) << ". Check syntax.";
+ pCurrentCommand->SetReplyString(L"403 " + pCurrentCommand->print() + L" FAILED\r\n");
+ }
catch (std::out_of_range&)
{
CASPAR_LOG(error) << L"Missing parameter. Check syntax.";