X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplaylist.h;h=2d243fe8f0e84060b0ffa20b93a96d08fbf7af31;hb=09a9ac376db005a40a351736bcff4077f098825d;hp=d374dc98c8ec131df3aadaa68c4fe03b1f5f00b1;hpb=a054c067ab2cbf6c5abc5df4caa08ffaac206f0b;p=dcpomatic.git diff --git a/src/lib/playlist.h b/src/lib/playlist.h index d374dc98c..2d243fe8f 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -17,13 +17,14 @@ */ +#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" class Content; class FFmpegContent; @@ -34,61 +35,70 @@ class SndfileContent; class SndfileDecoder; class Job; class Film; +class Region; + +/** @class Playlist + * @brief A set of content files (video and audio), with knowledge of how they should be arranged into + * a DCP. + * + * This class holds Content objects, and it knows how they should be arranged. At the moment + * the ordering is implicit; video content is placed sequentially, and audio content is taken + * from the video unless any sound-only files are present. If sound-only files exist, they + * are played simultaneously (i.e. they can be split up into multiple files for different channels) + */ + +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 { public: - Playlist (boost::shared_ptr, std::list >); + Playlist (); + Playlist (boost::shared_ptr); + ~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; - ContentVideoFrame video_length () const; + void as_xml (xmlpp::Node *); + void set_from_xml (boost::shared_ptr, boost::shared_ptr); - void disable_video (); - void disable_audio (); - void disable_subtitles (); - void disable_video_sync (); + void add (boost::shared_ptr); + void remove (boost::shared_ptr); - bool pass (); - void set_progress (boost::shared_ptr); - bool seek (double); - bool seek_to_last (); + bool has_subtitles () const; -private: - void process_video (boost::shared_ptr i, bool same, boost::shared_ptr s); - void process_audio (boost::shared_ptr); - void setup_decoders (); + typedef std::vector > ContentList; - boost::shared_ptr _film; + ContentList content () const { + return _content; + } + + std::string video_digest () const; - enum { - VIDEO_NONE, - VIDEO_FFMPEG, - VIDEO_IMAGEMAGICK - } _video_from; + int loop () const { + return _loop; + } - enum { - AUDIO_NONE, - AUDIO_FFMPEG, - AUDIO_SNDFILE - } _audio_from; - - boost::shared_ptr _ffmpeg; - std::list > _imagemagick; - std::list > _sndfile; - - bool _have_setup_decoders; - boost::shared_ptr _ffmpeg_decoder; - bool _ffmpeg_decoder_done; - std::list > _imagemagick_decoders; - std::list >::iterator _imagemagick_decoder; - std::list > _sndfile_decoders; - - bool _video_sync; + void set_loop (int l); + + Time length () const; + int best_dcp_frame_rate () const; + Time video_end () const; + + void set_sequence_video (bool); + + mutable boost::signals2::signal Changed; + mutable boost::signals2::signal, int)> ContentChanged; + +private: + void content_changed (boost::weak_ptr, int); + void reconnect (); + + ContentList _content; + int _loop; + bool _sequence_video; + bool _sequencing_video; + std::list _content_connections; }; + +#endif