net.sf.fmj.media.MergingCaptureDevicePushBufferDataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fmj Show documentation
Show all versions of fmj Show documentation
Freedom for Media in Java
package net.sf.fmj.media;
import java.util.*;
import javax.media.*;
import javax.media.control.*;
import javax.media.protocol.*;
/**
* Merges multiple {@link PushBufferDataSource} that implement
* {@link CaptureDevice}.
*
* @author Ken Larson
*
*/
public class MergingCaptureDevicePushBufferDataSource extends
MergingPushBufferDataSource implements CaptureDevice
{
public MergingCaptureDevicePushBufferDataSource(
List sources)
{
super(sources);
for (DataSource source : sources)
{
if (!(source instanceof CaptureDevice))
throw new IllegalArgumentException();
}
}
public CaptureDeviceInfo getCaptureDeviceInfo()
{
throw new UnsupportedOperationException(); // TODO
}
public FormatControl[] getFormatControls()
{
final List formatControls = new ArrayList();
for (DataSource source : sources)
{
for (FormatControl formatControl : ((CaptureDevice) source)
.getFormatControls())
formatControls.add(formatControl);
}
return formatControls.toArray(new FormatControl[0]);
}
}