001package net.bramp.ffmpeg.nut; 002 003import java.io.IOException; 004import org.apache.commons.lang3.math.Fraction; 005 006/** Represents a media stream within a NUT multimedia container. */ 007public class Stream { 008 final StreamHeaderPacket header; 009 010 final Fraction timeBase; 011 long last_pts = 0; 012 013 /** Constructs a new stream from the given main header and stream header. */ 014 public Stream(MainHeaderPacket header, StreamHeaderPacket streamHeader) throws IOException { 015 this.header = streamHeader; 016 if (streamHeader.timeBaseId >= header.timeBase.length) { 017 throw new IOException( 018 "Invalid timeBaseId " + streamHeader.timeBaseId + " must be < " + header.timeBase.length); 019 } 020 this.timeBase = header.timeBase[streamHeader.timeBaseId]; 021 } 022}