]> git.tdb.fi Git - xinema.git/blobdiff - source/xinestream.cpp
Inform clients of stream title changes
[xinema.git] / source / xinestream.cpp
index d152f518e2cb34941d24521d0e205ed04d532e1e..5614dd00838324e29a3483e70e16459792a02770 100644 (file)
@@ -13,6 +13,8 @@ XineStream::XineStream(XineEngine &e, const string &mrl):
 
        queue = xine_event_new_queue(stream);
 
+       check_info();
+
        engine.add_stream(*this);
 }
 
@@ -25,12 +27,6 @@ XineStream::~XineStream()
        xine_dispose(stream);
 }
 
-string XineStream::get_title() const
-{
-       const char *title = xine_get_meta_info(stream, XINE_META_INFO_TITLE);
-       return (title ? title : string());
-}
-
 void XineStream::play()
 {
        xine_play(stream, 0, 0);
@@ -49,6 +45,26 @@ void XineStream::tick()
                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;