📄 codec.html
字号:
<!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 Codec</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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/media/Clock.html"><B>PREV CLASS</B></A> <A HREF="../../javax/media/Control.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> <A HREF="Codec.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <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 Codec</H2><DL><DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../javax/media/Effect.html">Effect</A></DD></DL><HR><DL><DT>public interface <B>Codec</B><DT>extends <A HREF="../../javax/media/PlugIn.html">PlugIn</A></DL><P>A <code>Codec</code> is a media processing unit that accepts a <code>Buffer</code> object as its input, performs some processing on the input data, and then puts the result in an output <code>Buffer</code> object. It has one input and one output. Typical examples of codecs include audio decoders, video encoders, and effects. <p> A codec usually works in one of the following modes: <ul> <li>Frame based mode. In this mode, the codec accepts one frame of data from its input and converts it to one frame of output data. The codec must consume its input <code>Buffer</code> and generate an output <code>Buffer</code>. <p> This mode is useful when the codec can handle any size of input. A simple gain codec fits this model: it multiplies each sample with the gain factor and puts the product in an output <code>Buffer</code>. Another scenario where this mode is useful is when the codec can only process data that's in a fixed, pre-determined frame size and the input <code>Buffer</code> is already packetized accordingly. One example of such a codec is a GSM audio decoder, which accepts a compressed GSM audio packet from an RTP depacketizer, decodes the packet, and then puts the result in an output <code>Buffer</code>. <br> </li> <li>Stream based mode. In this mode, the codec accepts chunks of data from its input and might generate an output <code>Buffer</code>. The codec might consume only part of the input <code>Buffer</code> each time its <code>process</code> method is called and might not generate an output <code>Buffer</code> during each round of processing. This mode is useful in stream packetizers, which accept a stream of bytes and divide the stream into packets (frames) that are used in the next processing phase. Another scenario where this mode is useful is when two audio processing units that have incompatible frame sizes need to be chained. </li> </ul> <p> Some restrictions apply to the processing a <code>Codec</code> can perform on its input and output <code>Buffer</code> objects: <ul> <li> The <code>Codec</code> might receive an output <code>Buffer</code> that is not big enough to hold its output data. In this case, the <code>Codec</code> should allocate a new <code>Buffer</code> for its output data. <br> </li> <li> The <code>Codec</code> cannot cache references to <code>Buffer</code> object fields. It must read all of the parameters from the input and output <code>Buffer</code> objects each time its <code>process</code> method is called. <br> </li> <li> If the <code>Codec</code> needs to keep references to a <code>Buffer</code> object's data (for performance reasons), the <code>Codec</code> must assign other data to the input <code>Buffer</code> object by calling <code>setData</code> before returning from the <code>process</code> method. The data assigned can be null, but it is better to assign some unneeded data to the <code>Buffer</code>, such as input data received earlier. Such manipulations can be used for in-place processing (where the output of the processing is put in the same location as input data in order to enhance memory utilization) or for codecs that need access to more than one frame of data without copying the data (for example, temporal video effects). </li> </ul><P><DL><DT><B>Since: </B><DD>JMF 2.0</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="fields_inherited_from_class_javax.media.PlugIn"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface javax.media.<A HREF="../../javax/media/PlugIn.html">PlugIn</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../javax/media/PlugIn.html#BUFFER_PROCESSED_FAILED">BUFFER_PROCESSED_FAILED</A>, <A HREF="../../javax/media/PlugIn.html#BUFFER_PROCESSED_OK">BUFFER_PROCESSED_OK</A>, <A HREF="../../javax/media/PlugIn.html#INPUT_BUFFER_NOT_CONSUMED">INPUT_BUFFER_NOT_CONSUMED</A>, <A HREF="../../javax/media/PlugIn.html#OUTPUT_BUFFER_NOT_FILLED">OUTPUT_BUFFER_NOT_FILLED</A>, <A HREF="../../javax/media/PlugIn.html#PLUGIN_TERMINATED">PLUGIN_TERMINATED</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/media/Format.html">Format</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Codec.html#getSupportedInputFormats()">getSupportedInputFormats</A></B>()</CODE><BR> Lists all of the input formats that this codec accepts.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/media/Format.html">Format</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Codec.html#getSupportedOutputFormats(javax.media.Format)">getSupportedOutputFormats</A></B>(<A HREF="../../javax/media/Format.html">Format</A> input)</CODE><BR> Lists the output formats that this codec can generate.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Codec.html#process(javax.media.Buffer, javax.media.Buffer)">process</A></B>(<A HREF="../../javax/media/Buffer.html">Buffer</A> input, <A HREF="../../javax/media/Buffer.html">Buffer</A> output)</CODE><BR> Performs the media processing defined by this codec.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -