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

📄 clock.html

📁 JMF原版英文说明文档
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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:42 PDT 2000 --><TITLE>: Interface  Clock</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/CachingControl.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../javax/media/Codec.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="Clock.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  Clock</H2><DL><DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../javax/media/Controller.html">Controller</A>, <A HREF="../../javax/media/Player.html">Player</A>, <A HREF="../../javax/media/Processor.html">Processor</A></DD></DL><HR><DL><DT>public interface <B>Clock</B></DL><P>The <code>Clock</code> interface is implemented by objects that support the Java Media time model.  For example, this interface might be implemented by an object that  decodes and renders MPEG movies. <p> <h2>Clock and TimeBase</h2> <p> A <code>Clock</code> contains a <code>TimeBase</code> that provides a source of time,  much like a crystal oscillator. The only information that a <code>TimeBase</code> provides is  its current time; it does not provide any methods for influencing how time is kept.    A <code>Clock</code> defines a transformation on the time that its <code>TimeBase</code> keeps, typically marking time for a particular media stream. The time that a <code>Clock</code> keeps is referred to as the <i>media time</i>. <p> <h3>Clock Transform</h3>  The transformation that a <code>Clock</code> defines on a <code>TimeBase</code> is defined by three parameters: rate, <i>media start-time</i> (mst), and  <i>time-base start-time</i> (tbst).  Given a <i>time-base time</i> (tbt), the <i>media time</i> (mt) can be calculated using the following transformation: <p>  <CENTER><CODE>mt =  mst + (tbt - tbst)*rate </CODE></CENTER> <p>  The rate is simply a scale factor that is applied  to the <code>TimeBase</code>. For example, a rate of 2.0 indicates that the <code>Clock</code> will run at twice the rate of its <code>TimeBase</code>.  Similarly, a negative rate indicates that the <code>Clock</code> runs in the opposite direction of its <code>TimeBase</code>. <p>  The <i>time-base start-time</i> and the <i>media  start-time</i> define a common point in time at which the <code>Clock</code> and the <code>TimeBase</code> are synchronized. <p>  <h3>Default Time Base</h3>  A <code>Clock</code> has a default <code>TimeBase</code>. For many objects that support the <code>Clock</code> interface, the default <code>TimeBase</code> is the system <code>TimeBase</code>.  The system <code>TimeBase</code> can be obtained from <code>Manager</code> through the  <code>getSystemTimeBase</code> method.  <p>  Some <code>Clocks</code> have a <code>TimeBase</code> other than  the system <code>TimeBase</code>. For example, an audio renderer that implements the <code>Clock</code> interface might have a <code>TimeBase</code> that represents a hardware clock. <p>   <h2>Using a Clock</h2>  You can get the <code>TimeBase</code> associated with a <code>Clock</code> by calling the <code>getTimeBase</code> method. To change the  <CODE>TimeBase</CODE> that a <CODE>Clock</CODE> uses, you call the <code>setTimeBase</code> method. These get and set methods can be used together to synchronize different <code>Clocks</code> to the same <code>TimeBase</code>. <p> For example, an application might want to force a video renderer to sync to the <code>TimeBase</code> of an audio renderer. To do this, the application would call <code>getTimeBase</code> on the audio renderer and then use the value returned to call <code>setTimeBase</code> on the video renderer. This would ensure that the two rendering objects use the same source of time.  You can reset a <CODE>Clock</CODE> to use its default <CODE>TimeBase</CODE> by calling <CODE>setTimeBase(null)</CODE>. <p> Some <code>Clocks</code> are incapable of using another <code>TimeBase</code>. If this is the case, an <code>IncompatibleTimeBaseException</code> is thrown when <code>setTimeBase</code>  is called. <p>  <code>Clock</code> also provides methods for getting and setting a <code>Clock's</code>&nbsp;<i>media time</i> and rate:  <ul> <li><code>getMediaTime</code> and <code>setMediaTime</code> <li><code>getRate</code> and <code>setRate</code> </ul> <a name="start"> <h3>Starting a Clock</h3></a> Until a <code>Clock's</code>&nbsp;<code>TimeBase</code> transformation takes effect, the <code>Clock</code> is  in the <i>Stopped</i> state. Once all three transformation parameters (<i>media start-time</i>,  <i>time-base start-time</i>, and rate)  have been provided  to the <code>Clock</code>, it enters the <i>Started</i> state. <p> To start a <code>Clock</code>, <code>syncStart</code> is called with  the <i>time-base start-time</i> as an argument. The new <i>media start-time</i> is taken as the current <i>media time</i>, and the current rate defines the <code>Clock's</code> rate parameter. When <code>syncStart</code> is called, the <code>Clock</code> and its <code>TimeBase</code> are locked in sync and the <code>Clock</code> is considered to be in the <i>Started</i> state. <p> When a <code>Clock</code> is stopped and then restarted (using <code>syncStart</code>),  the <i>media start-time</i> for the restarted <code>Clock</code> is the current <i>media time</i>. The <code>syncStart</code> method is often used to synchronize two <code>Clocks</code> that share the same <code>TimeBase</code>.  When the <i>time-base start-time</i> and rate of each clock are set to the same values and  each <code>Clock</code> is set with the appropriate <i>media start-time</i>, the two <code>Clocks</code> will run in sync. <p> When <code>syncStart</code> is called with a new <i>time-base start-time</i>, the synchronization with the <i>media time</i> doesn't occur until the <code>TimeBase</code> reaches the <i>time-base start-time</i>. The <code>getMediaTime</code> method returns the untransformed <i>media time</i> until the <code>TimeBase</code> reaches the <i>time-base start-time</i>.  <p> The <CODE>getSyncTime</CODE> method behaves slightly differently. Once <CODE>syncStart</CODE> is invoked, <CODE>getSyncTime</CODE> always reports the transformed <i>time-base time</i>,  whether or not the <i>time-base start-time</i> has been reached. You can use <code>getSyncTime</code> to determine how much time remains before the <i>time-base start-time</i> is reached.  When the <i>time-base start-time</i> is reached, both <CODE>getMediaTime</CODE> and <CODE>getSyncTime</CODE> return the same value. <p> Objects that implement the <code>Clock</code> interface can provide more convenient start methods than <CODE>syncStart</CODE>. For example, <code>Player</code> defines <code>start</code>,  which should be used instead of <code>syncStart</code>  to start a <code>Player</code>.  <h3>Stopping a Clock</h3>  A <i>Stopped</i>&nbsp;<code>Clock</code> is no longer synchronized to its <code>TimeBase</code>. When a <code>Clock</code> is <i>Stopped</i>, its <i>media time</i>  no longer moves in rate-adjusted synchronization with the <i>time-base time</i> provided by its <code>TimeBase</code>. <p>  There are two ways to explicitly stop a <code>Clock</code>: you can invoke <code>stop</code> or set a <i>media stop-time</i>. When <code>stop</code> is invoked, synchronization with the <code>TimeBase</code> immediately stops.  When a <i>media stop-time</i> is set, synchronization stops when the <i>media stop-time</i> passes. <p> A <CODE>Clock's</CODE> rate affects how its <i>media stop-time</i> is interpreted. If its rate is positive, the <code>Clock</code> stops when the <i>media time</i> becomes greater than or equal to the stop time.  If its rate is negative, the <code>Clock</code> stops when the <i>media time</i> becomes less than or equal to the stop time. <p> If the stop-time is set to a value that the <code>Clock</code> has already passed, the <code>Clock</code> immediately stops. <p>  Once a stop-time is set, it remains in effect until it is changed or cleared. To clear a stop-time, call <code>setStopTime</code> with <code>Clock.RESET</code>. A <CODE>Clock's</CODE> stop-time is cleared automatically when it stops. <p> If no stop-time is ever set or if the stop-time is cleared, the only way to stop the <code>Clock</code> is to call the <code>stop</code> method. <p> <h2>Clock State</h2>  Conceptually, a <code>Clock</code> is always in one of two states: <i>Started</i> or <i>Stopped</i>. A <code>Clock</code> enters the <i>Started</i> state after  <code>syncStart</code> has been called and the <CODE>Clock</CODE> is mapped to its <code>TimeBase</code>.

⌨️ 快捷键说明

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