]> git.tdb.fi Git - xinema.git/blobdiff - remote/source/streamcontrolitem.cpp
Display stream size and codecs on the playback page
[xinema.git] / remote / source / streamcontrolitem.cpp
index a225d52494f2366c63494c7015de75706a48846b..3bd94b87f445b8d9911c1e8f5acafd27f1e24a93 100644 (file)
@@ -15,21 +15,57 @@ void StreamControlItem::set_control(XinemaControlItem *c)
        if(control)
        {
                XinemaControl &xc = control->get_control();
+               connect(&xc, &XinemaControl::playback_state_changed, this, &StreamControlItem::playback_state_changed);
                connect(&xc, &XinemaControl::title_changed, this, &StreamControlItem::title_changed);
                connect(&xc, &XinemaControl::duration_changed, this, &StreamControlItem::duration_changed);
                connect(&xc, &XinemaControl::position_changed, this, &StreamControlItem::position_changed);
+               connect(&xc, &XinemaControl::size_changed, this, &StreamControlItem::size_changed);
+               connect(&xc, &XinemaControl::framerate_changed, this, &StreamControlItem::framerate_changed);
+               connect(&xc, &XinemaControl::codecs_changed, this, &StreamControlItem::codecs_changed);
+               connect(&xc, &XinemaControl::channels_changed, this, &StreamControlItem::control_channels_changed);
+               connect(&xc, &XinemaControl::current_audio_channel_changed, this, &StreamControlItem::current_audio_channel_changed);
+               connect(&xc, &XinemaControl::current_spu_channel_changed, this, &StreamControlItem::current_spu_channel_changed);
        }
 
        emit control_changed();
 
        if(control)
        {
+               emit playback_state_changed();
                emit title_changed();
                emit duration_changed();
                emit position_changed();
+               emit size_changed();
+               emit framerate_changed();
+               emit codecs_changed();
+               emit channels_changed();
+               emit current_audio_channel_changed();
+               emit current_spu_channel_changed();
        }
 }
 
+StreamControlItem::PlaybackState StreamControlItem::get_playback_state() const
+{
+       if(!control)
+               return Stopped;
+
+       return static_cast<PlaybackState>(control->get_control().get_playback_state());
+}
+
+void StreamControlItem::set_playback_state(PlaybackState state)
+{
+       if(!control)
+               return;
+
+       XinemaControl &xc = control->get_control();
+       if(state==Stopped)
+               xc.stop();
+       else if(state==Paused)
+               xc.pause();
+       else if(state==Playing)
+               xc.play();
+}
+
 QString StreamControlItem::get_title() const
 {
        if(!control)
@@ -46,6 +82,12 @@ float StreamControlItem::get_duration() const
        return control->get_control().get_duration();
 }
 
+void StreamControlItem::set_position(float pos)
+{
+       if(control)
+               control->get_control().seek(pos);
+}
+
 float StreamControlItem::get_position() const
 {
        if(!control)
@@ -53,3 +95,86 @@ float StreamControlItem::get_position() const
 
        return control->get_control().get_position();
 }
+
+QSize StreamControlItem::get_video_size() const
+{
+       if(!control)
+               return QSize();
+
+       return control->get_control().get_video_size();
+}
+
+float StreamControlItem::get_framerate() const
+{
+       if(!control)
+               return 0.0f;
+
+       return control->get_control().get_framerate();
+}
+
+QString StreamControlItem::get_video_codec() const
+{
+       if(!control)
+               return QString();
+
+       return control->get_control().get_video_codec();
+}
+
+QString StreamControlItem::get_audio_codec() const
+{
+       if(!control)
+               return QString();
+
+       return control->get_control().get_audio_codec();
+}
+
+QStringList StreamControlItem::get_audio_channels() const
+{
+       if(!control)
+               return QStringList();
+
+       return control->get_control().get_audio_channels();
+}
+
+QStringList StreamControlItem::get_spu_channels() const
+{
+       if(!control)
+               return QStringList();
+
+       return control->get_control().get_spu_channels();
+}
+
+void StreamControlItem::select_audio_channel(int chan)
+{
+       if(control)
+               control->get_control().select_audio_channel(chan);
+}
+
+void StreamControlItem::select_spu_channel(int chan)
+{
+       if(control)
+               control->get_control().select_spu_channel(chan);
+}
+
+int StreamControlItem::get_current_audio_channel() const
+{
+       if(!control)
+               return -1;
+
+       return control->get_control().get_current_audio_channel();
+}
+
+int StreamControlItem::get_current_spu_channel() const
+{
+       if(!control)
+               return -1;
+
+       return control->get_control().get_current_spu_channel();
+}
+
+void StreamControlItem::control_channels_changed()
+{
+       emit channels_changed();
+       emit current_audio_channel_changed();
+       emit current_spu_channel_changed();
+}