当前位置: 首页>>代码示例>>Java>>正文


Java Processor类代码示例

本文整理汇总了Java中javax.media.Processor的典型用法代码示例。如果您正苦于以下问题:Java Processor类的具体用法?Java Processor怎么用?Java Processor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Processor类属于javax.media包,在下文中一共展示了Processor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import javax.media.Processor; //导入依赖的package包/类
public boolean configure(int timeOutMillis) {
long startTime = System.currentTimeMillis();
synchronized (this) {
    if (player instanceof Processor)
	 ((Processor)player).configure();
    else
	 return false;

    while (!configured && !failed) {
	 try {
	     wait(timeOutMillis);
	 } catch (InterruptedException ie) {
	 }
	 if (System.currentTimeMillis() - startTime > timeOutMillis)
	     break;
    }
}
return configured;
  }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:20,代码来源:StateHelper.java

示例2: createDataSink

import javax.media.Processor; //导入依赖的package包/类
/**
    * Create the DataSink.
    */
   DataSink createDataSink(Processor p, MediaLocator outML) {

DataSource ds;

if ((ds = p.getDataOutput()) == null) {
    System.err.println("Something is really wrong: the processor does not have an output DataSource");
    return null;
}

DataSink dsink;

try {
    System.err.println("- create DataSink for: " + outML);
    dsink = Manager.createDataSink(ds, outML);
    dsink.open();
} catch (Exception e) {
    System.err.println("Cannot create the DataSink: " + e);
    return null;
}

return dsink;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:26,代码来源:JpegImagesToMovie.java

示例3: waitForState

import javax.media.Processor; //导入依赖的package包/类
/****************************************************************
    * Boring methods of SuperGlueDataSource
    ****************************************************************/
   

   private synchronized boolean waitForState(Processor p, int state) {
StateListener sl = new StateListener();
p.addControllerListener(sl);
failed = false;

if (state == Processor.Configured) {
    p.configure();
} else if (state == Processor.Realized) {
    p.realize();
}

while (p.getState() < state && !failed) {
    synchronized (getStateLock()) {
	try {
	    getStateLock().wait();
	} catch (InterruptedException ie) {
	    return false;
	}
    }
}	
p.removeControllerListener(sl);
return !failed;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:29,代码来源:SuperGlueDataSource.java

示例4: waitForState

import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
StateListener sl = new StateListener();
p.addControllerListener(sl);
failed = false;

if (state == Processor.Configured) {
    p.configure();
} else if (state == Processor.Realized) {
    p.realize();
}

while (p.getState() < state && !failed) {
    synchronized (getStateLock()) {
	try {
	    getStateLock().wait();
	} catch (InterruptedException ie) {
	    return false;
	}
    }
}	
p.removeControllerListener(sl);
return !failed;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:24,代码来源:MiniME.java

示例5: controllerUpdate

import javax.media.Processor; //导入依赖的package包/类
/**
 * Controller Listener.
 */
public void controllerUpdate(ControllerEvent evt) {

	if (evt instanceof ConfigureCompleteEvent
			|| evt instanceof RealizeCompleteEvent
			|| evt instanceof PrefetchCompleteEvent) {
		synchronized (waitSync) {
			stateTransitionOK = true;
			waitSync.notifyAll();
		}
	} else if (evt instanceof ResourceUnavailableEvent) {
		synchronized (waitSync) {
			stateTransitionOK = false;
			waitSync.notifyAll();
		}
	} else if (evt instanceof EndOfMediaEvent) {
		processor.setMediaTime(Processor.RESET);
		processor.start();
		//processor.close();
		//System.exit(0);
	}
}
 
开发者ID:voxoid0,项目名称:java-motion-tracking,代码行数:25,代码来源:AbstractProcessingCamera.java

示例6: waitForState

import javax.media.Processor; //导入依赖的package包/类
/**
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    */
   boolean waitForState(Processor p, int state) {
synchronized (waitSync) {
    try {
	while (p.getState() < state && stateTransitionOK)
	    waitSync.wait();
    } catch (Exception e) {}
}
return stateTransitionOK;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:14,代码来源:JpegImagesToMovie.java

示例7: waitForState

import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;

// Call the required method on the processor
if (state == Processor.Configured) {
    p.configure();
} else if (state == Processor.Realized) {
    p.realize();
}

// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
    synchronized (getStateLock()) {
	try {
	    getStateLock().wait();
	} catch (InterruptedException ie) {
	    return false;
	}
    }
}

if (failed)
    return false;
else
    return true;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:30,代码来源:AVTransmitter.java

示例8: waitForState

import javax.media.Processor; //导入依赖的package包/类
/**
 * Blocks until the processor has transitioned to the given state. Return false
 * if the transition failed.
 */
private boolean waitForState(Processor p, int state) throws InterruptedException
{
	synchronized (waitSync)
	{
		while (p.getState() < state && stateTransitionOK)
		{
			waitSync.wait();
		}
	}
	return stateTransitionOK;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:16,代码来源:JPEGImagesToVideo.java

示例9: waitForState

import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
    p.addControllerListener(new StateListener());
    failed = false;

    // Call the required method on the processor
    if (state == Processor.Configured) {
        p.configure();
    }
    else if (state == Processor.Realized) {
        p.realize();
    }

    // Wait until we get an event that confirms the
    // success of the method, or a failure event.
    // See StateListener inner class
    while (p.getState() < state && !failed) {
        synchronized (getStateLock()) {
            try {
                getStateLock().wait();
            }
            catch (InterruptedException ie) {
                return false;
            }
        }
    }

    return !failed;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:29,代码来源:AudioChannel.java

示例10: process

import javax.media.Processor; //导入依赖的package包/类
public void process(String recordingFile, String movieFile) throws Exception {

      MediaLocator mediaLocator = new MediaLocator(new File(movieFile).toURI()
            .toURL());
      PlayerDataSource playerDataSource = new PlayerDataSource(recordingFile);
      Processor processor = Manager.createProcessor(playerDataSource);
      processor.addControllerListener(this);
      processor.configure();

      if (!waitForState(processor, Processor.Configured)) {
         System.err.println("Failed to configure the processor.");
         return;
      }

      processor.setContentDescriptor(new ContentDescriptor(
            FileTypeDescriptor.QUICKTIME));

      TrackControl trackControl[] = processor.getTrackControls();
      Format format[] = trackControl[0].getSupportedFormats();
      trackControl[0].setFormat(format[0]);
      processor.realize();
      if (!waitForState(processor, Processor.Realized)) {
         System.err.println("Failed to realize the processor.");
         return;
      }

      DataSource dataSource = processor.getDataOutput();
      DataSink dataSink = Manager.createDataSink(dataSource, mediaLocator);
      dataSink.open();
      processor.start();
      dataSink.start();
      waitForFileDone();
      dataSink.close();
      processor.removeControllerListener(this);
   }
 
开发者ID:openwarrior,项目名称:java-screen-recorder,代码行数:36,代码来源:RecordingConverter.java

示例11: waitForState

import javax.media.Processor; //导入依赖的package包/类
boolean waitForState(Processor p, int state) {
   synchronized (waitSync) {
      try {
         while (p.getState() < state && stateTransitionOK)
            waitSync.wait();
      } catch (Exception e) {
      }
   }
   return stateTransitionOK;
}
 
开发者ID:openwarrior,项目名称:java-screen-recorder,代码行数:11,代码来源:RecordingConverter.java

示例12: waitForState

import javax.media.Processor; //导入依赖的package包/类
protected synchronized boolean waitForState(Processor p, int state) {
	p.addControllerListener(new StateListener());
	failed = false;

	// Call the required method on the processor
	if (state == Processor.Configured) {
		p.configure();
	} else if (state == Processor.Realized) {
		p.realize();
	}

	// Wait until we get an event that confirms the
	// success of the method, or a failure event.
	// See StateListener inner class
	while (p.getState() < state && !failed) {
		synchronized (getStateLock()) {
			try {
				getStateLock().wait();
			} catch (InterruptedException ie) {
				return false;
			}
		}
	}

	if (failed)
		return false;
	else
		return true;
}
 
开发者ID:mloobo,项目名称:Dolphin-Streaming-Server,代码行数:30,代码来源:UnicastRtp.java

示例13: waitForState

import javax.media.Processor; //导入依赖的package包/类
public boolean waitForState(Processor p, int state) {
    synchronized (waitSync) {
        try {
            while (p.getState() < state) {
                waitSync.wait();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return p.getState() == state;
}
 
开发者ID:sebkur,项目名称:montemedia,代码行数:13,代码来源:Main.java

示例14: waitForState

import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
    p.addControllerListener(new StateListener());
    failed = false;

    // Call the required method on the processor
    if (state == Processor.Configured) {
        p.configure();
    } else if (state == Processor.Realized) {
        p.realize();
    }

    // Wait until we get an event that confirms the
    // success of the method, or a failure event.
    // See StateListener inner class
    while (p.getState() < state && !failed) {
        synchronized (getStateLock()) {
            try {
                getStateLock().wait();
            } catch (InterruptedException ie) {
                return false;
            }
        }
    }

    if (failed)
        return false;
    else
        return true;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:30,代码来源:VideoChannel.java

示例15: actionPerformed

import javax.media.Processor; //导入依赖的package包/类
public void actionPerformed(ActionEvent ae) {

	String mediaFile1 = vcPanel1.getMediaFile();
	String mediaFile2 = vcPanel2.getMediaFile();
	Time beginTime1 = vcPanel1.getBeginTime();
	Time beginTime2 = vcPanel2.getBeginTime();
	Time endTime1 = vcPanel1.getEndTime();
	Time endTime2 = vcPanel2.getEndTime();

	String sDuration = (String) cbDuration.getSelectedItem();
	long duration = (long) Integer.parseInt(sDuration) * 1000000000L;
	vcPanel3.setURL(null);
	if (mediaFile1 == null || mediaFile2 == null ||
	    beginTime1 == null || beginTime2 == null ||
	    endTime1 == null || endTime2 == null)
	    return;

	vcPanel1.stop();
	vcPanel2.stop();
	SuperGlueDataSource sgds = new SuperGlueDataSource(
				    new String [] { mediaFile1, mediaFile2 },
				    new Time [] { beginTime1, beginTime2 },
				    new Time [] { endTime1, endTime2 },
				    new Time [] { new Time(duration), new Time(duration) },
				    new String[] { (String) cbEffect.getSelectedItem() },
				    new String[0],
				    new Dimension(160, 120));
	buttonGo.setEnabled(false);
	try {
	    sgds.connect();
	    sgds.setProgressListener(this);
	    Processor p = Manager.createProcessor(sgds);
	    boolean success = waitForState(p, Processor.Configured);

	    if (!success) {
		System.err.println("Error configuring output processor");
		buttonGo.setEnabled(true);
		return;
	    }

	    p.setContentDescriptor(new FileTypeDescriptor(FileTypeDescriptor.QUICKTIME));
	    success = waitForState(p, Processor.Realized);
	    if (!success) {
		System.err.println("Could not realize output processor");
		buttonGo.setEnabled(true);
	    }
	    DataSource ds = p.getDataOutput();
	    doSave(p, ds);
	} catch (Exception ex) {
	    buttonGo.setEnabled(true);
	    System.err.println("Exception creating processor: " + ex);
	}
    }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:54,代码来源:MiniME.java


注:本文中的javax.media.Processor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。