Package 

Class BlankAudioDataSource

  • All Implemented Interfaces:
    com.otaliastudios.transcoder.source.DataSource

    
    public class BlankAudioDataSource
     implements DataSource
                        

    A DataSource that provides a silent audio track of the a specific duration. This class can be used to concatenate a DataSources that has a video track only with another that has both video and audio track.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final long durationUs
      private long positionUs
    • Method Summary

      Modifier and Type Method Description
      long getDurationUs() Returns the video total duration in microseconds.
      long getPositionUs() Returns the current read position, between 0 and duration.
      void initialize()
      void selectTrack(@NonNull() TrackType type) Called before starting, but after getTrackFormat,to select the given track.
      void releaseTrack(@NonNull() TrackType type) Called to release resources for a given track.
      void deinitialize()
      boolean isInitialized()
      int getOrientation() Metadata information.
      Array<double> getLocation() Metadata information.
      long seekTo(long desiredPositionUs) Moves all selected tracks to the specified presentation time.
      MediaFormat getTrackFormat(@NonNull() TrackType type) Called before starting to inspect the input format for this track.Can return null if this media does not include this track type.
      boolean canReadTrack(@NonNull() TrackType type) Returns true if we can read the given track at this point.
      void readTrack(@NonNull() DataSource.Chunk chunk) Called to read contents for the current track type.
      boolean isDrained() When this source has been totally read, it can return true here tonotify an end of input stream.
      • Methods inherited from class com.otaliastudios.transcoder.source.DataSource

        readTrack
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BlankAudioDataSource

        BlankAudioDataSource(long durationUs)
    • Method Detail

      • getDurationUs

         long getDurationUs()

        Returns the video total duration in microseconds.

      • getPositionUs

         long getPositionUs()

        Returns the current read position, between 0 and duration.

      • getOrientation

         int getOrientation()

        Metadata information. Returns the video orientation, or 0.

      • seekTo

         long seekTo(long desiredPositionUs)

        Moves all selected tracks to the specified presentation time.The timestamp should be between 0 and getDurationUs.The actual timestamp might differ from the desired one because ofseeking constraints (e.g. seek to sync frames). It will typically be smallerbecause we use SEEK_TO_PREVIOUS_SYNC inthe default source.

        Parameters:
        desiredPositionUs - requested timestamp
      • canReadTrack

         boolean canReadTrack(@NonNull() TrackType type)

        Returns true if we can read the given track at this point.If true if returned, source should expect a readTrack call.

        Parameters:
        type - track type
      • readTrack

         void readTrack(@NonNull() DataSource.Chunk chunk)

        Called to read contents for the current track type.Contents should be put inside buffer, and theother chunk flags should be filled.

        Parameters:
        chunk - output chunk
      • isDrained

         boolean isDrained()

        When this source has been totally read, it can return true here tonotify an end of input stream.