X-Git-Url: http://git.tdb.fi/?p=xinema.git;a=blobdiff_plain;f=source%2Fxinestream.cpp;h=2d2c058be2cf91f4520175570c0a28fee141b3ca;hp=4fc2e88fa1f569bcf2ef811117d2a02eb8bbef11;hb=60cd42dc4fdb1fdfa438402956e7342a01fc8677;hpb=afa557f5c0b0debaaaf6c4c777ccc2ba10965c50 diff --git a/source/xinestream.cpp b/source/xinestream.cpp index 4fc2e88..2d2c058 100644 --- a/source/xinestream.cpp +++ b/source/xinestream.cpp @@ -10,6 +10,9 @@ XineStream::XineStream(XineEngine &e, const string &mrl): filename(mrl.substr(mrl.rfind('/')+1)), state(STOPPED), title(filename), + video_width(0), + video_height(0), + framerate(0.0f), current_audio(0), current_spu(OFF), channels_changed(false) @@ -120,16 +123,51 @@ void XineStream::tick() update_info(); } +bool XineStream::equals(const string &s1, const char *s2) +{ + if(!s2) + return s1.empty(); + return !s1.compare(s2); +} + void XineStream::update_info() { const char *xt = xine_get_meta_info(stream, XINE_META_INFO_TITLE); - if((xt && title.compare(xt)) || (!xt && !title.empty())) + if(!equals(title, xt)) { MutexLock lock(mutex); title = (xt ? xt : string()); signal_title_changed.emit(get_title()); } + unsigned w = xine_get_stream_info(stream, XINE_STREAM_INFO_VIDEO_WIDTH); + unsigned h = xine_get_stream_info(stream, XINE_STREAM_INFO_VIDEO_HEIGHT); + if(w!=video_width || h!=video_height) + { + MutexLock lock(mutex); + video_width = w; + video_height = h; + signal_video_size_changed.emit(video_width, video_height); + } + + float fps = 90000.0f/xine_get_stream_info(stream, XINE_STREAM_INFO_FRAME_DURATION); + if(fps!=framerate) + { + MutexLock lock(mutex); + framerate = fps; + signal_framerate_changed.emit(framerate); + } + + const char *xvc = xine_get_meta_info(stream, XINE_META_INFO_VIDEOCODEC); + const char *xac = xine_get_meta_info(stream, XINE_META_INFO_AUDIOCODEC); + if(!equals(video_codec, xvc) || !equals(audio_codec, xac)) + { + MutexLock lock(mutex); + video_codec = (xvc ? xvc : string()); + audio_codec = (xac ? xac : string()); + signal_codecs_changed.emit(video_codec, audio_codec); + } + int dur_msec, pos_msec; xine_get_pos_length(stream, 0, &pos_msec, &dur_msec); Time::TimeDelta dur = dur_msec*Time::msec;