All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mp4parser.streaming.AbstractStreamingTrack Maven / Gradle / Ivy

Go to download

A generic parser and writer for all ISO 14496 based files (MP4, Quicktime, DCF, PDCF, ...)

There is a newer version: 1.1.22
Show newest version
package com.mp4parser.streaming;

import com.coremedia.iso.boxes.SampleDescriptionBox;
import com.coremedia.iso.boxes.TrackHeaderBox;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public abstract class AbstractStreamingTrack implements StreamingTrack {
    protected BlockingQueue samples = new ArrayBlockingQueue(1000);
    protected TrackHeaderBox tkhd;
    protected SampleDescriptionBox stsd;
    protected HashMap, TrackExtension> trackExtensions = new HashMap, TrackExtension>();

    public AbstractStreamingTrack() {
        tkhd = new TrackHeaderBox();
        tkhd.setTrackId(1);
    }

    public BlockingQueue getSamples() {
        return samples;
    }

    public boolean hasMoreSamples() {
        return false;
    }

    public TrackHeaderBox getTrackHeaderBox() {
        return tkhd;
    }

    public SampleDescriptionBox getSampleDescriptionBox() {
        return stsd;
    }


    public  T getTrackExtension(Class clazz) {
        return (T) trackExtensions.get(clazz);
    }

    public void addTrackExtension(TrackExtension trackExtension) {

        trackExtensions.put(trackExtension.getClass(), trackExtension);
    }

    public void removeTrackExtension(Class clazz) {
        trackExtensions.remove(clazz);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy