Package limn.video.decode
Record Class SyntheticSpec
java.lang.Object
java.lang.Record
limn.video.decode.SyntheticSpec
- Record Components:
pattern- what the pictures drawwidth- picture width in pixels, in[1..PixelFormat.MAX_DIMENSION]height- picture height in pixels, in the same rangeformat- the plane layout every picture usescolor- how every picture's samples are to be interpretedframeRateNum- numerator of the nominal frame rate, at least 1 (kept rational so that 30000/1001 is exact rather than a drifting decimal)frameRateDen- denominator of the nominal frame rate, at least 1frameCount- pictures before the stream ends, or 0 for a stream that never ends; the endless one is the default because a demo surface wants something to show for as long as it is on screen, and a finite one is what a test asserts an end onslots- pictures in flight at once, in[1..FramePool.MAX_SLOTS]
public record SyntheticSpec(SyntheticPattern pattern, int width, int height, PixelFormat format, VideoColor color, int frameRateNum, int frameRateDen, int frameCount, int slots)
extends Record
The whole description of a synthetic stream: what it draws, how
big, in which layout, under which colour interpretation, how fast, for how long, and how many
pictures it keeps in flight.
It has a text form, and the text form is a file name: pattern=counter,size=640x360,
format=I420,color=BT709_LIMITED,rate=30-1,frames=0,slots=3.synth. That is what lets a stream that
has no file behind it be opened through the same facade a real file is, with the same
canOpen/open pair and the same install order, instead of through a side door only
this decoder has. Every field appears, so the text round-trips exactly and two specs that print
the same are the same.
Immutable. The with… methods return a new spec, so a caller starts from
of(int, int) and changes the axis it cares about.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSyntheticSpec(SyntheticPattern pattern, int width, int height, PixelFormat format, VideoColor color, int frameRateNum, int frameRateDen, int frameCount, int slots) Creates an instance of aSyntheticSpecrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncolor()Returns the value of thecolorrecord component.longfinal booleanIndicates whether some other object is "equal to" this one.fileName()format()Returns the value of theformatrecord component.intReturns the value of theframeCountrecord component.intReturns the value of theframeRateDenrecord component.intReturns the value of theframeRateNumrecord component.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.static SyntheticSpecof(int width, int height) Colour bars atwidth × height, I420, BT.709 studio range, 30 per second, endless, three pictures in flight.static SyntheticSpecReads back whattoString()wrote.path()pattern()Returns the value of thepatternrecord component.longptsMicrosOf(int frameIndex) The presentation time of pictureframeIndex, in microseconds from the start of the stream.intslots()Returns the value of theslotsrecord component.toString()The text form: every field, in a fixed order, readable back byparse(java.lang.String).intwidth()Returns the value of thewidthrecord component.withColor(VideoColor newColor) withFormat(PixelFormat newFormat) withFrameCount(int count) withPattern(SyntheticPattern newPattern) withRate(int num, int den) withSize(int newWidth, int newHeight) withSlots(int count)
-
Field Details
-
EXTENSION
What a synthetic stream's file name ends with; nothing else claims it.- See Also:
-
-
Constructor Details
-
SyntheticSpec
public SyntheticSpec(SyntheticPattern pattern, int width, int height, PixelFormat format, VideoColor color, int frameRateNum, int frameRateDen, int frameCount, int slots) Creates an instance of aSyntheticSpecrecord class.- Parameters:
pattern- the value for thepatternrecord componentwidth- the value for thewidthrecord componentheight- the value for theheightrecord componentformat- the value for theformatrecord componentcolor- the value for thecolorrecord componentframeRateNum- the value for theframeRateNumrecord componentframeRateDen- the value for theframeRateDenrecord componentframeCount- the value for theframeCountrecord componentslots- the value for theslotsrecord component
-
-
Method Details
-
of
Colour bars atwidth × height, I420, BT.709 studio range, 30 per second, endless, three pictures in flight.- Throws:
IllegalArgumentException- if a dimension is outside[1..MAX_DIMENSION]
-
withPattern
- Returns:
- the same spec drawing
newPattern
-
withSize
- Returns:
- the same spec at
newWidth × newHeight
-
withFormat
- Returns:
- the same spec in
newFormat
-
withColor
- Returns:
- the same spec interpreted as
newColor
-
withRate
- Returns:
- the same spec at
num/denpictures a second
-
withFrameCount
- Returns:
- the same spec ending after
countpictures, or endless when 0
-
withSlots
- Returns:
- the same spec keeping
countpictures in flight
-
durationMicros
public long durationMicros()- Returns:
- total length in microseconds, or
VideoStreamSource.DURATION_UNKNOWNfor an endless stream
-
ptsMicrosOf
public long ptsMicrosOf(int frameIndex) The presentation time of pictureframeIndex, in microseconds from the start of the stream. Computed from the rational rate rather than accumulated from an interval, so picture 100000 of a 30000/1001 stream is exact rather than a hundred milliseconds adrift.- Throws:
IllegalArgumentException- ifframeIndexis negative
-
fileName
- Returns:
- the file name this spec is opened under:
toString()plusEXTENSION. The file need not exist and is never read; it is the description that is being passed, not a location.
-
path
- Returns:
fileName()as a path, ready forVideos.open(java.nio.file.Path). Relative and bare, so nothing resolves it against a directory that would have to exist.
-
parse
Reads back whattoString()wrote. Keys may appear in any order and any of them may be left out, in which caseof(int, int)supplies it; the value of an unrecognised key is a failure rather than something skipped, because a misspelled key that was silently ignored would leave a stream quietly running at the wrong size.- Parameters:
text- a comma-separated list ofkey=value, with or without theEXTENSIONsuffix- Throws:
IllegalArgumentException- if a key is unknown, a value cannot be read, or a value is outside the range its component allows; the message names the offending keyNullPointerException- iftextis null
-
toString
The text form: every field, in a fixed order, readable back byparse(java.lang.String). -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
pattern
Returns the value of thepatternrecord component.- Returns:
- the value of the
patternrecord component
-
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public int height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-
format
Returns the value of theformatrecord component.- Returns:
- the value of the
formatrecord component
-
color
Returns the value of thecolorrecord component.- Returns:
- the value of the
colorrecord component
-
frameRateNum
public int frameRateNum()Returns the value of theframeRateNumrecord component.- Returns:
- the value of the
frameRateNumrecord component
-
frameRateDen
public int frameRateDen()Returns the value of theframeRateDenrecord component.- Returns:
- the value of the
frameRateDenrecord component
-
frameCount
public int frameCount()Returns the value of theframeCountrecord component.- Returns:
- the value of the
frameCountrecord component
-
slots
public int slots()Returns the value of theslotsrecord component.- Returns:
- the value of the
slotsrecord component
-