From f68b82c43c5ce988a11d16f537c1e0ab178089b5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 4 May 2021 13:34:50 +0200 Subject: Rename ContentAtmos -> PieceAtmos and pass atmos through Piece. --- src/lib/atmos_decoder.cc | 2 +- src/lib/atmos_decoder.h | 4 ++-- src/lib/content_atmos.h | 45 -------------------------------------------- src/lib/piece.cc | 13 +++++++++++++ src/lib/piece.h | 3 +++ src/lib/piece_atmos.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/player.cc | 13 +++++-------- src/lib/player.h | 7 ++++--- 8 files changed, 77 insertions(+), 59 deletions(-) delete mode 100644 src/lib/content_atmos.h create mode 100644 src/lib/piece_atmos.h diff --git a/src/lib/atmos_decoder.cc b/src/lib/atmos_decoder.cc index 478c45809..1b3e3503a 100644 --- a/src/lib/atmos_decoder.cc +++ b/src/lib/atmos_decoder.cc @@ -48,7 +48,7 @@ AtmosDecoder::seek () void AtmosDecoder::emit (shared_ptr film, shared_ptr 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()); } diff --git a/src/lib/atmos_decoder.h b/src/lib/atmos_decoder.h index 1ec1b8a6c..6e1d18680 100644 --- a/src/lib/atmos_decoder.h +++ b/src/lib/atmos_decoder.h @@ -20,8 +20,8 @@ #include "atmos_metadata.h" -#include "content_atmos.h" #include "decoder_part.h" +#include "piece_atmos.h" #include @@ -38,7 +38,7 @@ public: void emit (std::shared_ptr film, std::shared_ptr data, Frame frame, AtmosMetadata metadata); - boost::signals2::signal Data; + boost::signals2::signal, Frame, AtmosMetadata)> Data; private: std::shared_ptr _content; diff --git a/src/lib/content_atmos.h b/src/lib/content_atmos.h deleted file mode 100644 index 891ca3b83..000000000 --- a/src/lib/content_atmos.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2020 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_CONTENT_ATMOS_H -#define DCPOMATIC_CONTENT_ATMOS_H - -#include "atmos_metadata.h" -#include "types.h" -#include - -/** @class ContentAtmos - * @brief Some Atmos data that has come out of a decoder. - */ -class ContentAtmos -{ -public: - ContentAtmos (std::shared_ptr data_, Frame frame_, AtmosMetadata metadata_) - : data (data_) - , frame (frame_) - , metadata (metadata_) - {} - - std::shared_ptr data; - Frame frame; - AtmosMetadata metadata; -}; - -#endif diff --git a/src/lib/piece.cc b/src/lib/piece.cc index 69469c02e..452b34222 100644 --- a/src/lib/piece.cc +++ b/src/lib/piece.cc @@ -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 film, shared_ptr 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 content, weak_ptr text, } +void +Piece::atmos (shared_ptr data, Frame frame, AtmosMetadata metadata) +{ + Atmos (PieceAtmos(data, frame, metadata)); +} + + void Piece::update_pull_to (DCPTime& pull_to) const { diff --git a/src/lib/piece.h b/src/lib/piece.h index 2e4eded89..2586bb1d0 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -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 BitmapTextStart; boost::signals2::signal StringTextStart; boost::signals2::signal TextStop; + boost::signals2::signal Atmos; private: friend struct overlap_video_test1; @@ -102,6 +104,7 @@ private: void bitmap_start (std::weak_ptr content, std::weak_ptr text, dcpomatic::ContentTime time, std::shared_ptr image, dcpomatic::Rect area); void string_start (std::weak_ptr content, std::weak_ptr text, dcpomatic::ContentTime time, std::list subs); void stop (std::weak_ptr content, std::weak_ptr text, dcpomatic::ContentTime time); + void atmos (std::shared_ptr 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 index 000000000..1fa927243 --- /dev/null +++ b/src/lib/piece_atmos.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2020-2021 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_PIECE_ATMOS_H +#define DCPOMATIC_PIECE_ATMOS_H + + +#include "atmos_metadata.h" +#include "types.h" +#include + + +/** @class PieceAtmos + * @brief Some Atmos data that has come out of a decoder. + */ +class PieceAtmos +{ +public: + PieceAtmos (std::shared_ptr data_, Frame frame_, AtmosMetadata metadata_) + : data (data_) + , frame (frame_) + , metadata (metadata_) + {} + + std::shared_ptr data; + Frame frame; + AtmosMetadata metadata; +}; + + +#endif diff --git a/src/lib/player.cc b/src/lib/player.cc index ad23ea47d..590fddb7c 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -293,13 +293,10 @@ Player::setup_pieces_unlocked () piece->Audio.connect (bind(&Player::audio, this, weak_ptr(piece), _1)); } - piece->BitmapTextStart.connect (bind(&Player::bitmap_text_start, this, weak_ptr(piece), _1)); - piece->StringTextStart.connect (bind(&Player::string_text_start, this, weak_ptr(piece), _1)); - piece->TextStop.connect (bind(&Player::subtitle_stop, this, weak_ptr(piece), _1)); - - if (decoder->atmos) { - decoder->atmos->Data.connect (bind(&Player::atmos, this, weak_ptr(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, ContentAtmos data) +Player::atmos (weak_ptr, PieceAtmos data) { Atmos (data.data, DCPTime::from_frames(data.frame, _film->video_frame_rate()), data.metadata); } diff --git a/src/lib/player.h b/src/lib/player.h index d7e297985..eb38bc46f 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2020 Carl Hetherington + Copyright (C) 2013-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -28,10 +28,10 @@ #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, PieceBitmapTextStart); void string_text_start (std::weak_ptr, PieceStringTextStart); void subtitle_stop (std::weak_ptr, PieceTextStop); - void atmos (std::weak_ptr, ContentAtmos); + void atmos (std::weak_ptr, PieceAtmos); dcpomatic::DCPTime one_video_frame () const; void fill_audio (dcpomatic::DCPTimePeriod period); @@ -220,4 +220,5 @@ private: std::vector>> collect (std::shared_ptr film, ContentList content); + #endif -- cgit v1.2.3