summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-02 21:03:03 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-02 21:03:03 +0100
commit31150ddd0fafac4426d11a758be9d77699b7377c (patch)
treeaa0ac01afb3295f2aa326e394e37247c68d7a431 /src/lib
parentcec71ef08475af291b968873757979c5e977facb (diff)
Fix missing content properties when using translations.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/audio_content.cc14
-rw-r--r--src/lib/content.cc8
-rw-r--r--src/lib/ffmpeg_content.cc23
-rw-r--r--src/lib/user_property.h11
-rw-r--r--src/lib/video_content.cc4
5 files changed, 37 insertions, 23 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index b159aa50d..2b402991c 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -292,34 +292,34 @@ AudioContent::add_properties (list<UserProperty>& p) const
}
if (stream) {
- p.push_back (UserProperty (_("Audio"), _("Channels"), stream->channels ()));
- p.push_back (UserProperty (_("Audio"), _("Content audio sample rate"), stream->frame_rate(), _("Hz")));
+ p.push_back (UserProperty (UserProperty::AUDIO, _("Channels"), stream->channels ()));
+ p.push_back (UserProperty (UserProperty::AUDIO, _("Content audio sample rate"), stream->frame_rate(), _("Hz")));
}
FrameRateChange const frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate());
ContentTime const c (_parent->full_length(), frc);
p.push_back (
- UserProperty (_("Length"), _("Full length in video frames at content rate"), c.frames_round(frc.source))
+ UserProperty (UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source))
);
if (stream) {
p.push_back (
UserProperty (
- _("Length"),
+ UserProperty::LENGTH,
_("Full length in audio samples at content rate"),
c.frames_round (stream->frame_rate ())
)
);
}
- p.push_back (UserProperty (_("Audio"), _("DCP frame rate"), resampled_frame_rate (), _("Hz")));
- p.push_back (UserProperty (_("Length"), _("Full length in video frames at DCP rate"), c.frames_round (frc.dcp)));
+ p.push_back (UserProperty (UserProperty::AUDIO, _("DCP frame rate"), resampled_frame_rate (), _("Hz")));
+ p.push_back (UserProperty (UserProperty::LENGTH, _("Full length in video frames at DCP rate"), c.frames_round (frc.dcp)));
if (stream) {
p.push_back (
UserProperty (
- _("Length"),
+ UserProperty::LENGTH,
_("Full length in audio samples at DCP rate"),
c.frames_round (resampled_frame_rate ())
)
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 66b0d477e..b8e7f8ad2 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -359,9 +359,13 @@ Content::active_video_frame_rate () const
void
Content::add_properties (list<UserProperty>& p) const
{
- p.push_back (UserProperty (_("General"), _("Filename"), path(0).string ()));
+ p.push_back (UserProperty (UserProperty::GENERAL, _("Filename"), path(0).string ()));
if (_video_frame_rate) {
- p.push_back (UserProperty (_("General"), _("Video frame rate"), raw_convert<string> (_video_frame_rate.get(), 5), _("frames per second")));
+ p.push_back (
+ UserProperty (
+ UserProperty::GENERAL, _("Video frame rate"), raw_convert<string> (_video_frame_rate.get(), 5), _("frames per second")
+ )
+ );
}
}
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index cc6a703ba..0f66180d0 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -122,6 +122,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<boost::shared_ptr<Content> > c)
: Content (film, c)
{
+ /* XXX: this should look at c to decide which of video/audio/subtitle
+ get created.
+ */
video.reset (new VideoContent (this, c));
audio.reset (new AudioContent (this, c));
subtitle.reset (new SubtitleContent (this, c));
@@ -434,21 +437,21 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
case AVCOL_RANGE_UNSPECIFIED:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is unknown (not specified in the file).
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Unspecified")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Unspecified")));
break;
case AVCOL_RANGE_MPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is limited, so that not all possible values are valid.
p.push_back (
UserProperty (
- _("Video"), _("Colour range"), String::compose (_("Limited (%1-%2)"), (total - sub) / 2, (total + sub) / 2)
+ UserProperty::VIDEO, _("Colour range"), String::compose (_("Limited (%1-%2)"), (total - sub) / 2, (total + sub) / 2)
)
);
break;
case AVCOL_RANGE_JPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is full, so that all possible pixel values are valid.
- p.push_back (UserProperty (_("Video"), _("Colour range"), String::compose (_("Full (0-%1)"), total)));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), String::compose (_("Full (0-%1)"), total)));
break;
default:
DCPOMATIC_ASSERT (false);
@@ -458,17 +461,17 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
case AVCOL_RANGE_UNSPECIFIED:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is unknown (not specified in the file).
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Unspecified")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Unspecified")));
break;
case AVCOL_RANGE_MPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is limited, so that not all possible values are valid.
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Limited")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Limited")));
break;
case AVCOL_RANGE_JPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is full, so that all possible pixel values are valid.
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Full")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Full")));
break;
default:
DCPOMATIC_ASSERT (false);
@@ -490,7 +493,7 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
};
DCPOMATIC_ASSERT (AVCOL_PRI_NB <= 11);
- p.push_back (UserProperty (_("Video"), _("Colour primaries"), primaries[_color_primaries]));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour primaries"), primaries[_color_primaries]));
char const * transfers[] = {
_("Unspecified"),
@@ -514,7 +517,7 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
};
DCPOMATIC_ASSERT (AVCOL_TRC_NB <= 18);
- p.push_back (UserProperty (_("Video"), _("Colour transfer characteristic"), transfers[_color_trc]));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour transfer characteristic"), transfers[_color_trc]));
char const * spaces[] = {
_("RGB / sRGB (IEC61966-2-1)"),
@@ -531,10 +534,10 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
};
DCPOMATIC_ASSERT (AVCOL_SPC_NB == 11);
- p.push_back (UserProperty (_("Video"), _("Colourspace"), spaces[_colorspace]));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colourspace"), spaces[_colorspace]));
if (_bits_per_pixel) {
- p.push_back (UserProperty (_("Video"), _("Bits per pixel"), raw_convert<string> (_bits_per_pixel.get ())));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Bits per pixel"), raw_convert<string> (_bits_per_pixel.get ())));
}
}
diff --git a/src/lib/user_property.h b/src/lib/user_property.h
index b27cd4151..a7a6f63da 100644
--- a/src/lib/user_property.h
+++ b/src/lib/user_property.h
@@ -26,15 +26,22 @@
class UserProperty
{
public:
+ enum Category {
+ GENERAL,
+ VIDEO,
+ AUDIO,
+ LENGTH
+ };
+
template <class T>
- UserProperty (std::string category_, std::string key_, T value_, std::string unit_ = "")
+ UserProperty (Category category_, std::string key_, T value_, std::string unit_ = "")
: category (category_)
, key (key_)
, value (raw_convert<std::string> (value_))
, unit (unit_)
{}
- std::string category;
+ Category category;
std::string key;
std::string value;
std::string unit;
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 9ffc63c5d..473bd784c 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -419,8 +419,8 @@ VideoContent::processing_description () const
void
VideoContent::add_properties (list<UserProperty>& p) const
{
- p.push_back (UserProperty (_("Video"), _("Length"), raw_convert<string> (length ()), _("video frames")));
- p.push_back (UserProperty (_("Video"), _("Size"), raw_convert<string> (size().width) + "x" + raw_convert<string> (size().height)));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Length"), raw_convert<string> (length ()), _("video frames")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Size"), raw_convert<string> (size().width) + "x" + raw_convert<string> (size().height)));
}
void