the names from the UI for content ratios.
using std::string;
using std::vector;
+using boost::optional;
vector<Ratio const *> Ratio::_ratios;
void
Ratio::setup_ratios ()
{
- _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "119"));
- _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "133"));
- _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("Academy"), "137"));
- _ratios.push_back (new Ratio (float(1544) / 1080, "143", _("IMAX"), "143"));
- _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "166"));
- _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "178"));
- _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("Flat"), "F"));
- _ratios.push_back (new Ratio (float(2048) / 872, "235", _("2.35"), "S"));
- _ratios.push_back (new Ratio (float(2048) / 858, "239", _("Scope"), "S"));
- _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("Full frame"), "C"));
+ _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), optional<string>(), "119"));
+ _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("1.33 (4:3)"), optional<string>(), "133"));
+ _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.38 (Academy)"), optional<string>(), "137"));
+ _ratios.push_back (new Ratio (float(1544) / 1080, "143", _("1.43 (IMAX)"), optional<string>(), "143"));
+ _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), optional<string>(), "166"));
+ _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("1.78 (16:9 or HD)"), optional<string>(), "178"));
+ _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("1.85 (Flat)"), string(_("DCI Flat")), "F"));
+ _ratios.push_back (new Ratio (float(2048) / 872, "235", _("2.35"), optional<string>(), "S"));
+ _ratios.push_back (new Ratio (float(2048) / 858, "239", _("2.39 (Scope)"), string(_("DCI Scope")), "S"));
+ _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("1.90 (Full frame)"), string(_("Full frame")), "C"));
}
Ratio const *
return nearest;
}
+
+vector<Ratio const *>
+Ratio::containers ()
+{
+ vector<Ratio const *> r;
+ r.push_back (Ratio::from_id ("185"));
+ r.push_back (Ratio::from_id ("239"));
+ r.push_back (Ratio::from_id ("full-frame"));
+ return r;
+}
+
+string
+Ratio::container_nickname () const
+{
+ DCPOMATIC_ASSERT (_container_nickname);
+ return *_container_nickname;
+}
class Ratio : public boost::noncopyable
{
public:
- Ratio (float ratio, std::string id, std::string n, std::string d)
+ Ratio (float ratio, std::string id, std::string in, boost::optional<std::string> cn, std::string d)
: _ratio (ratio)
, _id (id)
- , _nickname (n)
+ , _image_nickname (in)
+ , _container_nickname (cn)
, _isdcf_name (d)
{}
return _id;
}
- std::string nickname () const {
- return _nickname;
+ std::string image_nickname () const {
+ return _image_nickname;
}
+ std::string container_nickname () const;
+
std::string isdcf_name () const {
return _isdcf_name;
}
static Ratio const * from_id (std::string i);
static Ratio const * from_ratio (float r);
static Ratio const * nearest_from_ratio (float r);
+
static std::vector<Ratio const *> all () {
return _ratios;
}
+ static std::vector<Ratio const *> containers ();
+
private:
float _ratio;
/** id for use in metadata */
std::string _id;
- /** nickname (e.g. Flat, Scope) */
- std::string _nickname;
+ /** nickname when used to describe an image ratio (e.g. Flat, Scope) */
+ std::string _image_nickname;
+ /** nickname when used to describe a container ratio */
+ boost::optional<std::string> _container_nickname;
std::string _isdcf_name;
static std::vector<Ratio const *> _ratios;
if (scaled != container_size) {
d += String::compose (
_("\nPadded with black to fit container %1 (%2x%3)"),
- film->container()->nickname (),
+ film->container()->container_nickname (),
container_size.width, container_size.height
);
VideoContentScale::name () const
{
if (_ratio) {
- return _ratio->nickname ();
+ return _ratio->image_nickname ();
}
if (_scale) {
string text = Config::instance()->cover_sheet ();
boost::algorithm::replace_all (text, "$CPL_NAME", _film->name());
boost::algorithm::replace_all (text, "$TYPE", _film->dcp_content_type()->pretty_name());
- boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->nickname());
+ boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->container_nickname());
boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", _film->isdcf_metadata().audio_language);
boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", _film->isdcf_metadata().subtitle_language);
print_dump (shared_ptr<Film> film)
{
cout << film->dcp_name (true) << "\n"
- << film->container()->nickname() << " at " << ((film->resolution() == RESOLUTION_2K) ? "2K" : "4K") << "\n"
+ << film->container()->container_nickname() << " at " << ((film->resolution() == RESOLUTION_2K) ? "2K" : "4K") << "\n"
<< (film->j2k_bandwidth() / 1000000) << "Mbit/s" << "\n"
<< "Output " << film->video_frame_rate() << "fps " << (film->three_d() ? "3D" : "2D") << " " << (film->audio_frame_rate() / 1000) << "kHz\n"
<< (film->interop() ? "Inter-Op" : "SMPTE") << " " << (film->encrypted() ? "encrypted" : "unencrypted") << "\n";
_isdcf_metadata_button->Bind (wxEVT_BUTTON, boost::bind (&DefaultsPage::edit_isdcf_metadata_clicked, this));
- vector<Ratio const *> ratios = Ratio::all ();
- for (size_t i = 0; i < ratios.size(); ++i) {
- _container->Append (std_to_wx (ratios[i]->nickname ()));
+ BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
+ _container->Append (std_to_wx(i->container_nickname()));
}
_container->Bind (wxEVT_CHOICE, boost::bind (&DefaultsPage::container_changed, this));
_scale_to->Append (_("Guess from content"));
- for (size_t i = 0; i < ratios.size(); ++i) {
- _scale_to->Append (std_to_wx (ratios[i]->nickname ()));
+ BOOST_FOREACH (Ratio const * i, Ratio::all()) {
+ _scale_to->Append (std_to_wx(i->image_nickname()));
}
_scale_to->Bind (wxEVT_CHOICE, boost::bind (&DefaultsPage::scale_to_changed, this));
- vector<DCPContentType const *> const ct = DCPContentType::all ();
- for (size_t i = 0; i < ct.size(); ++i) {
- _dcp_content_type->Append (std_to_wx (ct[i]->pretty_name ()));
+ BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) {
+ _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
}
setup_audio_channels_choice (_dcp_audio_channels, 2);
_standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this));
_upload_after_make_dcp->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this));
- vector<DCPContentType const *> const ct = DCPContentType::all ();
- for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
- _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
+ BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) {
+ _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
}
_reel_type->Append (_("Single reel"));
DCPPanel::setup_container ()
{
int n = 0;
- vector<Ratio const *> ratios = Ratio::all ();
+ vector<Ratio const *> ratios = Ratio::containers ();
vector<Ratio const *>::iterator i = ratios.begin ();
while (i != ratios.end() && *i != _film->container ()) {
++i;
int const n = _container->GetSelection ();
if (n >= 0) {
- vector<Ratio const *> ratios = Ratio::all ();
+ vector<Ratio const *> ratios = Ratio::containers ();
DCPOMATIC_ASSERT (n < int (ratios.size()));
_film->set_container (ratios[n]);
}
++r;
}
+ add_label_to_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0));
+ _resolution = new wxChoice (panel, wxID_ANY);
+ grid->Add (_resolution, wxGBPosition (r, 1));
+ ++r;
+
add_label_to_sizer (grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0));
{
_frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
- add_label_to_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0));
- _resolution = new wxChoice (panel, wxID_ANY);
- grid->Add (_resolution, wxGBPosition (r, 1));
- ++r;
-
{
add_label_to_sizer (grid, panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true, wxGBPosition (r, 0));
wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_resolution->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::resolution_changed, this));
_three_d->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::three_d_changed, this));
- vector<Ratio const *> const ratio = Ratio::all ();
- for (vector<Ratio const *>::const_iterator i = ratio.begin(); i != ratio.end(); ++i) {
- _container->Append (std_to_wx ((*i)->nickname ()));
+ BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
+ _container->Append (std_to_wx(i->container_nickname()));
}
- list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
- for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
- _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
+ BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) {
+ _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
}
_j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
class wxSizer;
class AudioDialog;
-
class Film;
+class Ratio;
class DCPPanel : public boost::noncopyable
{