📄 jmfprocessing.html
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher 5.0.2">
<meta name="TEMPLATEBASE" content="Portable HTML">
<meta name="LASTUPDATED" content="11/23/99 11:48:06">
<title>Processing Time-Based Media with JMF </title>
</head>
<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><a href="JMFTOC.html">CONTENTS</a> |
<a href="JMFPresenting.html">PREV </a> |
<a href="JMFCapturing.html">NEXT</a> |
<a href="JMFIX.html">INDEX</a></td>
<td align="right"><em>JMF 2.0 API Guide</em>
</tr>
</table>
<p><br clear="all">
</p>
<hr align="left">
<blockquote>
<div align="right">
<a name="96139"> </a><font size="3" face="Palatino, Times New Roman, Times, serif">4 <br></font>
</div>
<div align="right">
<h2>
<a name="97009"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Processing Time-Based Media with JMF</font>
</h2>
</div>
<p>
<a name="96506"> </a><font face="Palatino, Times New Roman, Times, serif">A <code>Processor</code> can be used as a programmable <code>Player</code> that enables you to control the decoding and rendering process. A <code>Processor</code> can also be used as a capture processor that enables you to control the encoding and multiplexing of the captured media data.</font>
</p>
<p>
<a name="97420"> </a><font face="Palatino, Times New Roman, Times, serif">You can control what processing is performed by a <code>Processor </code>several different ways:</font>
</p>
<ul>
<li><a name="97421"> </a><font face="Palatino, Times New Roman, Times, serif">Use a <code>ProcessorModel</code> to construct a <code>Processor</code> that has certain input and output characteristics.</font>
<li><a name="96511"> </a><font face="Palatino, Times New Roman, Times, serif">Use the <code>TrackControl</code> <code>setFormat</code> method to specify what format conversions are performed on individual tracks.</font>
<li><a name="96425"> </a><font face="Palatino, Times New Roman, Times, serif">Use the <code>Processor</code> <code>setOutputContentDescriptor</code> method to specify the multiplexed data format of the <code>Processor </code>object's output.</font>
<li><a name="96426"> </a><font face="Palatino, Times New Roman, Times, serif">Use the <code>TrackControl</code> <code>setCodecChain</code> method to select the <code>Effect</code> or <code>Codec</code> plug-ins that are used by the <code>Processor</code>.</font>
<li><a name="97381"> </a><font face="Palatino, Times New Roman, Times, serif">Use the <code>TrackControl</code> <code>setRenderer</code> method to select the <code>Renderer</code> plug-in used by the <code>Processor</code>.</font>
</ul>
<p>
<a name="96402"> </a><font face="Palatino, Times New Roman, Times, serif">Note: Some high-performance or light-weight <code>Processor</code> implementations might choose not to support the selection of processing options so that they can provide a highly-optimized JMF presentation solution. The reference implementation of JMF 2.0 provided by Sun Microsystems, Inc. and IBM Corporation fully supports the selection of processing options through <code>TrackControl</code> objects and <code>setOutputContentDescriptor</code>.</font>
</p>
<p>
<a name="96636"> </a><font face="Palatino, Times New Roman, Times, serif">Configuring a Processor</font>
</p>
<p>
<a name="96641"> </a><font face="Palatino, Times New Roman, Times, serif">In addition to the <em>Realizing</em> and <em>Prefetching</em> phases that any <code>Player</code> moves through as it prepares to start, a <code>Processor</code> also goes through a <em>Configuring</em> phase. You call <code>configure</code> to move an <em>Unrealized</em> <code>Processor</code> into the <em>Configuring</em> state. </font>
</p>
<p>
<a name="96691"> </a><font face="Palatino, Times New Roman, Times, serif">While in the <em>Configuring</em> state, a <code>Processor</code> gathers the information it needs to construct <code>TrackControl</code> objects for each track. When it's finished, it moves into the <em>Configured</em> state and posts a <code>ConfigureCompleteEvent</code>. Once a <code>Processor</code> is <em>Configured</em>, you can set its output format and <code>TrackControl</code> options. When you're finished specifying the processing options, you call <code>realize </code>to move the <code>Processor</code> into the <em>Realizing</em> state and begin the realization process. </font>
</p>
<p>
<a name="96756"> </a><font face="Palatino, Times New Roman, Times, serif">Once a <code>Processor</code> is <em>Realized</em>, further attempts to modify its processing options are not guaranteed to work. In most cases, a <code>FormatChangeException</code> will be thrown. </font>
</p>
<h4>
<a name="96787"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Selecting Track Processing Options</font>
</h4>
<p>
<a name="96575"> </a><font face="Palatino, Times New Roman, Times, serif">To select which plug-ins are used to process each track in the media stream, you:</font>
</p>
<ol type="1">
<li value="1"><a name="96237"> </a><font face="Palatino, Times New Roman, Times, serif">Call the <code>PlugInManager.getPlugInList</code> method to determine what plug-ins are available. The <code>PlugInManager</code> returns a list of plug-ins that match the specified input and output formats and plug-in type. </font>
<li value="2"><a name="96238"> </a><font face="Palatino, Times New Roman, Times, serif">Call <code>getTrackControls</code> on the <code>Processor</code> to get a <code>TrackControl</code> for each track in the media stream. The <code>Processor</code> must in the <em>Configured</em> state before you call <code>getTrackControls</code>.</font>
<li value="3"><a name="96239"> </a><font face="Palatino, Times New Roman, Times, serif">Call the <code>TrackControl</code> <code>setCodecChain </code>or<code> setRenderer</code> methods to specify the plug-ins that you want to use for each track.</font>
</ol>
<p>
<a name="97440"> </a><font face="Palatino, Times New Roman, Times, serif">When you use <code>setCodecChain</code> to specify the codec and effect plug-ins for a <code>Processor</code>, the order in which the plug-ins actually appear in the processing chain is determined by the input and output formats each plug-in supports. </font>
</p>
<p>
<a name="96240"> </a><font face="Palatino, Times New Roman, Times, serif">To control the transcoding that's performed on a track by a particular <code>Codec</code>, you can use the codec controls associated with the track. To get the codec controls, you call the <code>TrackControl</code> <code>getControls</code> method. This returns all of the <code>Controls</code> associated with the track, including codec controls such as <code>H263Control</code>, <code>QualityControl</code>, and <code>MPEGAudioControl</code>. (For a list of the codec controls defined by JMF, see <a href="JMFArchitecture.html#105320">Standard Controls</a>.)</font>
</p>
<h3>
<a name="96828"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Converting Media Data from One Format to Another</font>
</h3>
<p>
<a name="96441"> </a><font face="Palatino, Times New Roman, Times, serif">You can select the format for a particular track through the <code>TrackControl</code> for that track:</font>
</p>
<ol type="1">
<li value="1"><a name="96205"> </a><font face="Palatino, Times New Roman, Times, serif">Call <code>getTrackControls</code> on the <code>Processor</code> to get a <code>TrackControl</code> for each track in the media stream. The <code>Processor</code> must be in the <em>Configured</em> state before you call <code>getTrackControls</code>.</font>
<li value="2"><a name="96207"> </a><font face="Palatino, Times New Roman, Times, serif">Use the <code>TrackControl</code> <code>setFormat</code> method to specify the format to which you want to convert the selected track.</font>
</ol>
<h4>
<a name="96160"> </a><font color="#003366" face="Palatino, Times New Roman, Times, serif">Specifying the Output Data Format</font>
</h4>
<p>
<a name="96218"> </a><font face="Palatino, Times New Roman, Times, serif">You can use the <code>Processor</code> <code>setContentDescriptor</code> method to specify the format of the data output by the <code>Processor</code>. You can get a list of supported data formats by calling <code>getSupportedContentDescriptors</code>. </font>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -