- void playback_started (DCPTime time)
- {
- optional<boost::filesystem::path> log = Config::instance()->player_log_file();
- if (!log) {
- return;
- }
-
- FILE* f = fopen_boost(*log, "a");
-
- /* XXX: this only logs the first piece of content; probably should be each piece? */
-
- shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(_film->content().front());
- if (dcp) {
- DCPExaminer ex (dcp);
- shared_ptr<dcp::CPL> playing_cpl;
- BOOST_FOREACH (shared_ptr<dcp::CPL> i, ex.cpls()) {
- if (!dcp->cpl() || i->id() == *dcp->cpl()) {
- playing_cpl = i;
- }
- }
- DCPOMATIC_ASSERT (playing_cpl);
-
- fprintf (
- f,
- "%s playback-started %s %s %s\n",
- dcp::LocalTime().as_string().c_str(),
- time.timecode(_film->video_frame_rate()).c_str(),
- dcp->directories().front().string().c_str(),
- playing_cpl->annotation_text().c_str()
- );
- }
-
- shared_ptr<FFmpegContent> ffmpeg = dynamic_pointer_cast<FFmpegContent>(_film->content().front());
- if (ffmpeg) {
- fprintf (
- f,
- "%s playback-started %s %s\n",
- dcp::LocalTime().as_string().c_str(),
- time.timecode(_film->video_frame_rate()).c_str(),
- ffmpeg->path(0).string().c_str()
- );
- }
-
- fclose (f);
- }
-
- void playback_seeked (DCPTime time)
- {
- optional<boost::filesystem::path> log = Config::instance()->player_log_file();
- if (!log) {
- return;
- }
-
- FILE* f = fopen_boost(*log, "a");
- fprintf (f, "%s playback-seeked %s\n", dcp::LocalTime().as_string().c_str(), time.timecode(_film->video_frame_rate()).c_str());
- fclose (f);
- }