org.dvb.media
Class DripFeedDataSource

java.lang.Object
  extended byjavax.media.protocol.DataSource
      extended byorg.dvb.media.DripFeedDataSource
All Implemented Interfaces:
javax.media.protocol.Controls, javax.media.Duration

public class DripFeedDataSource
extends javax.media.protocol.DataSource

This class allows to create a source for a JMF player to be able to feed the decoder progressively with parts of a clip (e.g. I or P MPEG-2 frame) according to the drip-fed mode format defined in the MHP content format clause.

To start using the drip-feed mode, the application needs to instantiate a player representing a MPEG-2 video decoder and have its source be a DripFeedDataSource instance.

A DripFeedDataSource instance can be obtained by calling the default constructor of the class.

A player that will be bound to a MPEG-2 video decoder (when realized) can be created with a locator of the following text representation: "dripfeed://".

After having the DripFeedDataSource connected to a Player representing a MPEG-2 video decoder, the following rules applies:
- If the feed method is called when the player is in the "prefetched" state the image will be stored so that when the player goes in the "started" state it will be automatically displayed.
- If the feed method is called when the player is in the "started" mode, the frame shall be displayed immediately. In particular it is not required to feed a second frame to the decoder to display the first frame.
- If the feed method is called when the player is in any other state (or if the DripFeedDataSource is not connected to a player), it will be ignored by the platform implementation.


Field Summary
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
DripFeedDataSource()
          Constructor.
 
Method Summary
 void connect()
          This method shall not be used and has no effect.
 void disconnect()
          This method shall not be used and has no effect.
 void feed(byte[] clip_part)
          This method allows an application to feed the decoder progressively with parts of a clip (e.g.
 java.lang.String getContentType()
          This method shall return the content type for mpeg-2 video "drips"
 java.lang.Object getControl(java.lang.String controlType)
          Obtain the object that implements the specified Class or Interface.
 java.lang.Object[] getControls()
          Obtain the collection of objects that control this object.
 javax.media.Time getDuration()
          This method shall not be used and has no effect.
 void start()
          This method shall not be used and has no effect.
 void stop()
          This method shall not be used and has no effect.
 
Methods inherited from class javax.media.protocol.DataSource
getLocator, initCheck, setLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DripFeedDataSource

public DripFeedDataSource()
Constructor. A call to the constructor will throw a security exception if the application is not granted the right to use the drip feed mode. The constructor shall automatically set the MediaLocator for this DataSource to the only allowed value: dripfeed://. There is no need for applications to later call setLocator.

Method Detail

feed

public void feed(byte[] clip_part)
This method allows an application to feed the decoder progressively with parts of a clip (e.g. I or P MPEG-2 frame) according to the drip-fed mode format defined in the MHP content format clause.
The feed method shall not be called more often than every 500ms. If this rule is not respected, display is not guaranteed.

While in the prefetch state the drip feed data source is only required to correctly process a single invocation of this method where the data consists only of a single I frame. Possible additional invocations while in the prefetch state shall have implementation specific results.

Parameters:
clip_part - Chunk of bytes compliant with the drip-fed mode format defined in the MHP content format clause (i.e. one MPEG-2 frame with optional synctactic MPEG-2 elements).

getContentType

public java.lang.String getContentType()
This method shall return the content type for mpeg-2 video "drips"

Returns:
the content type for MPEG-2 video drips

connect

public void connect()
             throws java.io.IOException
This method shall not be used and has no effect. This source is considered as always connected.

Throws:
java.io.IOException - never thrown in this sub-class

disconnect

public void disconnect()
This method shall not be used and has no effect. This source is considered as always connected.


start

public void start()
           throws java.io.IOException
This method shall not be used and has no effect. This source is considered as always started.

Throws:
java.io.IOException - never thrown in this sub-class

stop

public void stop()
          throws java.io.IOException
This method shall not be used and has no effect. This source is considered as always started.

Throws:
java.io.IOException - never thrown in this sub-class

getDuration

public javax.media.Time getDuration()
This method shall not be used and has no effect.

Returns:
DURATION_UNKNOWN.

getControls

public java.lang.Object[] getControls()
Obtain the collection of objects that control this object. If no controls are supported, a zero length array is returned.

Returns:
the collection of object controls

getControl

public java.lang.Object getControl(java.lang.String controlType)
Obtain the object that implements the specified Class or Interface. The full class or interface name must be used. If the control is not supported then null is returned.

Parameters:
controlType - the full class or interface name of the requested control
Returns:
the object that implements the control, or null.