HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file media.video.VideoFile by barry
expand copy to clipboardexpand
/* {"description" : "Header information from a video file. An actual video file format will have its own internal header format; the fields of that internal header format are read into this abstract common header." } */
data VideoHeader {
	/* {"@description" : "The width of the video, in pixels." } */
	int width
	/* {"@description" : "The height of the video, in pixels." } */
	int height
	/* {"@description" : "The total number of frames of the video, if known to the global header." } */
	int frames
	/* {"@description" : "The fourcc identifier of the video, indicating what kind of decoder is needed to decode it." } */
	char fourcc[4]
	/* {"@description" : "The numerator of the video's frame rate." } */
	int numerator
	/* {"@description" : "The denominator of the video's frame rate." } */
	int denominator
	/* {"@description" : "The length in bytes of the overall video header in the encoded file (this header instance is an abstract one constructed from a format-specific header in the encoded video file)." } */
	int headerLength
}

/* {"description" : "A frame of encoded video." } */
data VideoFrame {
	/* {"@description" : "The encoded data, which needs to be presented to a decoder to gain the corresponding decoded pixels." } */
	byte content[]
	/* {"@description" : "The length in bytes of the header in the encoded file (this can be added to the length of content to derive the entire length of the encoded frame)." } */
	int headerLength
	/* {"@description" : "The timestamp of this video frame within the timeline of the video (if available)." } */
	int timestamp
}

/* {"description" : "API to read a video file." } */
interface VideoFile {
	/* {"@description" : "Checks if a video file has a valid header, for a given semantic variant of this API." } */
	bool validHeader(byte content[])
	
	/* {"@description" : "Reads the video header." } */
	VideoHeader readHeader(byte content[])

	/* {"@description" : "Reads a frame of (usually encoded) video, from the given offset of a byte array." } */
	VideoFrame readFrame(byte content[], int offset)

	/* {"@description" : "Writes the video header to a byte array." } */
	byte[] writeHeader(VideoHeader hdr)

	/* {"@description" : "Writes a frame of (usually encoded) video to a byte array." } */
	byte[] writeFrame(VideoFrame f)
}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n media.video.VideoFile -m "reason for update" -u yourUsername
Version 3 (this version) by barry
Notes for this version: Updates to documentation strings.
Version 2 by barry
Version 1 by barry