java多媒体框架(JMF)的processor处理器 api中英文翻译

原文:

javax.media 
Interface Processor

public interface Processor
extends Player
The Processor interface defines a module for processing and controlling time-based media data. Processor extends the Player interface. Unlike a Player, which processes data as a "black box" and only renders data to preset destinations, a Processor supports a programmatic interface that enables control over the media data processing and access to output data streams.

The processing performed by a Processor is split into three stages:

Demultiplexing - an interleaved media stream is first demultiplexed into separate tracks of data streams that can be processed individually.
Data transcoding - each track of data can be transcoded from one format to another.
Multiplexing - the separate tracks can be multiplexed to form an interleaved stream of a particular container content type.
Both the data transcoding and multiplexing processes are programmable.

How a Processor Differs from a Controller

Processor extends the state transition cycle of a Controller by adding the Configuring and Configured states. The purpose of these additional states is to further refine the realizing process. The realizing step is essentially split into two phases:
Source information gathering - the input DataSource is queried and the input media stream is parsed to get the format information for the tracks in the stream.
Construction - the internals of the Processor are constructed to handle the input media stream.
Between these two steps, you can program the Processor to perform specific processing on its media stream.

The states of a Processor are: Unrealized, Configuring, Configured, Realizing, Realized, Prefetching, Prefetched, and Started.

The Configuring and Configured States

While it's in the Configuring state, a Processor gathers the source information necessary to prepare the Processor to be programmed. This might involve parsing an input file to access the individual media tracks within the file, or connecting to a capturing device to determine its capabilities. A ConfigureCompleteEvent is posted when the Processor reaches Configured state.

Once a Processor is Configured, you can program it to perform particular processing on each track or to output data in a particular format.

Realizing a Processor

When you're done programming the Processor, you call the realize method to complete its construction.

Once the Processor is in the Realized state, reprogramming the Processor by calling the TrackControl methods or the setContentDescriptor method is not guaranteed to work. This is because reprogramming the Processor might require reconstruction of its internals.

It is legal to call realize on a Processor while it is in the Unrealized state. This causes the Processor to transition from the Unrealized state to the Realized state. As it does this, it goes through each intermediate state: Configuring, Configured, and Realizing. However, when you directly realize a Processor, you miss the opportunity to program it while it's in the Configured state--the Processor performs whatever default processing its implementation specifies.

Deallocating a Processor

Calling deallocate changes the state of a Processor in the same way as a Controller except that if deallocate is called while the Processor is in the Configuring or Configured state, the Processor is returned to the Unrealized state.

Programming a Processor

You can control both the transcoding and multiplexing performed by a Processor. Data transcoding is controlled separately for each track. The getTrackControls method returns a TrackControl for each track. You use these TrackControl objects to specify what processing you want to perform. The multiplexing performed by a Processor is controlled by specifying the format that you want it to output. This is done through the setContentDescriptor method.

A Processor can be programmed while it is in the Configured state. A NotConfiguredError is thrown if you attempt to program the Processor before is configured.

If you do not program a Processor through the TrackControl methods or by calling setContentDescriptor, it performs whatever default processing is specified by its implementation.

Getting the Output from a Processor

The processed output data streams can be retrieved from a Processor through its output DataSource. The output DataSource provides the gateway for the output data to be read. A DataSource output from a Processor can be a PushDataSource, PushBufferDataSource, PullDataSource, or PullBufferDataSource depending on the implementation of the Processor.

A NotRealizedError is thrown if getDataOutput is called on a Processor that has not yet been realized.

Using a Processor as a Player

Many Processor implementations can be used like a Player to render media data instead of sending it to an output DataSource. In this case, the TrackControl objects provide additional information and control over the individual tracks to be rendered. When used as a Player, a Processor does not produce an output DataSource. To use a Processor as a Player, you call setContentDescriptor(null).

 翻译:

处理器接口继承自播放器

