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);
if(control)
{
+ emit playback_state_changed();
emit title_changed();
emit duration_changed();
emit position_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)
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)