X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fxinestream.cpp;h=5614dd00838324e29a3483e70e16459792a02770;hb=3bd92c1fa7a85b47356cd6f2bad23893955a0785;hp=69a0c1f44bdf90e69be4d22e4928af5a21843f3b;hpb=2077f6b76cb7cd8e4095b4421d2c67c50752d6b7;p=xinema.git diff --git a/source/xinestream.cpp b/source/xinestream.cpp index 69a0c1f..5614dd0 100644 --- a/source/xinestream.cpp +++ b/source/xinestream.cpp @@ -13,6 +13,8 @@ XineStream::XineStream(XineEngine &e, const string &mrl): queue = xine_event_new_queue(stream); + check_info(); + engine.add_stream(*this); } @@ -42,6 +44,41 @@ void XineStream::tick() handle_event(*event); xine_event_free(event); } + + check_info(); +} + +void XineStream::check_info() +{ + const char *xt = xine_get_meta_info(stream, XINE_META_INFO_TITLE); + if(xt) + { + if(title.compare(xt)) + { + title = xt; + signal_title_changed.emit(title); + } + } + else if(!title.empty()) + { + title.clear(); + signal_title_changed.emit(title); + } + + int dur_msec, pos_msec; + xine_get_pos_length(stream, 0, &pos_msec, &dur_msec); + Time::TimeDelta dur = dur_msec*Time::msec; + Time::TimeDelta pos = pos_msec*Time::msec; + if(dur!=duration) + { + duration = dur; + signal_duration_changed.emit(duration); + } + if(pos!=position) + { + position = pos; + signal_position_changed.emit(position); + } } void XineStream::handle_event(const xine_event_t &event)