Class FragmentedMp4Builder

  • All Implemented Interfaces:
    Mp4Builder

    public class FragmentedMp4Builder
    extends Object
    implements Mp4Builder
    Creates a fragmented MP4 file.
    • Constructor Detail

      • FragmentedMp4Builder

        public FragmentedMp4Builder()
    • Method Detail

      • getDate

        public Date getDate()
      • createMoofMdat

        protected List<Box> createMoofMdat​(Movie movie)
      • createFragment

        protected int createFragment​(List<Box> moofsMdats,
                                     Track track,
                                     long startSample,
                                     long endSample,
                                     int sequence)
      • build

        public Container build​(Movie movie)
        Builds the actual IsoFile from the Movie.
        Specified by:
        build in interface Mp4Builder
        Parameters:
        movie - data source
        Returns:
        the freshly built IsoFile
      • createMdat

        protected Box createMdat​(long startSample,
                                 long endSample,
                                 Track track,
                                 int i)
      • createTfhd

        protected void createTfhd​(long startSample,
                                  long endSample,
                                  Track track,
                                  int sequenceNumber,
                                  TrackFragmentBox parent)
      • createMfhd

        protected void createMfhd​(long startSample,
                                  long endSample,
                                  Track track,
                                  int sequenceNumber,
                                  MovieFragmentBox parent)
      • createTraf

        protected void createTraf​(long startSample,
                                  long endSample,
                                  Track track,
                                  int sequenceNumber,
                                  MovieFragmentBox parent)
      • getSamples

        protected List<Sample> getSamples​(long startSample,
                                          long endSample,
                                          Track track)
        Gets all samples starting with startSample (one based -> one is the first) and ending with endSample (exclusive).
        Parameters:
        startSample - low endpoint (inclusive) of the sample sequence
        endSample - high endpoint (exclusive) of the sample sequence
        track - source of the samples
        Returns:
        a List<Sample> of raw samples
      • getSampleSizes

        protected long[] getSampleSizes​(long startSample,
                                        long endSample,
                                        Track track,
                                        int sequenceNumber)
        Gets the sizes of a sequence of samples.
        Parameters:
        startSample - low endpoint (inclusive) of the sample sequence
        endSample - high endpoint (exclusive) of the sample sequence
        track - source of the samples
        sequenceNumber - the fragment index of the requested list of samples
        Returns:
        the sample sizes in the given interval
      • createTrun

        protected void createTrun​(long startSample,
                                  long endSample,
                                  Track track,
                                  int sequenceNumber,
                                  TrackFragmentBox parent)
        Creates one or more track run boxes for a given sequence.
        Parameters:
        startSample - low endpoint (inclusive) of the sample sequence
        endSample - high endpoint (exclusive) of the sample sequence
        track - source of the samples
        sequenceNumber - the fragment index of the requested list of samples
        parent - the created box must be added to this box
      • createMoof

        protected ParsableBox createMoof​(long startSample,
                                         long endSample,
                                         Track track,
                                         int sequenceNumber)
        Creates a 'moof' box for a given sequence of samples.
        Parameters:
        startSample - low endpoint (inclusive) of the sample sequence
        endSample - high endpoint (exclusive) of the sample sequence
        track - source of the samples
        sequenceNumber - the fragment index of the requested list of samples
        Returns:
        the list of TrackRun boxes.
      • createMvhd

        protected ParsableBox createMvhd​(Movie movie)
        Creates a single 'mvhd' movie header box for a given movie.
        Parameters:
        movie - the concerned movie
        Returns:
        an 'mvhd' box
      • createMoov

        protected ParsableBox createMoov​(Movie movie)
        Creates a fully populated 'moov' box with all child boxes. Child boxes are:
        Parameters:
        movie - the concerned movie
        Returns:
        fully populated 'moov'
      • createTfra

        protected Box createTfra​(Track track,
                                 Container isoFile)
        Creates a 'tfra' - track fragment random access box for the given track with the isoFile. The tfra contains a map of random access points with time as key and offset within the isofile as value.
        Parameters:
        track - the concerned track
        isoFile - the track is contained in
        Returns:
        a track fragment random access box.
      • createMfra

        protected ParsableBox createMfra​(Movie movie,
                                         Container isoFile)
        Creates a 'mfra' - movie fragment random access box for the given movie in the given isofile. Uses createTfra(Track, Container) to generate the child boxes.
        Parameters:
        movie - concerned movie
        isoFile - concerned isofile
        Returns:
        a complete 'mfra' box
      • createMvex

        protected ParsableBox createMvex​(Movie movie)
        Creates a 'mvex' - movie extends box and populates it with 'trex' boxes by calling createTrex(Movie, Track) for each track to generate them
        Parameters:
        movie - the source movie
        Returns:
        a complete 'mvex'
      • getFragmenter

        public Fragmenter getFragmenter()
      • setFragmenter

        public void setFragmenter​(Fragmenter fragmenter)