\r
namespace caspar { namespace ffmpeg {\r
\r
+std::wstring get_relative_or_original(\r
+ const std::wstring& filename,\r
+ const boost::filesystem::wpath& relative_to)\r
+{\r
+ boost::filesystem::wpath file(filename);\r
+ auto result = file.filename();\r
+\r
+ boost::filesystem::wpath current_path = file;\r
+\r
+ while (true)\r
+ {\r
+ current_path = current_path.parent_path();\r
+\r
+ if (boost::filesystem::equivalent(current_path, relative_to))\r
+ break;\r
+\r
+ if (current_path.empty())\r
+ return filename;\r
+\r
+ result = current_path.filename() + L"/" + result;\r
+ }\r
+\r
+ return result;\r
+}\r
\r
struct ffmpeg_producer : public core::frame_producer\r
{\r
core::monitor::subject monitor_subject_;\r
const std::wstring filename_;\r
+ const std::wstring path_relative_to_media_;\r
\r
FFMPEG_Resource resource_type_;\r
\r
public:\r
explicit ffmpeg_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, FFMPEG_Resource resource_type, const std::wstring& filter, bool loop, uint32_t start, uint32_t length, bool thumbnail_mode, const std::wstring& custom_channel_order, const ffmpeg_params& vid_params)\r
: filename_(filename)\r
+ , path_relative_to_media_(get_relative_or_original(filename, env::media_folder()))\r
, resource_type_(resource_type)\r
, frame_factory_(frame_factory) \r
, format_desc_(frame_factory->get_video_format_desc())\r
<< core::monitor::message("/file/frame") % static_cast<int32_t>(file_frame_number())\r
% static_cast<int32_t>(file_nb_frames())\r
<< core::monitor::message("/file/fps") % fps_\r
- << core::monitor::message("/file/path") % filename_\r
+ << core::monitor::message("/file/path") % path_relative_to_media_\r
<< core::monitor::message("/loop") % input_.loop();\r
}\r
\r