From 130577d2e4e67de15ac8f5d6447729736d4bcac6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 21 Feb 2017 23:50:30 +0000 Subject: [PATCH] Remove unnecessary VideoFrame class. --- src/lib/content_video.h | 8 ++--- src/lib/player.cc | 6 ++-- src/lib/video_decoder.cc | 18 +++++----- src/lib/video_frame.cc | 77 ---------------------------------------- src/lib/video_frame.h | 63 -------------------------------- src/lib/wscript | 1 - test/video_frame_test.cc | 40 --------------------- test/wscript | 1 - 8 files changed, 16 insertions(+), 198 deletions(-) delete mode 100644 src/lib/video_frame.cc delete mode 100644 src/lib/video_frame.h delete mode 100644 test/video_frame_test.cc diff --git a/src/lib/content_video.h b/src/lib/content_video.h index 8e5f2fd09..ddc03b265 100644 --- a/src/lib/content_video.h +++ b/src/lib/content_video.h @@ -21,8 +21,6 @@ #ifndef DCPOMATIC_CONTENT_VIDEO_H #define DCPOMATIC_CONTENT_VIDEO_H -#include "video_frame.h" - class ImageProxy; /** @class ContentVideo @@ -35,14 +33,16 @@ public: : part (PART_WHOLE) {} - ContentVideo (boost::shared_ptr i, VideoFrame f, Part p) + ContentVideo (boost::shared_ptr i, Frame f, Eyes e, Part p) : image (i) , frame (f) + , eyes (e) , part (p) {} boost::shared_ptr image; - VideoFrame frame; + Frame frame; + Eyes eyes; Part part; }; diff --git a/src/lib/player.cc b/src/lib/player.cc index 87d8b9d97..14625b85a 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -566,7 +566,7 @@ Player::video (weak_ptr wp, ContentVideo video) } /* 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 */ @@ -619,12 +619,12 @@ Player::video (weak_ptr wp, ContentVideo video) 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, - video.frame.eyes(), + video.eyes, video.part, piece->content->video->colour_conversion () ) diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 8a8a45747..9afbd31c4 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -62,7 +62,7 @@ VideoDecoder::emit (shared_ptr image, Frame frame) /* 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: { @@ -70,26 +70,26 @@ VideoDecoder::emit (shared_ptr image, Frame 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: - 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: - 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: - 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: - Data (ContentVideo (image, VideoFrame (frame, EYES_LEFT), PART_WHOLE)); + Data (ContentVideo (image, frame, EYES_LEFT, PART_WHOLE)); 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); diff --git a/src/lib/video_frame.cc b/src/lib/video_frame.cc deleted file mode 100644 index e7c6a226a..000000000 --- a/src/lib/video_frame.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2016 Carl Hetherington - - 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 . - -*/ - -#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 index c197a94c8..000000000 --- a/src/lib/video_frame.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2016 Carl Hetherington - - 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 . - -*/ - -#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 diff --git a/src/lib/wscript b/src/lib/wscript index efcb2bc1e..2c34577d9 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -141,7 +141,6 @@ sources = """ 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 diff --git a/test/video_frame_test.cc b/test/video_frame_test.cc deleted file mode 100644 index 65a443d5a..000000000 --- a/test/video_frame_test.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2016 Carl Hetherington - - 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 . - -*/ - -#include "lib/video_frame.h" -#include "lib/exceptions.h" -#include - -/** 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); -} diff --git a/test/wscript b/test/wscript index 80f2c1c08..cfc114937 100644 --- a/test/wscript +++ b/test/wscript @@ -91,7 +91,6 @@ def build(bld): util_test.cc vf_test.cc video_content_scale_test.cc - video_frame_test.cc video_mxf_content_test.cc vf_kdm_test.cc """ -- 2.30.2