+ else if(keyword=="state")
+ {
+ if(args=="STOPPED")
+ playback_state = STOPPED;
+ else if(args=="PAUSED")
+ playback_state = PAUSED;
+ else if(args=="PLAYING")
+ playback_state = PLAYING;
+ emit playback_state_changed(playback_state);
+ }
+ else if(keyword=="title")
+ {
+ title = args;
+ emit title_changed(title);
+ }
+ else if(keyword=="duration")
+ {
+ duration = args.toFloat();
+ emit duration_changed(duration);
+ }
+ else if(keyword=="position")
+ {
+ position = args.toFloat();
+ emit position_changed(position);
+ }
+ else if(keyword=="audio_count")
+ resize_list(audio_channels, args.toInt());
+ else if(keyword=="audio")
+ {
+ space = args.indexOf(' ');
+ audio_channels[args.mid(0, space).toInt()] = args.mid(space+1);
+ }
+ else if(keyword=="spu_count")
+ resize_list(spu_channels, args.toInt());
+ else if(keyword=="spu")
+ {
+ space = args.indexOf(' ');
+ spu_channels[args.mid(0, space).toInt()] = args.mid(space+1);
+ }
+ else if(keyword=="channels_end")
+ emit channels_changed();
+ else if(keyword=="current_audio")
+ {
+ current_audio_channel = convert_channel(args);
+ emit current_audio_channel_changed(current_audio_channel);
+ }
+ else if(keyword=="current_spu")
+ {
+ current_spu_channel = convert_channel(args);
+ emit current_spu_channel_changed(current_spu_channel);
+ }
+}
+
+int XinemaControl::convert_channel(const QString &arg)
+{
+ if(arg=="off")
+ return OFF;
+ else
+ return arg.toInt();
+}
+
+void XinemaControl::resize_list(QStringList &list, int size)
+{
+ while(list.size()>size)
+ list.removeLast();
+ while(list.size()<size)
+ list.append(QString());