X-Git-Url: http://git.tdb.fi/?p=xinema.git;a=blobdiff_plain;f=source%2Fclient.cpp;h=604779662b5f0fc6944bf07542bd686ce390bdfb;hp=8c84e26a7f371a1da9da0f9fdc7bb00488339382;hb=a4982bb4d3fd9908aa01c824ac6202ac8618ac24;hpb=493b09323c6b07ea66ba3f4725c1f1831fd98222 diff --git a/source/client.cpp b/source/client.cpp index 8c84e26..6047796 100644 --- a/source/client.cpp +++ b/source/client.cpp @@ -94,6 +94,10 @@ void Client::process_command(const string &cmd) get_stream().pause(); else if(keyword=="stop") get_stream().stop(); + else if(keyword=="select_audio") + set_audio_channel(args); + else if(keyword=="select_spu") + set_spu_channel(args); else throw runtime_error("Invalid command"); } @@ -126,12 +130,31 @@ void Client::list_directory(const FS::Path &dn) } } +void Client::set_audio_channel(const string &arg) +{ + XineStream &stream = get_stream(); + if(arg=="off") + stream.set_audio_off(); + else + stream.set_audio_channel(lexical_cast(arg)); +} + +void Client::set_spu_channel(const string &arg) +{ + XineStream &stream = get_stream(); + if(arg=="off") + stream.set_spu_off(); + else + stream.set_spu_channel(lexical_cast(arg)); +} + void Client::stream_created(XineStream &stream) { stream.signal_state_changed.connect(sigc::mem_fun(this, &Client::stream_state_changed)); stream.signal_title_changed.connect(sigc::mem_fun(this, &Client::stream_title_changed)); stream.signal_duration_changed.connect(sigc::mem_fun(this, &Client::stream_duration_changed)); stream.signal_position_changed.connect(sigc::mem_fun(this, &Client::stream_position_changed)); + stream.signal_channels_changed.connect(sigc::mem_fun(this, &Client::stream_channels_changed)); MutexLock lock(stream.get_mutex()); stream_state_changed(stream.get_state()); @@ -142,6 +165,8 @@ void Client::stream_created(XineStream &stream) if(const Time::TimeDelta &dur = stream.get_duration()) stream_duration_changed(dur); + + stream_channels_changed(); } void Client::stream_destroyed() @@ -172,3 +197,20 @@ void Client::stream_position_changed(const Time::TimeDelta &pos) last_position = pos; } } + +void Client::stream_channels_changed() +{ + XineStream &stream = get_stream(); + + const vector &audio_channels = stream.get_audio_channels(); + send_reply(format("audio_count %d", audio_channels.size())); + for(unsigned i=0; i &spu_channels = stream.get_spu_channels(); + send_reply(format("spu_count %d", spu_channels.size())); + for(unsigned i=0; i