summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-22 00:41:03 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-22 00:41:03 +0100
commitdea824f6ff41384a5e17e23de5434cf84eccff29 (patch)
treea40207882d506417cb5f456135b9ba4394535d00 /src/lib
parent9cbe57dda759fccfa9dec8a0820114d7d8583a36 (diff)
Display only required tabs, including subs / ccap.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/caption_content.cc4
-rw-r--r--src/lib/caption_content.h2
-rw-r--r--src/lib/dcp_content.cc6
-rw-r--r--src/lib/dcp_examiner.cc9
-rw-r--r--src/lib/dcp_examiner.h10
-rw-r--r--src/lib/dcp_subtitle_content.cc2
-rw-r--r--src/lib/ffmpeg_content.cc2
-rw-r--r--src/lib/text_caption_file_content.cc2
-rw-r--r--src/lib/types.cc17
-rw-r--r--src/lib/types.h1
10 files changed, 38 insertions, 17 deletions
diff --git a/src/lib/caption_content.cc b/src/lib/caption_content.cc
index 4fa8b678f..37a3e7c70 100644
--- a/src/lib/caption_content.cc
+++ b/src/lib/caption_content.cc
@@ -57,7 +57,7 @@ int const CaptionContentProperty::FADE_OUT = 513;
int const CaptionContentProperty::OUTLINE_WIDTH = 514;
int const CaptionContentProperty::TYPE = 515;
-CaptionContent::CaptionContent (Content* parent)
+CaptionContent::CaptionContent (Content* parent, CaptionType original_type)
: ContentPart (parent)
, _use (false)
, _burn (false)
@@ -68,7 +68,7 @@ CaptionContent::CaptionContent (Content* parent)
, _line_spacing (1)
, _outline_width (2)
, _type (CAPTION_OPEN)
- , _original_type (CAPTION_OPEN)
+ , _original_type (original_type)
{
}
diff --git a/src/lib/caption_content.h b/src/lib/caption_content.h
index 767fc7234..4f5780d23 100644
--- a/src/lib/caption_content.h
+++ b/src/lib/caption_content.h
@@ -58,7 +58,7 @@ public:
class CaptionContent : public ContentPart
{
public:
- explicit CaptionContent (Content* parent);
+ CaptionContent (Content* parent, CaptionType original_type);
CaptionContent (Content* parent, std::vector<boost::shared_ptr<Content> >);
void as_xml (xmlpp::Node *) const;
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index e56ad9e21..414a22256 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -191,8 +191,10 @@ DCPContent::examine (shared_ptr<Job> job)
{
boost::mutex::scoped_lock lm (_mutex);
_name = examiner->name ();
- for (int i = 0; i < examiner->captions(); ++i) {
- caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this)));
+ for (int i = 0; i < CAPTION_COUNT; ++i) {
+ if (examiner->has_caption(static_cast<CaptionType>(i))) {
+ caption.push_back (shared_ptr<CaptionContent>(new CaptionContent(this, static_cast<CaptionType>(i))));
+ }
}
captions = caption.size ();
_encrypted = examiner->encrypted ();
diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc
index 8ce4aee00..6b4f854f8 100644
--- a/src/lib/dcp_examiner.cc
+++ b/src/lib/dcp_examiner.cc
@@ -58,7 +58,6 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
, _audio_length (0)
, _has_video (false)
, _has_audio (false)
- , _captions (0)
, _encrypted (false)
, _needs_assets (false)
, _kdm_valid (false)
@@ -66,6 +65,10 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
{
shared_ptr<dcp::CPL> cpl;
+ for (int i = 0; i < CAPTION_COUNT; ++i) {
+ _has_caption[i] = false;
+ }
+
if (content->cpl ()) {
/* Use the CPL that the content was using before */
BOOST_FOREACH (shared_ptr<dcp::CPL> i, cpls()) {
@@ -166,7 +169,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
return;
}
- ++_captions;
+ _has_caption[CAPTION_OPEN] = true;
}
if (i->closed_caption ()) {
@@ -176,7 +179,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
return;
}
- ++_captions;
+ _has_caption[CAPTION_CLOSED] = true;
}
if (i->main_picture()) {
diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h
index 0d55d4643..16385e07a 100644
--- a/src/lib/dcp_examiner.h
+++ b/src/lib/dcp_examiner.h
@@ -59,10 +59,6 @@ public:
return _name;
}
- int captions () const {
- return _captions;
- }
-
bool encrypted () const {
return _encrypted;
}
@@ -87,6 +83,10 @@ public:
return _audio_frame_rate.get_value_or (48000);
}
+ bool has_caption (CaptionType type) const {
+ return _has_caption[type];
+ }
+
bool kdm_valid () const {
return _kdm_valid;
}
@@ -119,7 +119,7 @@ private:
bool _has_video;
/** true if this DCP has audio content (but false if it has unresolved references to audio content) */
bool _has_audio;
- int _captions;
+ bool _has_caption[CAPTION_COUNT];
bool _encrypted;
bool _needs_assets;
bool _kdm_valid;
diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc
index 78e81328a..779361f63 100644
--- a/src/lib/dcp_subtitle_content.cc
+++ b/src/lib/dcp_subtitle_content.cc
@@ -40,7 +40,7 @@ using dcp::raw_convert;
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this)));
+ caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this, CAPTION_OPEN)));
}
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 4300dc970..3f0a692cd 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -304,7 +304,7 @@ FFmpegContent::examine (shared_ptr<Job> job)
_subtitle_streams = examiner->subtitle_streams ();
if (!_subtitle_streams.empty ()) {
caption.clear ();
- caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this)));
+ caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this, CAPTION_OPEN)));
_subtitle_stream = _subtitle_streams.front ();
}
diff --git a/src/lib/text_caption_file_content.cc b/src/lib/text_caption_file_content.cc
index c8eb2390a..aa64ca572 100644
--- a/src/lib/text_caption_file_content.cc
+++ b/src/lib/text_caption_file_content.cc
@@ -38,7 +38,7 @@ using dcp::raw_convert;
TextCaptionFileContent::TextCaptionFileContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this)));
+ caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this, CAPTION_OPEN)));
}
TextCaptionFileContent::TextCaptionFileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
diff --git a/src/lib/types.cc b/src/lib/types.cc
index 97373b24e..5474b609a 100644
--- a/src/lib/types.cc
+++ b/src/lib/types.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -25,6 +25,8 @@
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
+#include "i18n.h"
+
using std::max;
using std::min;
using std::string;
@@ -117,6 +119,19 @@ caption_type_to_string (CaptionType t)
}
string
+caption_type_to_name (CaptionType t)
+{
+ switch (t) {
+ case CAPTION_OPEN:
+ return _("Subtitles");
+ case CAPTION_CLOSED:
+ return _("Closed captions");
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+}
+
+string
video_frame_type_to_string (VideoFrameType t)
{
switch (t) {
diff --git a/src/lib/types.h b/src/lib/types.h
index b2bff78fa..6a05f66c9 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -147,6 +147,7 @@ enum CaptionType
};
extern std::string caption_type_to_string (CaptionType t);
+extern std::string caption_type_to_name (CaptionType t);
extern CaptionType string_to_caption_type (std::string s);
/** @struct Crop