Add another translator.
[dcpomatic.git] / src / lib / video_mxf_decoder.cc
index e8b787d8d45019a346b82bca55a9fe2d3c76d370..70c884699fe523b81fdbe568adc85402ca22539a 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
+    DCP-o-matic is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
@@ -34,8 +35,15 @@ VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const VideoMXFContent> content, sha
 }
 
 bool
-VideoMXFDecoder::pass (PassReason reason, bool)
+VideoMXFDecoder::pass (PassReason, bool)
 {
+       double const vfr = _content->active_video_frame_rate ();
+       int64_t const frame = _next.frames_round (vfr);
+
+       if (frame >= _content->video->length()) {
+               return true;
+       }
+
        shared_ptr<dcp::MonoPictureAsset> mono;
        try {
                mono.reset (new dcp::MonoPictureAsset (_content->path(0)));
@@ -58,9 +66,6 @@ VideoMXFDecoder::pass (PassReason reason, bool)
                }
        }
 
-       double const vfr = _content->active_video_frame_rate ();
-       int64_t const frame = _next.frames_round (vfr);
-
        if (mono) {
                video->give (shared_ptr<ImageProxy> (new J2KImageProxy (mono->get_frame(frame), mono->size())), frame);
        } else {
@@ -69,6 +74,7 @@ VideoMXFDecoder::pass (PassReason reason, bool)
        }
 
        _next += ContentTime::from_frames (1, vfr);
+       return false;
 }
 
 void