Rename ContentAtmos -> PieceAtmos and pass atmos through Piece.
authorCarl Hetherington <cth@carlh.net>
Tue, 4 May 2021 11:34:50 +0000 (13:34 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 7 May 2021 07:29:59 +0000 (09:29 +0200)
src/lib/atmos_decoder.cc
src/lib/atmos_decoder.h
src/lib/content_atmos.h [deleted file]
src/lib/piece.cc
src/lib/piece.h
src/lib/piece_atmos.h [new file with mode: 0644]
src/lib/player.cc
src/lib/player.h

index 478c4580977cd8e2ad8bcc33fb5904976d0a4ade..1b3e3503a8713a9ebf92fe6f8348f92681f23c25 100644 (file)
@@ -48,7 +48,7 @@ AtmosDecoder::seek ()
 void
 AtmosDecoder::emit (shared_ptr<const Film> film, shared_ptr<const dcp::AtmosFrame> data, Frame frame, AtmosMetadata metadata)
 {
-       Data (ContentAtmos(data, frame, metadata));
+       Data (data, frame, metadata);
        /* There's no fiddling with frame rates when we are using Atmos; the DCP rate must be the same as the Atmos one */
        _position = dcpomatic::ContentTime::from_frames (frame, film->video_frame_rate());
 }
index 1ec1b8a6cff380e3dfb11444a4d75432e33a2613..6e1d18680e26e02ee9b95d74118207b049cf451f 100644 (file)
@@ -20,8 +20,8 @@
 
 
 #include "atmos_metadata.h"
-#include "content_atmos.h"
 #include "decoder_part.h"
+#include "piece_atmos.h"
 #include <boost/signals2.hpp>
 
 
@@ -38,7 +38,7 @@ public:
 
        void emit (std::shared_ptr<const Film> film, std::shared_ptr<const dcp::AtmosFrame> data, Frame frame, AtmosMetadata metadata);
 
-       boost::signals2::signal<void (ContentAtmos)> Data;
+       boost::signals2::signal<void (std::shared_ptr<const dcp::AtmosFrame>, Frame, AtmosMetadata)> Data;
 
 private:
        std::shared_ptr<const Content> _content;
diff --git a/src/lib/content_atmos.h b/src/lib/content_atmos.h
deleted file mode 100644 (file)
index 891ca3b..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-    Copyright (C) 2020 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_CONTENT_ATMOS_H
-#define DCPOMATIC_CONTENT_ATMOS_H
-
-#include "atmos_metadata.h"
-#include "types.h"
-#include <dcp/atmos_asset_reader.h>
-
-/** @class ContentAtmos
- *  @brief Some Atmos data that has come out of a decoder.
- */
-class ContentAtmos
-{
-public:
-       ContentAtmos (std::shared_ptr<const dcp::AtmosFrame> data_, Frame frame_, AtmosMetadata metadata_)
-               : data (data_)
-               , frame (frame_)
-               , metadata (metadata_)
-       {}
-
-       std::shared_ptr<const dcp::AtmosFrame> data;
-       Frame frame;
-       AtmosMetadata metadata;
-};
-
-#endif
index 69469c02e2c3524ab63647127f0fadb0dfe59ce4..452b34222a8459de37af1c19a22b5efe4af6c695 100644 (file)
@@ -19,6 +19,8 @@
 */
 
 
+#include "atmos_decoder.h"
+#include "atmos_metadata.h"
 #include "audio_content.h"
 #include "audio_decoder.h"
 #include "content.h"
@@ -74,6 +76,10 @@ Piece::Piece (weak_ptr<const Film> film, shared_ptr<Content> content, shared_ptr
                i->Stop.connect (boost::bind(&Piece::stop, this, content, i->content(), _1));
        }
 
+       if (_decoder->atmos) {
+               _decoder->atmos->Data.connect (boost::bind(&Piece::atmos, this, _1, _2, _3));
+       }
+
        _decoder->Flush.connect (boost::bind(&Piece::flush, this));
 }
 
@@ -152,6 +158,13 @@ Piece::stop (weak_ptr<const Content> content, weak_ptr<const TextContent> text,
 }
 
 
