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

org.mp4parser.streaming.extensions.CompositionTimeSampleExtension Maven / Gradle / Ivy

Go to download

This package has a focus on streams. It can read A/V data from e.g. a network source.

There is a newer version: 1.9.56
Show newest version
package org.mp4parser.streaming.extensions;

import org.mp4parser.streaming.SampleExtension;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class CompositionTimeSampleExtension implements SampleExtension {
    public static Map pool =
            Collections.synchronizedMap(new HashMap());
    private long ctts;

    public static CompositionTimeSampleExtension create(long offset) {
        CompositionTimeSampleExtension c = pool.get(offset);
        if (c == null) {
            c = new CompositionTimeSampleExtension();
            c.ctts = offset;
            pool.put(offset, c);
        }
        return c;
    }

    /**
     * This value provides the offset between decoding time and composition time. The offset is expressed as
     * signed long such that CT(n) = DT(n) + CTTS(n). This method is
     *
     * @return offset between decoding time and composition time.
     */
    public long getCompositionTimeOffset() {
        return ctts;
    }

    @Override
    public String toString() {
        return "ctts=" + ctts;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy