X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.h;h=cce2bdc21a600ac3e61b59e40d997c0d876985bf;hb=f385ef03e5ea27519a31c0839447735a7fba0602;hp=8a82ab2980b644e408d35b48f37f0921f2d5e749;hpb=b66010a281acd3e3e58ef7202bce55023fc29d7f;p=dcpomatic.git diff --git a/src/lib/player.h b/src/lib/player.h index 8a82ab298..cce2bdc21 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -1,3 +1,5 @@ +/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */ + /* Copyright (C) 2013 Carl Hetherington @@ -17,8 +19,8 @@ */ -#ifndef DVDOMATIC_PLAYER_H -#define DVDOMATIC_PLAYER_H +#ifndef DCPOMATIC_PLAYER_H +#define DCPOMATIC_PLAYER_H #include #include @@ -27,15 +29,20 @@ #include "audio_source.h" #include "video_sink.h" #include "audio_sink.h" +#include "playlist.h" +#include "audio_buffers.h" -class VideoDecoder; -class SndfileDecoder; class Job; class Film; class Playlist; class AudioContent; +class Piece; -class Player : public VideoSource, public AudioSource, public VideoSink, public boost::enable_shared_from_this +/** @class Player + * @brief A class which can `play' a Playlist; emitting its audio and video. + */ + +class Player : public VideoSource, public AudioSource, public boost::enable_shared_from_this { public: Player (boost::shared_ptr, boost::shared_ptr); @@ -43,20 +50,27 @@ public: void disable_video (); void disable_audio (); void disable_subtitles (); - void disable_video_sync (); bool pass (); - void set_progress (boost::shared_ptr); - bool seek (double); + void seek (Time); + void seek_back (); + void seek_forward (); - double last_video_time () const; + Time position () const { + return _position; + } private: - void process_video (boost::shared_ptr i, bool same, boost::shared_ptr s); - void process_audio (boost::weak_ptr, boost::shared_ptr); - void setup_decoders (); + + void process_video (boost::weak_ptr, boost::shared_ptr, bool, Time); + void process_audio (boost::weak_ptr, boost::shared_ptr, Time); + void setup_pieces (); void playlist_changed (); void content_changed (boost::weak_ptr, int); + void do_seek (Time, bool); + void add_black_piece (Time, Time); + void add_silent_piece (Time, Time); + void flush (); boost::shared_ptr _film; boost::shared_ptr _playlist; @@ -64,15 +78,13 @@ private: bool _video; bool _audio; bool _subtitles; - - bool _have_valid_decoders; - std::list > _video_decoders; - std::list >::iterator _video_decoder; - std::list > _sndfile_decoders; - - boost::shared_ptr _sndfile_buffers; - bool _video_sync; + /** Our pieces are ready to go; if this is false the pieces must be (re-)created before they are used */ + bool _have_valid_pieces; + std::list > _pieces; + Time _position; + AudioBuffers _audio_buffers; + Time _next_audio; }; #endif