read_directory (p);
set_default_colour_conversion ();
-
- for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
- _reference_text[i] = false;
- }
}
DCPContent::DCPContent (cxml::ConstNodePtr node, int version)
text = TextContent::from_xml (this, node, version, notes);
atmos = AtmosContent::from_xml (this, node);
- for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
- _reference_text[i] = false;
- }
-
if (video && audio) {
audio->set_stream (
make_shared<AudioStream> (
_reference_video = node->optional_bool_child ("ReferenceVideo").get_value_or (false);
_reference_audio = node->optional_bool_child ("ReferenceAudio").get_value_or (false);
if (version >= 37) {
- _reference_text[static_cast<int>(TextType::OPEN_SUBTITLE)] = node->optional_bool_child("ReferenceOpenSubtitle").get_value_or(false);
- _reference_text[static_cast<int>(TextType::CLOSED_CAPTION)] = node->optional_bool_child("ReferenceClosedCaption").get_value_or(false);
+ _reference_text[TextType::OPEN_SUBTITLE] = node->optional_bool_child("ReferenceOpenSubtitle").get_value_or(false);
+ _reference_text[TextType::CLOSED_CAPTION] = node->optional_bool_child("ReferenceClosedCaption").get_value_or(false);
} else {
- _reference_text[static_cast<int>(TextType::OPEN_SUBTITLE)] = node->optional_bool_child("ReferenceSubtitle").get_value_or(false);
- _reference_text[static_cast<int>(TextType::CLOSED_CAPTION)] = false;
+ _reference_text[TextType::OPEN_SUBTITLE] = node->optional_bool_child("ReferenceSubtitle").get_value_or(false);
+ _reference_text[TextType::CLOSED_CAPTION] = false;
}
if (node->optional_string_child("Standard")) {
auto const s = node->optional_string_child("Standard").get();
node->add_child("KDMValid")->add_child_text (_kdm_valid ? "1" : "0");
node->add_child("ReferenceVideo")->add_child_text (_reference_video ? "1" : "0");
node->add_child("ReferenceAudio")->add_child_text (_reference_audio ? "1" : "0");
- node->add_child("ReferenceOpenSubtitle")->add_child_text(_reference_text[static_cast<int>(TextType::OPEN_SUBTITLE)] ? "1" : "0");
- node->add_child("ReferenceClosedCaption")->add_child_text(_reference_text[static_cast<int>(TextType::CLOSED_CAPTION)] ? "1" : "0");
+ node->add_child("ReferenceOpenSubtitle")->add_child_text(_reference_text[TextType::OPEN_SUBTITLE] ? "1" : "0");
+ node->add_child("ReferenceClosedCaption")->add_child_text(_reference_text[TextType::CLOSED_CAPTION] ? "1" : "0");
if (_standard) {
switch (_standard.get ()) {
case dcp::Standard::INTEROP:
}
s += string (_reference_video ? "1" : "0");
- for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
- s += string (_reference_text[i] ? "1" : "0");
+ for (auto text: _reference_text) {
+ s += string(text ? "1" : "0");
}
return s;
}
{
boost::mutex::scoped_lock lm (_mutex);
- _reference_text[static_cast<int>(type)] = r;
+ _reference_text[type] = r;
}
}
_reference_video = dc->_reference_video;
_reference_audio = dc->_reference_audio;
- for (int i = 0; i < static_cast<int>(TextType::COUNT); ++i) {
- _reference_text[i] = dc->_reference_text[i];
- }
+ _reference_text = dc->_reference_text;
}
void
#include "content.h"
+#include "enum_indexed_vector.h"
#include "font.h"
#include <libcxml/cxml.h>
#include <dcp/content_kind.h>
*/
bool reference_text (TextType type) const {
boost::mutex::scoped_lock lm (_mutex);
- return _reference_text[static_cast<int>(type)];
+ return _reference_text[type];
}
bool can_reference_text (std::shared_ptr<const Film> film, TextType type, std::string &) const;
* rather than by rewrapping. The types here are the original text types,
* not what they are being used for.
*/
- bool _reference_text[static_cast<int>(TextType::COUNT)];
+ EnumIndexedVector<bool, TextType> _reference_text;
boost::optional<dcp::Standard> _standard;
boost::optional<dcp::ContentKind> _content_kind;