+ /* We are removing from the timeline if _views is not empty */
+ bool handled = false;
+ if (!_views.empty ()) {
+ /* Special case: we only remove FFmpegContent if its video view is selected;
+ if not, and its audio view is selected, we unmap the audio.
+ */
+ BOOST_FOREACH (shared_ptr<Content> i, _content) {
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (i);
+ if (!fc) {
+ continue;
+ }
+
+ shared_ptr<TimelineVideoContentView> video;
+ shared_ptr<TimelineAudioContentView> audio;
+
+ BOOST_FOREACH (shared_ptr<TimelineContentView> j, _views) {
+ shared_ptr<TimelineVideoContentView> v = dynamic_pointer_cast<TimelineVideoContentView> (j);
+ shared_ptr<TimelineAudioContentView> a = dynamic_pointer_cast<TimelineAudioContentView> (j);
+ if (v && v->content() == fc) {
+ video = v;
+ } else if (a && a->content() == fc) {
+ audio = a;
+ }
+ }
+
+ if (!video && audio) {
+ AudioMapping m = fc->audio_mapping ();
+ m.unmap_all ();
+ fc->set_audio_mapping (m);
+ handled = true;
+ }
+ }
+ }
+
+ if (!handled) {
+ film->remove_content (_content);
+ }