Fix failure on 1-frame-back seek (#604).
[dcpomatic.git] / src / lib / mid_side_decoder.cc
index be82f67542a2e3f5109d08bf6c503398ea7a12c4..842d5c8ee56d066b49a2e631cfa73cabd7eb5d88 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include "mid_side_decoder.h"
 #include "audio_buffers.h"
+#include "audio_mapping.h"
 
 #include "i18n.h"
 
 using std::string;
+using std::min;
+using std::vector;
 using boost::shared_ptr;
 
 string
@@ -44,7 +47,7 @@ MidSideDecoder::in_channels () const
 }
 
 int
-MidSideDecoder::out_channels (int) const
+MidSideDecoder::out_channels () const
 {
        return 3;
 }
@@ -70,3 +73,24 @@ MidSideDecoder::run (shared_ptr<const AudioBuffers> in)
 
        return out;
 }
+
+void
+MidSideDecoder::make_audio_mapping_default (AudioMapping& mapping) const
+{
+       /* Just map the first two input channels to our M/S */
+       mapping.make_zero ();
+       for (int i = 0; i < min (2, mapping.input_channels()); ++i) {
+               mapping.set (i, i, 1);
+       }
+}
+
+vector<string>
+MidSideDecoder::input_names () const
+{
+       vector<string> n;
+
+       n.push_back (_("Left"));
+       n.push_back (_("Right"));
+
+       return n;
+}