summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-11-07 00:09:51 +0000
committerCarl Hetherington <cth@carlh.net>2018-11-07 00:09:51 +0000
commitf1f1a0dab1329e75a9718a417d640966763b9e7d (patch)
tree56987d7dd425241fe9abde0bb843f07b30c28339
parent70a87e2b99184230c2329582dc70d2fa93ebe4f5 (diff)
Fix crash when using playback logging.
-rw-r--r--src/tools/dcpomatic_player.cc51
1 files changed, 34 insertions, 17 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 8096e1bb4..db9463fe2 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -48,6 +48,7 @@
#include "lib/dcpomatic_socket.h"
#include "lib/scoped_temporary.h"
#include "lib/monitor_checker.h"
+#include "lib/ffmpeg_content.h"
#include <dcp/dcp.h>
#include <dcp/raw_convert.h>
#include <dcp/exceptions.h>
@@ -299,26 +300,42 @@ public:
return;
}
- shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front());
- DCPOMATIC_ASSERT (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;
+ 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()
+ );
}
- DCPOMATIC_ASSERT (playing_cpl)
- FILE* f = fopen_boost(*log, "a");
- 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()
- );
fclose (f);
}