⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controller.html

📁 JMF原版英文说明文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Sat May 20 18:57:43 PDT 2000 --><TITLE>: Interface  Controller</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../javax/media/Control.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../javax/media/ControllerListener.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="Controller.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.media</FONT><BR>Interface  Controller</H2><DL><DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../javax/media/Player.html">Player</A>, <A HREF="../../javax/media/Processor.html">Processor</A></DD></DL><HR><DL><DT>public interface <B>Controller</B><DT>extends <A HREF="../../javax/media/Clock.html">Clock</A>, <A HREF="../../javax/media/Duration.html">Duration</A></DL><P>The <code>Controller</code> interface, which extends <code>Clock</code>, provides resource-allocation state information, event generation, and a mechanism for obtaining objects that provide additional control over a <code>Controller</code>. <h2>Controller Life Cycle</h2> As a <code>Clock</code>, a <code>Controller</code> is always either <I>Started</I> or <I>Stopped</I>.  However, <code>Controller</code> subdivides <code>Clock's</code>&nbsp;<I>Stopped</I> state into five resource-allocation phases: <i>Unrealized</i>, <i>Realizing</i>, <i>Realized</i>, <i>Prefetching</i>, and <i>Prefetched</i>. <p> The purpose of these life-cycle states is to provide programmatic control over potentially time-consuming operations. For example, when a <code>Controller</code> is first constructed, it's in  the <i>Unrealized</i> state. While <I>Realizing</I>, the <code>Controller</code>  performs the communication necessary to locate all of the resources it needs to  function (such as communicating with a server, other controllers, or a file system). The <code>realize</code> method allows an application to initiate this potentially time-consuming process (<i>Realizing</i>) at an appropriate time. When a <code>Controller</code> is <i>Realizing</i> or <i>Prefetching</i>, it will eventually transition to another state, such as <i>Realized</i>, <i>Prefetched</i>, or even <i>Unrealized</i>. <p> Because a <code>Controller</code> is often in one state and on its way to another, its destination or <i>target</i> state is an integral part of the <code>Controller</code> life cycle. You can query a <code>Controller</code> to determine both its current state and its target state. <p> A <code>Controller</code> typically moves from the <i>Unrealized</i> state through <i>Realizing</i> to the <i>Realized</i> state, then through <i>Prefetching</i> to the <i>Prefetched</i> state, and finally on to the <i>Started</i> state. When a <code>Controller</code> finishes because the end of the  media stream is reached, its stop time is reached,  or the <code>stop</code> method is invoked, the <code>Controller</code> moves from the <i>Started</i> state back to <i>Prefetched</i> or possibly back to <i>Realized</i>, and is ready to  repeat the cycle. <p> To use a <code>Controller</code>, you must set up parameters to manage its movement through these life-cycle states and then move it through the states using the <code>Controller</code> state transition methods.  To keep track of the <code>Controller's</code> current state, you monitor the state transition events that it posts when changing states. <h3>State Transition Methods</h3> A <code>Controller</code> has five methods that are used to induce life cycle state changes: <code>realize</code>, <code>prefetch</code>, <code>deallocate</code>, <code>syncStart</code>, and <code>stop</code>. To transition a <code>Controller</code> to the <i>Realized</i>, <i>Prefetched</i>, or <i>Started</i> state, you use the corresponding method: <code>realize</code>,  <code>prefetch</code>, or <code>syncStart</code>. The <code>deallocate</code> and <code>stop</code> methods can change a requested state transition or trigger a state change. <p> The forward transition methods (<code>realize</code>, <code>prefetch</code>, and <code>syncStart</code>) are executed asynchronously and return immediately. When the requested operation is complete, the <code>Controller</code> posts a <code>ControllerEvent</code> indicating that the target state has been reached, <code>stop</code> or <code>deallocate</code> has been invoked, or that an error has occurred. <p> The <code>deallocate</code> and <code>stop</code> methods can change the target state and induce a transition back to a previous state. For example, calling <code>deallocate</code> on a <code>Controller</code> in the  <i>Prefetching</i> state will move it back to the <i>Realized</i> state.  These methods are synchronous.   <h3>State Transition Events</h3> A <code>Controller</code> often moves between states in an asynchronous manner. To facilitate the tracking of a <code>Controller's</code> state, every time its state or target state changes, the <code>Controller</code> is required to post a <code>TransitionEvent</code> that describes its previous state, current state, and new target state. By monitoring the <code>Controller</code> event stream, you can determine exactly what a <code>Controller</code> is doing at any point in time. <p> When one of the asynchronous forward state transition methods  completes, the <code>Controller</code> posts the appropriate <code>TransitionEvent</code>  or a <code>ControllerErrorEvent</code> indicating that the <code>Controller</code> is no longer usable. For more information about <code>ControllerEvents</code>, see the <a href="#CE"><I>Controller Events section</I></a>.  <p> To facilitate simple asynchronous method protocols, a <code>Controller</code> always posts a method completion event when one of the asynchronous forward state transition methods is invoked, even  if no state or target state change occurs. For example, if <code>realize</code> is called on a <i>Prefetching</i>&nbsp;<code>Controller</code>, a <code>RealizeCompleteEvent</code> is immediately posted, even though the <code>Controller</code> remains in the <i>Prefetching</i> state and the target state is still <i>Prefetched</i>. The method completion events always report the <code>Controller's</code> previous, current, and target state at the time the event was posted. <p> <h2>Controller States</h2> This section describes the semantics of each of the <code>Controller</code> states.  <h3>Unrealized State</h3> A newly instanced <code>Controller</code> starts in the <i>Unrealized</i> state. An <i>Unrealized</i>&nbsp;<code>Controller</code> knows very little about its internals and does not have enough information to acquire all of the resources it needs to function.  In particular, an <i>Unrealized</i>&nbsp;<code>Controller</code> does not know enough to properly construct a <code>Clock</code>.  Therefore, it is illegal to call the following methods on an <i>Unrealized</i>&nbsp;<code>Controller</code>: <ul> <li> <CODE>getTimeBase</CODE> <li> <CODE>setTimeBase</CODE> <li> <CODE>setMediaTime</CODE> <li> <CODE>setRate</CODE> <li> <CODE>setStopTime</CODE> <li> <CODE>getStartLatency</CODE> </ul> A <code>NotRealizedError</code> is thrown if any of these methods are called on an <I>Unrealized</I>&nbsp;<CODE>Controller</CODE>. <h3>Realizing and Realized States</h3> A <code>Controller</code> is <i>Realized</i> when it has obtained  all of the information necessary for it to acquire the resources it needs  to function. A <i>Realizing</i>&nbsp;<code>Controller</code> is in the process of identifying the resources that it needs to acquire. <i>Realizing</i> can be a resource-consuming and time-consuming process. A <i>Realizing</i>&nbsp;<code>Controller</code> might have to communicate with a server, read a file, or interact with a set of objects. <p> Although a <i>Realized</i>&nbsp;<code>Controller</code> does not have to acquire any resources, a <i>Realized</i>&nbsp;<code>Controller</code> is likely to have acquired all of the resources it needs except those that imply exclusive use of a  scarce system resource, such as an audio device or MPEG decoding hardware. <p> Normally, a <code>Controller</code> moves from the <i>Unrealized</i> state through <i>Realizing</i> and on to the <i>Realized</i> state. After <code>realize</code> has been invoked on a <code>Controller</code>, the only way it can return  to the <i>Unrealized</i> state is if <code>deallocate</code> is invoked before <i>Realizing</i> is completed. Once a <code>Controller</code> reaches the <i>Realized</i> state, it never returns to the <i>Unrealized</i> state.  It remains in one of four states: <i>Realized</i>, <i>Prefetching</i>, <i>Prefetched</i>, or <i>Started</i>. <p> <h4>Realize Method</h4> The <code>realize</code> method executes asynchronously and completion is signaled by a <code>RealizeCompleteEvent</code> or a <code>ControllerErrorEvent</code>. <p> <h3>Prefetching and Prefetched States</h3> Once <i>Realized</i>, a <code>Controller</code> might still need to  perform a number of time-consuming tasks before it is ready to be started.  For example, it might need to acquire scarce hardware resources,  fill buffers with media data, or perform other start-up processing.  While performing these tasks, the <code>Controller</code> is in the <i>Prefetching</i> state.  When finished, it moves into the <i>Prefetched</i> state. Over a <code>Controller's</code> lifetime, <i>Prefetching</i> might have to recur when certain methods are invoked. For example, calling <code>setMediaTime</code> might cause a <code>Player</code> to be <i>Prefetched</i> again before it is <i>Started</i>. <p> Once a <code>Controller</code> is <i>Prefetched</i>, it is capable of starting as quickly  as is possible for that <code>Controller</code>.  <i>Prefetching</i> reduces the startup latency of a <code>Controller</code> to the minimum possible value. (The startup latency is the value returned by <code>getStartLatency</code>.) <p> Typically, a <code>Controller</code> moves from the <i>Realized</i> state through <i>Prefetching</i> and on to the <i>Prefetched</i> state. Once <i>Prefetched</i>, a <code>Controller</code>  remains <i>Prefetched</i> unless <code>deallocate</code>, <code>syncStart</code>  or a method such as <code>setMediaTime</code>, which changes its state and  increases its startup latency, is invoked.  <p>  When a <i>Started</i>&nbsp;<code>Controller</code> stops, it returns to the <i>Prefetched</i> or <i>Realized</i> state. <p>  <h4>Prefetch Method</h4> The <code>prefetch</code> method is asynchronous and its completion is signaled

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -