From: Mikko Rasa Date: Fri, 16 Oct 2015 15:29:29 +0000 (+0300) Subject: Hook up any new clients to an existing stream X-Git-Url: http://git.tdb.fi/?p=xinema.git;a=commitdiff_plain;h=0ebb4044ca544358d6d944a89fd9f6e806528be4 Hook up any new clients to an existing stream --- diff --git a/source/client.cpp b/source/client.cpp index f042c66..47f8186 100644 --- a/source/client.cpp +++ b/source/client.cpp @@ -17,6 +17,9 @@ Client::Client(Xinema &x, Net::StreamSocket *s): socket->signal_end_of_file.connect(sigc::mem_fun(this, &Client::end_of_stream)); xinema.signal_stream_created.connect(sigc::mem_fun(this, &Client::stream_created)); + XineStream *stream = xinema.get_stream(); + if(stream) + stream_created(*stream); } void Client::data_available() @@ -96,6 +99,8 @@ void Client::stream_created(XineStream &stream) string title = stream.get_title(); if(!title.empty()) send_reply("title "+title); + if(const Time::TimeDelta &dur = stream.get_duration()) + stream_duration_changed(dur); } void Client::stream_title_changed(const string &title) diff --git a/source/xinema.h b/source/xinema.h index 3a2bae1..ce0345d 100644 --- a/source/xinema.h +++ b/source/xinema.h @@ -36,6 +36,7 @@ private: public: void play_file(const Msp::FS::Path &); + XineStream *get_stream() const { return stream; } }; #endif