summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-01-03 00:54:34 +0100
committerCarl Hetherington <cth@carlh.net>2026-01-03 00:54:34 +0100
commitb6979246954779d5a9d9ac0cbd55e93142ce6812 (patch)
treee617bb2b2b7b97127bbda01b44cf6ad89409bf78
parente6f2753f4370cc46626fc68efb88705b23ef53e3 (diff)
Show properties of all audio streams (#2397).
-rw-r--r--src/lib/audio_content.cc52
-rw-r--r--src/wx/content_properties_dialog.cc43
2 files changed, 62 insertions, 33 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index 1d54841aa..50601fc58 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -293,48 +293,48 @@ AudioContent::channel_names() const
void
AudioContent::add_properties(shared_ptr<const Film> film, list<UserProperty>& p) const
{
- shared_ptr<const AudioStream> stream;
- if (streams().size() == 1) {
- stream = streams().front();
- }
-
- if (stream) {
- p.push_back(UserProperty(UserProperty::AUDIO, _("Channels"), stream->channels()));
- p.push_back(UserProperty(UserProperty::AUDIO, _("Content sample rate"), stream->frame_rate(), _("Hz")));
- if (auto bits = stream->bit_depth()) {
- p.push_back(UserProperty(UserProperty::AUDIO, _("Content bit depth"), *bits, _("bits")));
- }
- }
-
FrameRateChange const frc(_parent->active_video_frame_rate(film), film->video_frame_rate());
ContentTime const c(_parent->full_length(film), frc);
- p.push_back(
- UserProperty(UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source))
- );
-
- if (stream) {
+ int index = 0;
+ bool const multiple_streams = streams().size() > 1;
+ for (auto stream: streams()) {
+ optional<string> name;
+ if (multiple_streams) {
+ name = fmt::format("Stream {}", index++);
+ }
+ p.push_back(UserProperty(UserProperty::AUDIO, _("Channels"), stream->channels(), "", name));
+ p.push_back(UserProperty(UserProperty::AUDIO, _("Content sample rate"), stream->frame_rate(), _("Hz"), name));
+ auto bits = stream->bit_depth();
+ if (bits && *bits) {
+ p.push_back(UserProperty(UserProperty::AUDIO, _("Content bit depth"), *bits, _("bits"), name));
+ }
p.push_back(
UserProperty(
UserProperty::LENGTH,
_("Full length in audio samples at content rate"),
- c.frames_round(stream->frame_rate())
+ c.frames_round(stream->frame_rate()),
+ "",
+ name
)
);
- }
-
- p.push_back(UserProperty(UserProperty::AUDIO, _("DCP sample rate"), resampled_frame_rate(film), _("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(
UserProperty::LENGTH,
_("Full length in audio samples at DCP rate"),
- c.frames_round(resampled_frame_rate(film))
+ c.frames_round(resampled_frame_rate(film)),
+ "",
+ name
)
);
}
+
+ p.push_back(
+ UserProperty(UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source))
+ );
+
+ p.push_back(UserProperty(UserProperty::AUDIO, _("DCP sample rate"), resampled_frame_rate(film), _("Hz")));
+ p.push_back(UserProperty(UserProperty::LENGTH, _("Full length in video frames at DCP rate"), c.frames_round(frc.dcp)));
}
diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc
index a50cfec04..63f7fcf3e 100644
--- a/src/wx/content_properties_dialog.cc
+++ b/src/wx/content_properties_dialog.cc
@@ -20,20 +20,22 @@
#include "content_properties_dialog.h"
-#include "wx_util.h"
#include "static_text.h"
+#include "wx_util.h"
+#include "lib/audio_content.h"
#include "lib/content.h"
#include "lib/video_content.h"
-#include "lib/audio_content.h"
#include <boost/algorithm/string.hpp>
-using std::string;
+using std::dynamic_pointer_cast;
using std::list;
-using std::pair;
using std::map;
+using std::pair;
using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::string;
+using std::vector;
+using boost::optional;
ContentPropertiesDialog::ContentPropertiesDialog(wxWindow* parent, shared_ptr<const Film> film, shared_ptr<Content> content)
@@ -94,8 +96,35 @@ ContentPropertiesDialog::maybe_add_group(map<UserProperty::Category, list<UserPr
add(m, false);
add_spacer();
+ vector<string> sub_headings;
for (auto j: i->second) {
- add_label_to_sizer(_table, this, std_to_wx(j.key), true, 0, wxALIGN_TOP);
- add(new StaticText(this, std_to_wx(j.value + " " + j.unit)));
+ if (j.sub_heading) {
+ sub_headings.push_back(*j.sub_heading);
+ }
+ }
+
+ std::sort(sub_headings.begin(), sub_headings.end());
+ auto last = std::unique(sub_headings.begin(), sub_headings.end());
+ sub_headings.erase(last, sub_headings.end());
+
+ auto add_sub_heading = [&](optional<string> sub_heading) {
+ if (sub_heading) {
+ auto heading = add_label_to_sizer(_table, this, std_to_wx(*sub_heading), true, 0, wxALIGN_TOP);
+ wxFont font(*wxNORMAL_FONT);
+ font.SetStyle(wxFONTSTYLE_ITALIC);
+ heading->SetFont(font);
+ add_spacer();
+ }
+ for (auto j: i->second) {
+ if (j.sub_heading == sub_heading) {
+ add_label_to_sizer(_table, this, std_to_wx(j.key), true, 0, wxALIGN_TOP);
+ add(new StaticText(this, std_to_wx(j.value + " " + j.unit)));
+ }
+ }
+ };
+
+ add_sub_heading(boost::none);
+ for (auto const& h: sub_headings) {
+ add_sub_heading(h);
}
}