+void
+Piece::atmos (shared_ptr<const dcp::AtmosFrame> data, Frame frame, AtmosMetadata metadata)
+{
+       Atmos (PieceAtmos(data, frame, metadata));
+}
+
+
 void
 Piece::update_pull_to (DCPTime& pull_to) const
 {
index 2e4eded897af744c402e444d28d29fa081bfca54..2586bb1d053ae0b8a361609a3f3f510f9b3f18e3 100644 (file)
@@ -27,6 +27,7 @@
 #include "dcpomatic_time.h"
 #include "font_data.h"
 #include "frame_rate_change.h"
+#include "piece_atmos.h"
 #include "piece_audio.h"
 #include "piece_text.h"
 #include "piece_video.h"
@@ -92,6 +93,7 @@ public:
        boost::signals2::signal<void (PieceBitmapTextStart)> BitmapTextStart;
        boost::signals2::signal<void (PieceStringTextStart)> StringTextStart;
        boost::signals2::signal<void (PieceTextStop)> TextStop;
+       boost::signals2::signal<void (PieceAtmos)> Atmos;
 
 private:
        friend struct overlap_video_test1;
@@ -102,6 +104,7 @@ private:
        void bitmap_start (std::weak_ptr<const Content> content, std::weak_ptr<const TextContent> text, dcpomatic::ContentTime time, std::shared_ptr<Image> image, dcpomatic::Rect<double> area);
        void string_start (std::weak_ptr<const Content> content, std::weak_ptr<const TextContent> text, dcpomatic::ContentTime time, std::list<dcp::SubtitleString> subs);
        void stop (std::weak_ptr<const Content> content, std::weak_ptr<const TextContent> text, dcpomatic::ContentTime time);
+       void atmos (std::shared_ptr<const dcp::AtmosFrame> data, Frame frame, AtmosMetadata metadata);
 
        void flush ();
 
diff --git a/src/lib/piece_atmos.h b/src/lib/piece_atmos.h
new file mode 100644 (file)
index 0000000..1fa9272
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2020-2021 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_PIECE_ATMOS_H
+#define DCPOMATIC_PIECE_ATMOS_H
+
+
+#include "atmos_metadata.h"
+#include "types.h"
+#include <dcp/atmos_asset_reader.h>
+
+
+/** @class PieceAtmos
+ *  @brief Some Atmos data that has come out of a decoder.
+ */
+class PieceAtmos
+{
+public:
+       PieceAtmos (std::shared_ptr<const dcp::AtmosFrame> data_, Frame frame_, AtmosMetadata metadata_)
+               : data (data_)
+               , frame (frame_)
+               , metadata (metadata_)
+       {}
+
+       std::shared_ptr<const dcp::AtmosFrame> data;
+       Frame frame;
+       AtmosMetadata metadata;
+};
+
+
+#endif
index ad23ea47dc2720fd6073c27057368e2075a0d9ff..590fddb7c2bd859a0793e30be76a1761565b5b71 100644 (file)
@@ -293,13 +293,10 @@ Player::setup_pieces_unlocked ()
                        piece->Audio.connect (bind(&Player::audio, this, weak_ptr<Piece>(piece), _1));
                }
 
-               piece->BitmapTextStart.connect (bind(&Player::bitmap_text_start, this, weak_ptr<Piece>(piece), _1));
-               piece->StringTextStart.connect (bind(&Player::string_text_start, this, weak_ptr<Piece>(piece), _1));
-               piece->TextStop.connect (bind(&Player::subtitle_stop, this, weak_ptr<Piece>(piece), _1));
-
-               if (decoder->atmos) {
-                       decoder->atmos->Data.connect (bind(&Player::atmos, this, weak_ptr<Piece>(piece), _1));
-               }
+               piece->BitmapTextStart.connect (bind(&Player::bitmap_text_start, this, piece, _1));
+               piece->StringTextStart.connect (bind(&Player::string_text_start, this, piece, _1));
+               piece->TextStop.connect (bind(&Player::subtitle_stop, this, piece, _1));
+               piece->Atmos.connect (bind(&Player::atmos, this, piece, _1));
        }
 
        for (auto i = _pieces.begin(); i != _pieces.end(); ++i) {
@@ -1279,7 +1276,7 @@ Player::playlist () const
 
 
 void
-Player::atmos (weak_ptr<Piece>, ContentAtmos data)
+Player::atmos (weak_ptr<Piece>, PieceAtmos data)
 {
        Atmos (data.data, DCPTime::from_frames(data.frame, _film->video_frame_rate()), data.metadata);
 }
index d7e297985e421462a7449574dc68191f7b3b6876..eb38bc46f0e3bb7c7cd4b24c6f3331771a7cbad9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #include "audio_merger.h"
 #include "audio_stream.h"
 #include "content.h"
-#include "content_atmos.h"
 #include "empty.h"
 #include "film.h"
 #include "piece.h"
+#include "piece_atmos.h"
 #include "piece_audio.h"
 #include "piece_text.h"
 #include "piece_video.h"
@@ -143,7 +143,7 @@ private:
        void bitmap_text_start (std::weak_ptr<Piece>, PieceBitmapTextStart);
        void string_text_start (std::weak_ptr<Piece>, PieceStringTextStart);
        void subtitle_stop (std::weak_ptr<Piece>, PieceTextStop);
-       void atmos (std::weak_ptr<Piece>, ContentAtmos);
+       void atmos (std::weak_ptr<Piece>, PieceAtmos);
 
        dcpomatic::DCPTime one_video_frame () const;
        void fill_audio (dcpomatic::DCPTimePeriod period);
@@ -220,4 +220,5 @@ private:
 
 std::vector<std::vector<std::shared_ptr<Content>>> collect (std::shared_ptr<const Film> film, ContentList content);
 
+
 #endif