X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplaylist.h;h=cd902d223d0f0944f5fd550f60805d2f8546dc12;hb=853b8641ee7fb8348302c0daae838c4891769b1d;hp=c461151d458f6759b8e4faa33b5beb8fc8cdccef;hpb=9c3e4462d32c726a6c257b0a40e642ab23d9526a;p=dcpomatic.git diff --git a/src/lib/playlist.h b/src/lib/playlist.h index c461151d4..cd902d223 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -17,123 +17,80 @@ */ +#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; class FFmpegDecoder; -class ImageMagickContent; -class ImageMagickDecoder; +class StillImageMagickContent; +class StillImageMagickDecoder; 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. + */ + +struct ContentSorter +{ + bool operator() (boost::shared_ptr a, boost::shared_ptr b); +}; -class Playlist +class Playlist : public boost::noncopyable { public: Playlist (); + ~Playlist (); - void setup (ContentList); + void as_xml (xmlpp::Node *); + void set_from_xml (boost::shared_ptr, boost::shared_ptr); - 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; - - std::vector ffmpeg_subtitle_streams () const; - boost::optional ffmpeg_subtitle_stream () const; - std::vector ffmpeg_audio_streams () const; - boost::optional ffmpeg_audio_stream () 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 add (boost::shared_ptr); + void remove (boost::shared_ptr); + void remove (ContentList); - boost::shared_ptr _ffmpeg; - std::list > _imagemagick; - std::list > _sndfile; -}; + bool has_subtitles () const; -class Player : public VideoSource, public AudioSource, public VideoSink, public AudioSink, public boost::enable_shared_from_this -{ -public: - Player (boost::shared_ptr, boost::shared_ptr); + ContentList content () const; - void disable_video (); - void disable_audio (); - void disable_subtitles (); - void disable_video_sync (); + std::string video_identifier () const; - bool pass (); - void set_progress (boost::shared_ptr); - bool seek (double); - bool seek_to_last (); + Time length () const; + + int best_dcp_frame_rate () const; + Time video_end () const; - double last_video_time () const; + void set_sequence_video (bool); + void maybe_sequence_video (); -private: - void process_video (boost::shared_ptr i, bool same, boost::shared_ptr s); - void process_audio (boost::shared_ptr); - void setup_decoders (); + void repeat (ContentList, int); - boost::shared_ptr _film; - boost::shared_ptr _playlist; - - bool _video; - bool _audio; - bool _subtitles; + mutable boost::signals2::signal Changed; + /** Third parameter is true if signals are currently being emitted frequently */ + mutable boost::signals2::signal, int, bool)> ContentChanged; - 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; +private: + void content_changed (boost::weak_ptr, int, bool); + void reconnect (); + + ContentList _content; + bool _sequence_video; + bool _sequencing_video; + std::list _content_connections; + mutable boost::mutex _mutex; }; + +#endif