Class TranscodingDataSource

  • All Implemented Interfaces:
    javax.media.Controls, javax.media.Duration, javax.media.protocol.Controls

    public class TranscodingDataSource
    extends javax.media.protocol.DataSource
    Represents a DataSource which transcodes the tracks of a specific input DataSource into a specific output Format. The transcoding is attempted only for tracks which actually support it for the specified output Format.
    Author:
    Lubomir Marinov
    • Field Summary

      • Fields inherited from interface javax.media.Duration

        DURATION_UNBOUNDED, DURATION_UNKNOWN
    • Constructor Summary

      Constructors 
      Constructor Description
      TranscodingDataSource​(javax.media.protocol.DataSource inputDataSource, javax.media.Format outputFormat)
      Initializes a new TranscodingDataSource instance to transcode the tracks of a specific DataSource into a specific output Format.
    • Constructor Detail

      • TranscodingDataSource

        public TranscodingDataSource​(javax.media.protocol.DataSource inputDataSource,
                                     javax.media.Format outputFormat)
        Initializes a new TranscodingDataSource instance to transcode the tracks of a specific DataSource into a specific output Format.
        Parameters:
        inputDataSource - the DataSource which is to have its tracks transcoded in a specific output Format
        outputFormat - the Format in which the new instance is to transcode the tracks of inputDataSource
    • Method Detail

      • connect

        public void connect()
                     throws IOException
        Implements DataSource.connect(). Sets up the very transcoding process and just does not start it i.e. creates a Processor on the inputDataSource, sets outputFormat on its tracks (which support a Format compatible with outputFormat) and connects to its output DataSource.
        Specified by:
        connect in class javax.media.protocol.DataSource
        Throws:
        IOException - if creating the transcoding Processor, setting its Format or connecting to it fails
      • disconnect

        public void disconnect()
        Implements DataSource.disconnect(). Stops and undoes the whole setup of the very transcoding process i.e. disconnects from the output DataSource of the transcodingProcessor and disposes of the transcodingProcessor.
        Specified by:
        disconnect in class javax.media.protocol.DataSource
      • getContentType

        public String getContentType()
        Implements DataSource.getContentType(). Delegates to the actual output of the transcoding.
        Specified by:
        getContentType in class javax.media.protocol.DataSource
        Returns:
        a String value which describes the type of the content made available by this DataSource
      • getControl

        public Object getControl​(String controlType)
        Implements Controls.getControl(String). Delegates to the actual output of the transcoding.
        Parameters:
        controlType - a String value which names the type of the control to be retrieved
        Returns:
        an Object which represents the control of this instance with the specified type if such a control is available; otherwise, null
      • getControls

        public Object[] getControls()
        Implements Controls.getControls(). Delegates to the actual output of the transcoding.
        Returns:
        an array of Objects which represent the controls available for this instance
      • getDuration

        public javax.media.Time getDuration()
        Implements Duration.getDuration(). Delegates to the actual output of the transcoding.
        Returns:
        a Time value which describes the duration of the content made available by this instance
      • getStreams

        public javax.media.protocol.SourceStream[] getStreams()
        Gets the output streams that this instance provides. Some of them may be the result of transcoding the tracks of the input DataSource of this instance in the output Format of this instance.
        Returns:
        an array of SourceStreams which represents the collection of output streams that this instance provides
      • start

        public void start()
                   throws IOException
        Implements DataSource.start(). Starts the actual transcoding process already set up with connect().
        Specified by:
        start in class javax.media.protocol.DataSource
        Throws:
        IOException - if starting the transcoding fails
      • stop

        public void stop()
                  throws IOException
        Implements DataSource.stop(). Stops the actual transcoding process if it has already been set up with connect().
        Specified by:
        stop in class javax.media.protocol.DataSource
        Throws:
        IOException - if stopping the transcoding fails
      • getTranscodingProcessor

        public javax.media.Processor getTranscodingProcessor()
        Returns this instance's Processor object
        Returns:
        this instance's Processor object