64 lines
1.1 KiB
PHP
64 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace NoccyLabs\PulseAudio\Sink;
|
|
|
|
use NoccyLabs\PulseAudio\Helper\Pacmd;
|
|
use ArrayAccess;
|
|
use ArrayIterator;
|
|
use IteratorAggregate;
|
|
use Countable;
|
|
|
|
class SinkInputList implements ArrayAccess, IteratorAggregate, Countable
|
|
{
|
|
protected $inputs = [];
|
|
|
|
public function __construct()
|
|
{
|
|
$inputs = Pacmd::query("list-sink-inputs");
|
|
foreach ($inputs as $index=>$input) {
|
|
$this->inputs[] = new SinkInput($index, $input);
|
|
}
|
|
}
|
|
|
|
public function createSink($name)
|
|
{
|
|
|
|
}
|
|
|
|
public function destroySink($id)
|
|
{}
|
|
|
|
public function getIterator()
|
|
{
|
|
return new ArrayIterator($this->inputs);
|
|
}
|
|
|
|
public function offsetGet($key)
|
|
{
|
|
foreach ($this->inputs as $input) {
|
|
if ($input->getIndex() == $key) {
|
|
return $input;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public function offsetSet($key, $value)
|
|
{}
|
|
|
|
public function offsetUnset($key)
|
|
{}
|
|
|
|
public function offsetExists($key)
|
|
{
|
|
return array_key_exists($key, $this->inputs);
|
|
}
|
|
|
|
public function count()
|
|
{
|
|
return count($this->inputs);
|
|
}
|
|
|
|
}
|
|
|