summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-28 20:20:13 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-30 12:22:30 +0100
commit973f21989ce80584840c390bdf5f9e0c67301e98 (patch)
tree68d0c08ccaab58c68563712ad9b3908b2d302c75 /src/lib
parent0beaf6245ef0c1462cbe7eaf6faeabb651b68de3 (diff)
Cope with DCPs that have no video and hence no video encoding.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_content.cc4
-rw-r--r--src/lib/dcp_content.h4
-rw-r--r--src/lib/dcp_examiner.cc13
-rw-r--r--src/lib/dcp_examiner.h4
4 files changed, 17 insertions, 8 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index c75babfc6..d26b726c2 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -428,7 +428,9 @@ DCPContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_
DCPOMATIC_ASSERT(false);
}
}
- cxml::add_text_child(element, "VideoEncoding", video_encoding_to_string(_video_encoding));
+ if (_video_encoding) {
+ cxml::add_text_child(element, "VideoEncoding", video_encoding_to_string(*_video_encoding));
+ }
cxml::add_text_child(element, "ThreeD", _three_d ? "1" : "0");
if (_content_kind) {
cxml::add_text_child(element, "ContentKind", _content_kind->name());
diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h
index 97e4b3cc4..80b7f64a8 100644
--- a/src/lib/dcp_content.h
+++ b/src/lib/dcp_content.h
@@ -191,7 +191,7 @@ public:
return _standard.get();
}
- VideoEncoding video_encoding() const {
+ boost::optional<VideoEncoding> video_encoding() const {
boost::mutex::scoped_lock lm(_mutex);
return _video_encoding;
}
@@ -258,7 +258,7 @@ private:
EnumIndexedVector<bool, TextType> _reference_text;
boost::optional<dcp::Standard> _standard;
- VideoEncoding _video_encoding = VideoEncoding::JPEG2000;
+ boost::optional<VideoEncoding> _video_encoding;
boost::optional<dcp::ContentKind> _content_kind;
bool _three_d;
/** ID of the CPL to use; older metadata might not specify this: in that case
diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc
index 6a1321878..4e8f611de 100644
--- a/src/lib/dcp_examiner.cc
+++ b/src/lib/dcp_examiner.cc
@@ -341,9 +341,16 @@ DCPExaminer::DCPExaminer(shared_ptr<const DCPContent> content, bool tolerant)
* asset in each reel. This checks that when we do have a key it's the right one.
*/
_kdm_valid = selected_cpl->can_be_read();
- auto encoding = selected_cpl->picture_encoding();
- DCPOMATIC_ASSERT(encoding == dcp::PictureEncoding::JPEG2000 || encoding == dcp::PictureEncoding::MPEG2);
- _video_encoding = encoding == dcp::PictureEncoding::MPEG2 ? VideoEncoding::MPEG2 : VideoEncoding::JPEG2000;
+ switch (selected_cpl->picture_encoding()) {
+ case dcp::PictureEncoding::JPEG2000:
+ _video_encoding = VideoEncoding::JPEG2000;
+ break;
+ case dcp::PictureEncoding::MPEG2:
+ _video_encoding = VideoEncoding::MPEG2;
+ break;
+ default:
+ break;
+ }
_standard = selected_cpl->standard();
if (!selected_cpl->reels().empty()) {
auto first_reel = selected_cpl->reels()[0];
diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h
index 6bc9793aa..8dd865762 100644
--- a/src/lib/dcp_examiner.h
+++ b/src/lib/dcp_examiner.h
@@ -150,7 +150,7 @@ public:
return _standard;
}
- VideoEncoding video_encoding() const {
+ boost::optional<VideoEncoding> video_encoding() const {
return _video_encoding;
}
@@ -230,7 +230,7 @@ private:
bool _needs_assets = false;
bool _kdm_valid = false;
boost::optional<dcp::Standard> _standard;
- VideoEncoding _video_encoding = VideoEncoding::JPEG2000;
+ boost::optional<VideoEncoding> _video_encoding;
bool _three_d = false;
boost::optional<dcp::ContentKind> _content_kind;
std::string _cpl;