X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplaylist.h;h=76055bea0341c6ac2c831a11c0cf417de91fce5a;hb=b85420b326b74c7c8125bf599993d71460ad881e;hp=1d189cb070be9077f0ac241fcbefcf190366ac03;hpb=e94cd129dcd66a76210880bfdf19d27f7992651b;p=dcpomatic.git diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 1d189cb07..76055bea0 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -17,89 +17,75 @@ */ -#include +#ifndef DCPOMATIC_PLAYLIST_H +#define DCPOMATIC_PLAYLIST_H + +#include "util.h" +#include "frame_rate_change.h" +#include #include -#include -#include "video_source.h" -#include "audio_source.h" -#include "video_sink.h" -#include "audio_sink.h" -#include "ffmpeg_content.h" -#include "audio_mapping.h" - -class Content; -class FFmpegContent; -class FFmpegDecoder; -class ImageMagickContent; -class ImageMagickDecoder; -class SndfileContent; -class SndfileDecoder; -class Job; +#include +#include + class Film; -class Playlist +struct ContentSorter +{ + bool operator() (boost::shared_ptr a, boost::shared_ptr b); +}; + +/** @class Playlist + * @brief A set of Content objects with knowledge of how they should be arranged into + * a DCP. + */ +class Playlist : public boost::noncopyable { public: Playlist (); + ~Playlist (); - void setup (ContentList); - - ContentAudioFrame audio_length () const; - int audio_channels () const; - int audio_frame_rate () const; - int64_t audio_channel_layout () const; - bool has_audio () const; - - float video_frame_rate () const; - libdcp::Size video_size () const; - ContentVideoFrame video_length () const; - - AudioMapping default_audio_mapping () const; + void as_xml (xmlpp::Node *); + void set_from_xml (boost::shared_ptr, cxml::ConstNodePtr, int, std::list &); - enum VideoFrom { - VIDEO_NONE, - VIDEO_FFMPEG, - VIDEO_IMAGEMAGICK - }; + void add (boost::shared_ptr); + void remove (boost::shared_ptr); + void remove (ContentList); + void move_earlier (boost::shared_ptr); + void move_later (boost::shared_ptr); - enum AudioFrom { - AUDIO_NONE, - AUDIO_FFMPEG, - AUDIO_SNDFILE - }; + ContentList content () const; - VideoFrom video_from () const { - return _video_from; - } + std::string video_identifier () const; - AudioFrom audio_from () const { - return _audio_from; - } + DCPTime length () const; + boost::optional start () const; - boost::shared_ptr ffmpeg () const { - return _ffmpeg; - } + int best_dcp_frame_rate () const; + DCPTime video_end () const; + FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const; - std::list > imagemagick () const { - return _imagemagick; - } + void set_sequence_video (bool); + void maybe_sequence_video (); - std::list > sndfile () const { - return _sndfile; - } + void repeat (ContentList, int); + /** Emitted when content has been added to or removed from the playlist */ mutable boost::signals2::signal Changed; - mutable boost::signals2::signal, int)> ContentChanged; - -private: - void content_changed (boost::weak_ptr, int); - - VideoFrom _video_from; - AudioFrom _audio_from; + /** Emitted when something about a piece of our content has changed; + * these emissions include when the position of the content changes. + * Third parameter is true if signals are currently being emitted frequently. + */ + mutable boost::signals2::signal, int, bool)> ContentChanged; - boost::shared_ptr _ffmpeg; - std::list > _imagemagick; - std::list > _sndfile; +private: + void content_changed (boost::weak_ptr, int, bool); + void reconnect (); + /** List of content. Kept sorted in position order. */ + ContentList _content; + bool _sequence_video; + bool _sequencing_video; std::list _content_connections; }; + +#endif