X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_content.cc;h=e66b8b998ded170d9ec2d56df47417c278c653b7;hb=73654117144c6de0ec4efe39ddc88485df546cc9;hp=b159aa50d4f47a6851c126d15512defd9aad00c6;hpb=3828baf56467224f5d44049bf1e7a7ed11f43a05;p=dcpomatic.git diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index b159aa50d..e66b8b998 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -23,8 +23,8 @@ #include "exceptions.h" #include "config.h" #include "frame_rate_change.h" -#include "raw_convert.h" #include "compose.hpp" +#include #include #include #include @@ -35,7 +35,6 @@ using std::string; using std::cout; using std::vector; -using std::stringstream; using std::fixed; using std::list; using std::pair; @@ -43,6 +42,7 @@ using std::setprecision; using boost::shared_ptr; using boost::dynamic_pointer_cast; using boost::optional; +using dcp::raw_convert; /** Something stream-related has changed */ int const AudioContentProperty::STREAMS = 200; @@ -58,8 +58,19 @@ AudioContent::AudioContent (Content* parent) } shared_ptr -AudioContent::from_xml (Content* parent, cxml::ConstNodePtr node) +AudioContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version) { + if (version < 34) { + /* With old metadata FFmpeg content has the audio-related tags even with no + audio streams, so check for that. + */ + if (node->string_child("Type") == "FFmpeg" && node->node_children("AudioStream").empty()) { + return shared_ptr (); + } + + /* Otherwise we can drop through to the newer logic */ + } + if (!node->optional_number_child ("AudioGain")) { return shared_ptr (); } @@ -292,34 +303,34 @@ AudioContent::add_properties (list& 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 sample 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 ()) )