Remove unnecessary VideoFrame class.
authorCarl Hetherington <cth@carlh.net>
Tue, 21 Feb 2017 23:50:30 +0000 (23:50 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 19 Apr 2017 22:04:32 +0000 (23:04 +0100)
src/lib/content_video.h
src/lib/player.cc
src/lib/video_decoder.cc
src/lib/video_frame.cc [deleted file]
src/lib/video_frame.h [deleted file]
src/lib/wscript
test/video_frame_test.cc [deleted file]
test/wscript

index 8e5f2fd094d408d6433fb012c3a3a35385c9375c..ddc03b2655d78f4d1b6ab575c369eb0b96f4640b 100644 (file)
@@ -21,8 +21,6 @@
 #ifndef DCPOMATIC_CONTENT_VIDEO_H
 #define DCPOMATIC_CONTENT_VIDEO_H
 
 #ifndef DCPOMATIC_CONTENT_VIDEO_H
 #define DCPOMATIC_CONTENT_VIDEO_H
 
-#include "video_frame.h"
-
 class ImageProxy;
 
 /** @class ContentVideo
 class ImageProxy;
 
 /** @class ContentVideo
@@ -35,14 +33,16 @@ public:
                : part (PART_WHOLE)
        {}
 
                : part (PART_WHOLE)
        {}
 
-       ContentVideo (boost::shared_ptr<const ImageProxy> i, VideoFrame f, Part p)
+       ContentVideo (boost::shared_ptr<const ImageProxy> i, Frame f, Eyes e, Part p)
                : image (i)
                , frame (f)
                : image (i)
                , frame (f)
+               , eyes (e)
                , part (p)
        {}
 
        boost::shared_ptr<const ImageProxy> image;
                , part (p)
        {}
 
        boost::shared_ptr<const ImageProxy> image;
-       VideoFrame frame;
+       Frame frame;
+       Eyes eyes;
        Part part;
 };
 
        Part part;
 };
 
index 87d8b9d97913553c4f090211f5dcb9b32ffd26f1..14625b85ac53007a06c6ee040331ef0779602ca0 100644 (file)
@@ -566,7 +566,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
        }
 
        /* Time and period of the frame we will emit */
        }
 
        /* Time and period of the frame we will emit */
-       DCPTime const time = content_video_to_dcp (piece, video.frame.index());
+       DCPTime const time = content_video_to_dcp (piece, video.frame);
        DCPTimePeriod const period (time, time + DCPTime::from_frames (1, _film->video_frame_rate()));
 
        /* Discard if it's outside the content's period */
        DCPTimePeriod const period (time, time + DCPTime::from_frames (1, _film->video_frame_rate()));
 
        /* Discard if it's outside the content's period */
@@ -619,12 +619,12 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                new PlayerVideo (
                        video.image,
                        piece->content->video->crop (),
                new PlayerVideo (
                        video.image,
                        piece->content->video->crop (),
-                       piece->content->video->fade (video.frame.index()),
+                       piece->content->video->fade (video.frame),
                        piece->content->video->scale().size (
                                piece->content->video, _video_container_size, _film->frame_size ()
                                ),
                        _video_container_size,
                        piece->content->video->scale().size (
                                piece->content->video, _video_container_size, _film->frame_size ()
                                ),
                        _video_container_size,
-                       video.frame.eyes(),
+                       video.eyes,
                        video.part,
                        piece->content->video->colour_conversion ()
                        )
                        video.part,
                        piece->content->video->colour_conversion ()
                        )
