X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplaylist.h;h=9e3dbb6dfbf39ccf2f6f6864d1ee2920983ff447;hb=c6c082c4a8016f85ba4207f4b8ccee1d5770e4a4;hp=b42d46036bb9e37b2c5679c8bd4c503549d6f9b0;hpb=127672223cca569986e35c91265e269ed5a6561c;p=dcpomatic.git diff --git a/src/lib/playlist.h b/src/lib/playlist.h index b42d46036..9e3dbb6df 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -17,66 +17,84 @@ */ +#ifndef DCPOMATIC_PLAYLIST_H +#define DCPOMATIC_PLAYLIST_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" +#include "util.h" +#include "frame_rate_change.h" class Content; class FFmpegContent; class FFmpegDecoder; -class ImageMagickContent; -class ImageMagickDecoder; +class StillImageMagickContent; +class StillImageMagickDecoder; class SndfileContent; class SndfileDecoder; class Job; class Film; +class Region; + +struct ContentSorter +{ + bool operator() (boost::shared_ptr a, boost::shared_ptr b); +}; -class Playlist : public VideoSource, public AudioSource, public VideoSink, public AudioSink, public boost::enable_shared_from_this +/** @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 (boost::shared_ptr, std::list >); + Playlist (); + ~Playlist (); - 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; + void as_xml (xmlpp::Node *); + void set_from_xml (boost::shared_ptr, cxml::ConstNodePtr, int, std::list &); - void disable_video (); + 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); - bool pass (); - void set_progress (boost::shared_ptr); + ContentList content () const; -private: - void process_video (boost::shared_ptr i, bool same, boost::shared_ptr s); - void process_audio (boost::shared_ptr); + std::string video_identifier () const; + + DCPTime length () const; - enum { - VIDEO_NONE, - VIDEO_FFMPEG, - VIDEO_IMAGEMAGICK - } _video_from; + 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; - enum { - AUDIO_NONE, - AUDIO_FFMPEG, - AUDIO_SNDFILE - } _audio_from; - - boost::shared_ptr _ffmpeg; - std::list > _imagemagick; - std::list > _sndfile; - - boost::shared_ptr _ffmpeg_decoder; - bool _ffmpeg_decoder_done; - std::list > _imagemagick_decoders; - std::list >::iterator _imagemagick_decoder; - std::list > _sndfile_decoders; +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