本文整理汇总了Java中javax.media.Control类的典型用法代码示例。如果您正苦于以下问题:Java Control类的具体用法?Java Control怎么用?Java Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Control类属于javax.media包,在下文中一共展示了Control类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getControl
import javax.media.Control; //导入依赖的package包/类
/**
* Get the Control that supports the class or interface
* specified. The full class or interface name should be
* specified. Null is returned if the Control is not
* supported.
*
* @return Control for the given class or interface
* name, or null if no such Control is supported.
*/
public Control getControl(String forName) {
Class c;
try {
c = Class.forName(forName);
} catch(Exception e) {
return null;
}
synchronized(controls) {
for(int i = 0, n = controls.size(); i < n; i++) {
Control control = (Control)controls.elementAt(i);
if( c.isInstance(control) ) {
return control;
}
}
}
return null;
}
示例2: showControls
import javax.media.Control; //导入依赖的package包/类
/**
* Displays each Control not currently being shown.
*/
public static void showControls(Controller controller) {
// Show all Controls not yet being shown
Control[] controls = controller.getControls();
for(int i = 0; i < controls.length; i++) {
Component c =
controls[i].getControlComponent();
if( c != null && ! c.isShowing() ) {
JFrame frame = new JFrame(
controls[i].getClass().getName() );
frame.getContentPane().add(c);
frame.pack();
frame.setVisible(true);
}
}
}
示例3: select
import javax.media.Control; //导入依赖的package包/类
public void select(Locator component)
throws InvalidLocatorException, InvalidServiceComponentException,
InsufficientResourcesException, SecurityException {
if (!checkLocator(component))
throw new InvalidLocatorException(component);
Control control = getControl((BDLocator)component);
if (control == null)
throw new InvalidLocatorException(component);
if (!(control instanceof StreamControl))
return;
int stream = getStream((BDLocator)component);
if (stream <= 0)
throw new InvalidLocatorException(component);
try {
((StreamControl)control).selectStreamNumber(stream);
} catch (Exception e) {
postMediaSelectFailedEvent(new Locator[] { component });
throw new InvalidLocatorException(component);
}
}
示例4: Handler
import javax.media.Control; //导入依赖的package包/类
public Handler() {
controls = new Control[18];
controls[0] = new AngleControlImpl(this);
controls[1] = new AudioMetadataControlImpl();
controls[2] = new BackgroundVideoPresentationControlImpl(this);
controls[3] = new DVBMediaSelectControlImpl(this);
controls[4] = new MediaTimeEventControlImpl();
controls[5] = new MediaTimePositionControlImpl(this);
controls[6] = new OverallGainControlImpl(this);
controls[7] = new PanningControlImpl(this);
controls[8] = new PiPControlImpl(this);
controls[9] = new PlaybackControlImpl(this);
controls[10] = new PlayListChangeControlImpl(this);
controls[11] = new PrimaryAudioControlImpl(this);
controls[12] = new PrimaryGainControlImpl(this);
controls[13] = new SecondaryAudioControlImpl(this);
controls[14] = new SecondaryGainControlImpl(this);
controls[15] = new SubtitlingControlImpl(this);
controls[16] = new UOMaskTableControlImpl(this);
controls[17] = new VideoFormatControlImpl(this);
}
示例5: addControl
import javax.media.Control; //导入依赖的package包/类
/**
* Add a Control to this Controller.
*
* @param newControl
* The Control to add.
*/
public void addControl(Control newControl) {
synchronized(controls) {
if(! controls.contains(newControl) ) {
controls.addElement(newControl);
}
}
}
示例6: getControls
import javax.media.Control; //导入依赖的package包/类
/**
* Get a list of the Control objects that this Controller
* supports. If there are no controls, an array of length
* zero is returned.
*
* @return A list of Controller Controls.
*
*/
public Control[] getControls() {
Control[] array;
synchronized(controls) {
array = new Control[ controls.size() ];
controls.copyInto(array);
}
return array;
}
示例7: MonitorCDS
import javax.media.Control; //导入依赖的package包/类
public MonitorCDS(DataSource ds) {
// Get the stream from the actual datasource
// and create a MonitorStream from it
// Export the MonitorControl interface of the MonitorStream
if (ds instanceof PushBufferDataSource) {
delegate = (PushBufferDataSource) ds;
delStreams = delegate.getStreams();
monitorStream = new MonitorStream(delStreams[0], this);
monitorStreams = new PushBufferStream[] {monitorStream};
controls = new Control[] {monitorStream};
}
}
示例8: setJPEGQuality
import javax.media.Control; //导入依赖的package包/类
/**
* Setting the encoding quality to the specified value on the JPEG encoder.
* 0.5 is a good default.
*/
void setJPEGQuality(Player p, float val) {
Control cs[] = p.getControls();
QualityControl qc = null;
VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
// Loop through the controls to find the Quality control for
// the JPEG encoder.
for (int i = 0; i < cs.length; i++) {
if (cs[i] instanceof QualityControl &&
cs[i] instanceof Owned) {
Object owner = ((Owned)cs[i]).getOwner();
// Check to see if the owner is a Codec.
// Then check for the output format.
if (owner instanceof Codec) {
Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
for (int j = 0; j < fmts.length; j++) {
if (fmts[j].matches(jpegFmt)) {
qc = (QualityControl)cs[i];
qc.setQuality(val);
System.err.println("- Setting quality to " +
val + " on " + qc);
break;
}
}
}
if (qc != null)
break;
}
}
}
示例9: getControl
import javax.media.Control; //导入依赖的package包/类
public Control getControl(String forName) {
try {
Class cls = Class.forName(forName);
for (int i = 0; i < controls.length; i++) {
if (cls.isInstance(controls[i]))
return controls[i];
}
Logger.getLogger("BDHandler").error("getControl(): control not found: " + forName);
return null;
} catch (ClassNotFoundException e) {
Logger.getLogger("BDHandler").error("getControl(): " + e);
return null;
}
}
示例10: replace
import javax.media.Control; //导入依赖的package包/类
public void replace(Locator fromComponent, Locator toComponent)
throws InvalidLocatorException, InvalidServiceComponentException,
InsufficientResourcesException, SecurityException {
if (!checkLocator(fromComponent))
throw new InvalidLocatorException(fromComponent);
if (!checkLocator(toComponent))
throw new InvalidLocatorException(toComponent);
Control fromControl = getControl((BDLocator)fromComponent);
if (fromControl == null)
throw new InvalidLocatorException(fromComponent);
Control toControl = getControl((BDLocator)toComponent);
if (toControl == null)
throw new InvalidLocatorException(toComponent);
if (fromControl != toControl)
throw new InvalidLocatorException(fromComponent);
int fromStream = getStream((BDLocator)fromComponent);
if ((fromStream <= 0) || (fromStream != ((StreamControl)fromControl).getCurrentStreamNumber()))
throw new InvalidLocatorException(fromComponent);
int toStream = getStream((BDLocator)toComponent);
if (toStream <= 0)
throw new InvalidLocatorException(toComponent);
try {
((StreamControl)fromControl).selectStreamNumber(toStream);
} catch (Exception e) {
postMediaSelectFailedEvent(new Locator[] { toComponent });
throw new InvalidLocatorException(toComponent);
}
}
示例11: getControl
import javax.media.Control; //导入依赖的package包/类
private Control getControl(BDLocator locator) {
if (locator.getPrimaryVideoStreamNumber() > 0)
return player.getControl("org.bluray.media.BackgroundVideoPresentationControl");
else if (locator.getPrimaryAudioStreamNumber() > 0)
return player.getControl("org.bluray.media.PrimaryAudioControl");
else if (locator.getSecondaryVideoStreamNumber() > 0)
return player.getControl("org.bluray.media.AsynchronousPiPControl");
else if (locator.getSecondaryAudioStreamNumber() > 0)
return player.getControl("org.bluray.media.SecondaryAudioControl");
else if (locator.getPGTextStreamNumber() > 0)
return player.getControl("org.bluray.media.SubtitlingControl");
return null;
}
示例12: getControl
import javax.media.Control; //导入依赖的package包/类
public Control getControl(String forName) {
try {
Class cls = Class.forName(forName);
for (int i = 0; i < controls.length; i++) {
if (cls.isInstance(controls[i]))
return controls[i];
}
return null;
} catch (ClassNotFoundException e) {
return null;
}
}
示例13: getControls
import javax.media.Control; //导入依赖的package包/类
public Object[] getControls()
{
if (controls == null)
{
controls = new Control[0];
}
return controls;
}
示例14: getControls
import javax.media.Control; //导入依赖的package包/类
public Object [] getControls() {
// No controls
return new Control[0];
}
示例15: getControls
import javax.media.Control; //导入依赖的package包/类
/**
* Returns an array of supported controls
*/
public Object[] getControls() {
// No controls
return (Object[]) new Control[0];
}