index 8a8a457476e2cacd5056189366bed0c888ffbaf1..9afbd31c46bbd4d52304b478c054fee62fa2e97d 100644 (file)
@@ -62,7 +62,7 @@ VideoDecoder::emit (shared_ptr<const ImageProxy> image, Frame frame)
        /* Work out what we are going to emit next */
        switch (_content->video->frame_type ()) {
        case VIDEO_FRAME_TYPE_2D:
        /* Work out what we are going to emit next */
        switch (_content->video->frame_type ()) {
        case VIDEO_FRAME_TYPE_2D:
-               Data (ContentVideo (image, VideoFrame (frame, EYES_BOTH), PART_WHOLE));
+               Data (ContentVideo (image, frame, EYES_BOTH, PART_WHOLE));
                break;
        case VIDEO_FRAME_TYPE_3D:
        {
                break;
        case VIDEO_FRAME_TYPE_3D:
        {
@@ -70,26 +70,26 @@ VideoDecoder::emit (shared_ptr<const ImageProxy> image, Frame frame)
                   frame this one is.
                */
                bool const same = (_last_emitted && _last_emitted.get() == frame);
                   frame this one is.
                */
                bool const same = (_last_emitted && _last_emitted.get() == frame);
-               Data (ContentVideo (image, VideoFrame (frame, same ? EYES_RIGHT : EYES_LEFT), PART_WHOLE));
+               Data (ContentVideo (image, frame, same ? EYES_RIGHT : EYES_LEFT, PART_WHOLE));
                _last_emitted = frame;
                break;
        }
        case VIDEO_FRAME_TYPE_3D_ALTERNATE:
                _last_emitted = frame;
                break;
        }
        case VIDEO_FRAME_TYPE_3D_ALTERNATE:
-               Data (ContentVideo (image, VideoFrame (frame / 2, (frame % 2) ? EYES_RIGHT : EYES_LEFT), PART_WHOLE));
+               Data (ContentVideo (image, frame / 2, (frame % 2) ? EYES_RIGHT : EYES_LEFT, PART_WHOLE));
                break;
        case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
                break;
        case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
-               Data (ContentVideo (image, VideoFrame (frame, EYES_LEFT), PART_LEFT_HALF));
-               Data (ContentVideo (image, VideoFrame (frame, EYES_RIGHT), PART_RIGHT_HALF));
+               Data (ContentVideo (image, frame, EYES_LEFT, PART_LEFT_HALF));
+               Data (ContentVideo (image, frame, EYES_RIGHT, PART_RIGHT_HALF));
                break;
        case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
                break;
        case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
-               Data (ContentVideo (image, VideoFrame (frame, EYES_LEFT), PART_TOP_HALF));
-               Data (ContentVideo (image, VideoFrame (frame, EYES_RIGHT), PART_BOTTOM_HALF));
+               Data (ContentVideo (image, frame, EYES_LEFT, PART_TOP_HALF));
+               Data (ContentVideo (image, frame, EYES_RIGHT, PART_BOTTOM_HALF));
                break;
        case VIDEO_FRAME_TYPE_3D_LEFT:
                break;
        case VIDEO_FRAME_TYPE_3D_LEFT:
-               Data (ContentVideo (image, VideoFrame (frame, EYES_LEFT), PART_WHOLE));
+               Data (ContentVideo (image, frame, EYES_LEFT, PART_WHOLE));
                break;
        case VIDEO_FRAME_TYPE_3D_RIGHT:
                break;
        case VIDEO_FRAME_TYPE_3D_RIGHT:
-               Data (ContentVideo (image, VideoFrame (frame, EYES_RIGHT), PART_WHOLE));
+               Data (ContentVideo (image, frame, EYES_RIGHT, PART_WHOLE));
                break;
        default:
                DCPOMATIC_ASSERT (false);
                break;
        default:
                DCPOMATIC_ASSERT (false);
diff --git a/src/lib/video_frame.cc b/src/lib/video_frame.cc
deleted file mode 100644 (file)
index e7c6a22..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
-
-    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.
-
-    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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "video_frame.h"
-#include "dcpomatic_assert.h"
-
-VideoFrame &
-VideoFrame::operator++ ()
-{
-       if (_eyes == EYES_BOTH) {
-               ++_index;
-       } else if (_eyes == EYES_LEFT) {
-               _eyes = EYES_RIGHT;
-       } else {
-               _eyes = EYES_LEFT;
-               ++_index;
-       }
-
-       return *this;
-}
-
-bool
-operator== (VideoFrame const & a, VideoFrame const & b)
-{
-       return a.index() == b.index() && a.eyes() == b.eyes();
-}
-
-bool
-operator!= (VideoFrame const & a, VideoFrame const & b)
-{
-       return !(a == b);
-}
-
-bool
-operator> (VideoFrame const & a, VideoFrame const & b)
-{
-       if (a.index() != b.index()) {
-               return a.index() > b.index();
-       }
-
-       /* indexes are the same */
-
-       if (a.eyes() == b.eyes()) {
-               return false;
-       }
-
-       /* eyes are not the same */
-
-       if (a.eyes() == EYES_LEFT && b.eyes() == EYES_RIGHT) {
-               return false;
-       }
-
-       if (a.eyes() == EYES_RIGHT && b.eyes() == EYES_LEFT) {
-               return true;
-       }
-
-       /* should never get here; we are comparing 2D with 3D */
-
-       DCPOMATIC_ASSERT (false);
-}
diff --git a/src/lib/video_frame.h b/src/lib/video_frame.h
deleted file mode 100644 (file)
index c197a94..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
-
-    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.
-
-    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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef DCPOMATIC_VIDEO_FRAME_H
-#define DCPOMATIC_VIDEO_FRAME_H
-
-#include "types.h"
-
-class VideoFrame
-{
-public:
-       VideoFrame ()
-               : _index (0)
-               , _eyes (EYES_BOTH)
-       {}
-
-       explicit VideoFrame (Frame i)
-               : _index (i)
-               , _eyes (EYES_BOTH)
-       {}
-
-       VideoFrame (Frame i, Eyes e)
-               : _index (i)
-               , _eyes (e)
-       {}
-
-       Frame index () const {
-               return _index;
-       }
-
-       Eyes eyes () const {
-               return _eyes;
-       }
-
-       VideoFrame& operator++ ();
-
-private:
-       Frame _index;
-       Eyes _eyes;
-};
-
-extern bool operator== (VideoFrame const & a, VideoFrame const & b);
-extern bool operator!= (VideoFrame const & a, VideoFrame const & b);
-extern bool operator> (VideoFrame const & a, VideoFrame const & b);
-
-#endif
index efcb2bc1efef6fe30bb178778169715a30be74a2..2c34577d94d5ded4e5f0b1c246e8675bbabb28ee 100644 (file)
@@ -141,7 +141,6 @@ sources = """
           video_content_scale.cc
           video_decoder.cc
           video_filter_graph.cc
           video_content_scale.cc
           video_decoder.cc
           video_filter_graph.cc
-          video_frame.cc
           video_mxf_content.cc
           video_mxf_decoder.cc
           video_mxf_examiner.cc
           video_mxf_content.cc
           video_mxf_decoder.cc
           video_mxf_examiner.cc
diff --git a/test/video_frame_test.cc b/test/video_frame_test.cc
deleted file mode 100644 (file)
index 65a443d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
-
-    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.
-
-    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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "lib/video_frame.h"
-#include "lib/exceptions.h"
-#include <boost/test/unit_test.hpp>
-
-/** Test VideoFrame */
-BOOST_AUTO_TEST_CASE (video_frame_test)
-{
-       BOOST_CHECK_EQUAL (VideoFrame (0, EYES_BOTH) > VideoFrame (0, EYES_BOTH), false);
-       BOOST_CHECK_EQUAL (VideoFrame (1, EYES_BOTH) > VideoFrame (0, EYES_BOTH), true);
-       BOOST_CHECK_EQUAL (VideoFrame (0, EYES_BOTH) > VideoFrame (1, EYES_BOTH), false);
-
-       BOOST_CHECK_EQUAL (VideoFrame (0, EYES_LEFT) > VideoFrame (0, EYES_LEFT), false);
-       BOOST_CHECK_EQUAL (VideoFrame (0, EYES_LEFT) > VideoFrame (0, EYES_RIGHT), false);
-       BOOST_CHECK_EQUAL (VideoFrame (0, EYES_RIGHT) > VideoFrame (0, EYES_LEFT), true);
-       BOOST_CHECK_EQUAL (VideoFrame (0, EYES_RIGHT) > VideoFrame (1, EYES_LEFT), false);
-       BOOST_CHECK_EQUAL (VideoFrame (1, EYES_LEFT) > VideoFrame (0, EYES_RIGHT), true);
-
-       BOOST_CHECK_THROW (VideoFrame (0, EYES_LEFT) > VideoFrame (0, EYES_BOTH), ProgrammingError);
-       BOOST_CHECK_THROW (VideoFrame (0, EYES_BOTH) > VideoFrame (0, EYES_RIGHT), ProgrammingError);
-}
index 80f2c1c082900142d5d8f7bb50bcd976daf7a176..cfc114937adea67bb4c36a1d8a81abe8cb187619 100644 (file)
@@ -91,7 +91,6 @@ def build(bld):
                  util_test.cc
                  vf_test.cc
                  video_content_scale_test.cc
                  util_test.cc
                  vf_test.cc
                  video_content_scale_test.cc
-                 video_frame_test.cc
                  video_mxf_content_test.cc
                  vf_kdm_test.cc
                  """
                  video_mxf_content_test.cc
                  vf_kdm_test.cc
                  """