X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplaylist.h;h=3829d6f31e9254367b006823aa44f8f000d477fe;hb=7ff262bc7a3e5ac16feab2fe7a0afbbe14c33896;hp=29a52d4339576e3eb2892759c20380cf9dcdb8f3;hpb=6bc12a2eeb9c84a539688f2f7eb876e3ea278a9f;p=dcpomatic.git diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 29a52d433..3829d6f31 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -17,79 +17,84 @@ */ -#include +#ifndef DCPOMATIC_PLAYLIST_H +#define DCPOMATIC_PLAYLIST_H + +#include "ffmpeg_content.h" +#include "audio_mapping.h" +#include "util.h" +#include "frame_rate_change.h" #include #include -#include "video_source.h" -#include "audio_source.h" -#include "video_sink.h" -#include "audio_sink.h" -#include "ffmpeg_content.h" +#include class Content; class FFmpegContent; class FFmpegDecoder; -class ImageMagickContent; -class ImageMagickDecoder; +class StillImageMagickContent; +class StillImageMagickDecoder; class SndfileContent; class SndfileDecoder; class Job; class Film; +class Region; -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; - - enum VideoFrom { - VIDEO_NONE, - VIDEO_FFMPEG, - VIDEO_IMAGEMAGICK - }; - - enum AudioFrom { - AUDIO_NONE, - AUDIO_FFMPEG, - AUDIO_SNDFILE - }; - - VideoFrom video_from () const { - return _video_from; - } - - AudioFrom audio_from () const { - return _audio_from; - } - - boost::shared_ptr ffmpeg () const { - return _ffmpeg; - } - - std::list > imagemagick () const { - return _imagemagick; - } - - std::list > sndfile () const { - return _sndfile; - } - -private: - VideoFrom _video_from; - AudioFrom _audio_from; + void as_xml (xmlpp::Node *); + void set_from_xml (boost::shared_ptr, cxml::ConstNodePtr, int, std::list &); + + 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); - boost::shared_ptr _ffmpeg; - std::list > _imagemagick; - std::list > _sndfile; + ContentList content () const; + + std::string video_identifier () const; + + DCPTime length () const; + + int best_dcp_frame_rate () const; + DCPTime video_end () const; + FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const; + + void set_sequence_video (bool); + void maybe_sequence_video (); + + void repeat (ContentList, int); + + /** Emitted when content has been added to or removed from the playlist */ + mutable boost::signals2::signal Changed; + /** 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; + +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