summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-01-04 23:33:28 +0000
committerCarl Hetherington <cth@carlh.net>2022-04-29 00:07:13 +0200
commit08b44e380c8be3a8cb2dacbd94049f09942dabc1 (patch)
tree9b460bcea45857f5eea1bba2360680e814ad64f3 /src/lib
parente06941199da90359f41ce80c276752bc0f172d7e (diff)
Allow 96kHz audio as an advanced option (#1789).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc4
-rw-r--r--src/lib/config.h9
-rw-r--r--src/lib/film.cc18
-rw-r--r--src/lib/film.h9
4 files changed, 30 insertions, 10 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index b6df1a88d..36aae76de 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -98,6 +98,7 @@ Config::set_defaults ()
_tms_password = "";
_allow_any_dcp_frame_rate = false;
_allow_any_container = false;
+ _allow_96khz_audio = false;
_show_experimental_audio_processors = false;
_language = optional<string> ();
_default_still_length = 10;
@@ -406,6 +407,7 @@ try
_maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
_allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate").get_value_or (false);
_allow_any_container = f.optional_bool_child ("AllowAnyContainer").get_value_or (false);
+ _allow_96khz_audio = f.optional_bool_child("Allow96kHzAudio").get_value_or(false);
_show_experimental_audio_processors = f.optional_bool_child ("ShowExperimentalAudioProcessors").get_value_or (false);
_log_types = f.optional_number_child<int> ("LogTypes").get_value_or (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR);
@@ -784,6 +786,8 @@ Config::write_config () const
root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0");
/* [XML] AllowAnyContainer 1 to allow users to user any container ratio for their DCP, 0 to limit the GUI to DCI Flat/Scope */
root->add_child("AllowAnyContainer")->add_child_text (_allow_any_container ? "1" : "0");
+ /* [XML] Allow96kHzAudio 1 to allow users to make DCPs with 96kHz audio, 0 to always make 48kHz DCPs */
+ root->add_child("Allow96kHzAudio")->add_child_text(_allow_96khz_audio ? "1" : "0");
/* [XML] ShowExperimentalAudioProcessors 1 to offer users the (experimental) audio upmixer processors, 0 to hide them */
root->add_child("ShowExperimentalAudioProcessors")->add_child_text (_show_experimental_audio_processors ? "1" : "0");
/* [XML] LogTypes Types of logging to write; a bitfield where 1 is general notes, 2 warnings, 4 errors, 8 debug information related
diff --git a/src/lib/config.h b/src/lib/config.h
index e9b3ec203..1d40a3b15 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -167,6 +167,10 @@ public:
return _allow_any_container;
}
+ bool allow_96khz_audio () const {
+ return _allow_96khz_audio;
+ }
+
bool show_experimental_audio_processors () const {
return _show_experimental_audio_processors;
}
@@ -651,6 +655,10 @@ public:
maybe_set (_allow_any_container, a);
}
+ void set_allow_96hhz_audio (bool a) {
+ maybe_set (_allow_96khz_audio, a);
+ }
+
void set_show_experimental_audio_processors (bool e) {
maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
}
@@ -1199,6 +1207,7 @@ private:
https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
*/
bool _allow_any_container;
+ bool _allow_96khz_audio;
/** Offer the upmixers in the audio processor settings */
bool _show_experimental_audio_processors;
boost::optional<std::string> _language;
diff --git a/src/lib/film.cc b/src/lib/film.cc
index ef64a91d3..7aeb6ab77 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -408,6 +408,7 @@ Film::metadata (bool with_content_paths) const
root->add_child("Resolution")->add_child_text (resolution_to_string (_resolution));
root->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
root->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate));
+ root->add_child("AudioFrameRate")->add_child_text(raw_convert<string>(_audio_frame_rate));
root->add_child("ISDCFDate")->add_child_text (boost::gregorian::to_iso_string (_isdcf_date));
root->add_child("AudioChannels")->add_child_text (raw_convert<string> (_audio_channels));
root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
@@ -561,6 +562,7 @@ Film::read_metadata (optional<boost::filesystem::path> path)
_resolution = string_to_resolution (f.string_child ("Resolution"));
_j2k_bandwidth = f.number_child<int> ("J2KBandwidth");
_video_frame_rate = f.number_child<int> ("VideoFrameRate");
+ _audio_frame_rate = f.optional_number_child<int>("AudioFrameRate").get_value_or(48000);
_encrypted = f.bool_child ("Encrypted");
_audio_channels = f.number_child<int> ("AudioChannels");
/* We used to allow odd numbers (and zero) channels, but it's just not worth
@@ -1565,14 +1567,6 @@ Film::playlist_order_changed ()
signal_change (ChangeType::DONE, Property::CONTENT_ORDER);
}
-int
-Film::audio_frame_rate () const
-{
- /* It seems that nobody makes 96kHz DCPs at the moment, so let's avoid them.
- See #1436.
- */
- return 48000;
-}
void
Film::set_sequence (bool s)
@@ -2160,6 +2154,14 @@ Film::set_audio_language (optional<dcp::LanguageTag> language)
}
+void
+Film::set_audio_frame_rate (int rate)
+{
+ FilmChangeSignaller ch (this, Property::AUDIO_FRAME_RATE);
+ _audio_frame_rate = rate;
+}
+
+
bool
Film::has_sign_language_video_channel () const
{
diff --git a/src/lib/film.h b/src/lib/film.h
index 1d1034775..e9c043b72 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -152,8 +152,6 @@ public:
std::vector<CPLSummary> cpls () const;
- int audio_frame_rate () const;
-
std::list<DCPTextTrack> closed_caption_tracks () const;
uint64_t required_disk_space () const;
@@ -233,6 +231,7 @@ public:
ENCRYPTED,
J2K_BANDWIDTH,
VIDEO_FRAME_RATE,
+ AUDIO_FRAME_RATE,
AUDIO_CHANNELS,
/** The setting of _three_d has changed */
THREE_D,
@@ -417,6 +416,10 @@ public:
return _isdcf_date;
}
+ int audio_frame_rate () const {
+ return _audio_frame_rate;
+ }
+
/* SET */
void set_directory (boost::filesystem::path);
@@ -463,6 +466,7 @@ public:
void set_distributor (boost::optional<std::string> d = boost::none);
void set_luminance (boost::optional<dcp::Luminance> l = boost::none);
void set_audio_language (boost::optional<dcp::LanguageTag> language);
+ void set_audio_frame_rate (int rate);
void add_ffoc_lfoc (Markers& markers) const;
@@ -570,6 +574,7 @@ private:
bool _two_d_version_of_three_d = false;
boost::optional<dcp::Luminance> _luminance;
boost::optional<dcp::LanguageTag> _audio_language;
+ int _audio_frame_rate = 48000;
int _state_version;