X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=edcb124e57e8edaedb91bb956a9dc8a0e15fcbe0;hb=0a93237cb5e4642d3b698ff9b7d0cfae5401478c;hp=0af4c5611d8be2f4355a549b51451c87ae2d8eb3;hpb=5ae794047e5ceee4502e59211f0083a60224f4bd;p=dcpomatic.git diff --git a/src/lib/film.cc b/src/lib/film.cc index 0af4c5611..edcb124e5 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -656,11 +656,26 @@ Film::isdcf_name (bool if_created_now) const string Film::dcp_name (bool if_created_now) const { + string unfiltered; if (use_isdcf_name()) { - return isdcf_name (if_created_now); + unfiltered = isdcf_name (if_created_now); + } else { + unfiltered = name (); } - return name(); + /* Filter out `bad' characters which cause problems with some systems. + There's no apparent list of what really is allowed, so this is a guess. + */ + + string filtered; + string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; + for (size_t i = 0; i < unfiltered.size(); ++i) { + if (allowed.find (unfiltered[i]) != string::npos) { + filtered += unfiltered[i]; + } + } + + return filtered; } void @@ -968,9 +983,7 @@ Film::playlist_content_changed (boost::weak_ptr c, int p) { if (p == VideoContentProperty::VIDEO_FRAME_RATE) { set_video_frame_rate (_playlist->best_dcp_frame_rate ()); - } else if ( - p == AudioContentProperty::AUDIO_MAPPING || - p == AudioContentProperty::AUDIO_CHANNELS) { + } else if (p == AudioContentProperty::AUDIO_STREAMS) { signal_changed (NAME); }