From f68b82c43c5ce988a11d16f537c1e0ab178089b5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 4 May 2021 13:34:50 +0200 Subject: [PATCH] Rename ContentAtmos -> PieceAtmos and pass atmos through Piece. --- src/lib/atmos_decoder.cc | 2 +- src/lib/atmos_decoder.h | 4 ++-- src/lib/piece.cc | 13 +++++++++++++ src/lib/piece.h | 3 +++ src/lib/{content_atmos.h => piece_atmos.h} | 16 ++++++++++------ src/lib/player.cc | 13 +++++-------- src/lib/player.h | 7 ++++--- 7 files changed, 38 insertions(+), 20 deletions(-) rename src/lib/{content_atmos.h => piece_atmos.h} (79%) 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/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/content_atmos.h b/src/lib/piece_atmos.h similarity index 79% rename from src/lib/content_atmos.h rename to src/lib/piece_atmos.h index 891ca3b83..1fa927243 100644 --- a/src/lib/content_atmos.h +++ b/src/lib/piece_atmos.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Carl Hetherington + Copyright (C) 2020-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,20 +18,23 @@ */ -#ifndef DCPOMATIC_CONTENT_ATMOS_H -#define DCPOMATIC_CONTENT_ATMOS_H + +#ifndef DCPOMATIC_PIECE_ATMOS_H +#define DCPOMATIC_PIECE_ATMOS_H + #include "atmos_metadata.h" #include "types.h" #include -/** @class ContentAtmos + +/** @class PieceAtmos * @brief Some Atmos data that has come out of a decoder. */ -class ContentAtmos +class PieceAtmos { public: - ContentAtmos (std::shared_ptr data_, Frame frame_, AtmosMetadata metadata_) + PieceAtmos (std::shared_ptr data_, Frame frame_, AtmosMetadata metadata_) : data (data_) , frame (frame_) , metadata (metadata_) @@ -42,4 +45,5 @@ public: 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 -- 2.30.2