处理器接口定义了一个用于处理和控制实基媒体的模块。处理器接口继承自播放器,和播放器不同的是,处理器作为一个
"黑盒",只将数据呈现给预置目的地,处理器支持编程接口,它支持对媒体数据处理和访问输出数据流的控制

处理器执行的处理分为三个阶段:

解复用 - 首先将交织的媒体流解复用为可以单独处理的单独的数据流轨道。
数据转码 - 每个数据轨道可以从一种格式转码到另一种格式。
多路复用 - 可以多路复用单独的轨道以形成特定容器内容类型的交织流

数据转码和多路复用过程都是可编程的。

处理器与控制器的不同之处

处理器通过添加配置和配置状态来扩展控制器的状态转换周期。这些附加状态的目的是进一步完善实现过程。实现步骤基本上分为两个阶段:
源信息收集-输入数据源被查询,输入媒体流被解析以获取流中的轨迹的格式信息。
构造——处理器的内部结构是用来处理输入媒体流的。

在这两个步骤之间,您可以对处理器进行编程,以在其媒体流上执行特定的处理。
处理器的状态是:未实现、配置、配置、实现、实现、预取、预取和启动。
Unrealized, Configuring, Configured, Realizing, Realized, Prefetching, Prefetched, and Started.

配置和配置状态(The Configuring and Configured States)
当它处于配置状态时,处理器会收集必要的源信息,以准备处理器的编程。这可能涉及到解析一个输入文件来访问文件中的个别媒体轨迹,或者连接到捕获设备以确定其功能。当处理器达到配置状态时,就会发布配置完成事件。
一旦配置了处理器,您就可以对它进行编程,以便在每个轨道上执行特定的处理,或者以特定的格式输出数据。

实现一个处理器(Realizing a Processor)

当您完成对处理器的编程时,您调用实现方法来完成它的构造。
一旦处理器处于已实现状态,通过调用TrackControl方法或setContentDescriptor方法重新编程处理器就不能保证工作。这是因为重新编程处理器可能需要重构其内部结构。
当处理器处于未实现状态时,调用处理器是合法的。这将导致处理器从未实现状态转换为已实现状态。当它这样做时,它会经历每个中间状态:配置、配置和实现。然而,当您直接实现处理器时,您将错过在配置状态下对其进行编程的机会——处理器执行其实现指定的任何缺省处理。


回收处理器

调用deallocate以与控制器相同的方式改变处理器的状态,除非在处理器处于配置或配置状态时调用deallocate,处理器被返回到未实现状态。

处理器编程

您可以同时控制由处理器执行的代码转换和多路复用。数据转换是为每个轨迹单独控制的。gettrackcontrol方法为每条轨迹返回一个轨迹控件。您可以使用这些TrackControl对象来指定您想要执行的操作。由处理器执行的多路复用是通过指定你想要输出的格式来控制的。这是通过setContentDescriptor方法完成的。
处理器可以在配置状态下进行编程。如果您试图在配置之前对处理器进行编程,就会抛出一个notconfigure derror。
如果您没有通过TrackControl方法或调用setContentDescriptor来编写处理器,那么它就执行由其实现指定的任何缺省处理。

从处理器获取输出
处理的输出数据流可以通过它的输出数据源从处理器中检索。输出数据源提供了读取输出数据的网关。根据处理器的实现,处理器的数据源输出可以是PushDataSource、PushBufferDataSource、普尔DataSource或普尔bufferdatasource。
如果在尚未实现的处理器上调用getDataOutput,就会抛出NotRealizedError。
使用处理器作为播放器
许多处理器实现可以像播放器一样使用来呈现媒体数据,而不是将其发送到输出数据源。在这种情况下,TrackControl对象提供额外的信息,并控制要呈现的各个轨迹。当作为播放器使用时,处理器不会产生输出数据源。要使用处理器作为播放器,您可以调用setContentDescriptor(null)。

猜你喜欢

转载自blog.csdn.net/taotaobaobei/article/details/82940580