MP4(3)

NAME

MP4GetSampleRenderingOffset - Get the rendering offset of a track sample

SYNTAX

#include <mp4.h>

MP4Duration MP4GetSampleRenderingOffset(
    MP4FileHandle hFile,
    MP4TrackId trackId,
    MP4SampleId sampleId
);

ARGUMENTS

hFile
    Specifies the mp4 file to which the operation applies.

trackId
    Specifies the track to which the operation applies.

sampleId
    Specifies the sample to which the operation applies. Caveat: the first sample has id 1 not 0.

RETURN VALUES

Upon success, the rendering offset in track time scale units. Upon an error, MP4_INVALID_DURATION.

DESCRIPTION

MP4GetSampleRenderingOffset returns the rendering offset of the specified sample from the specified track in the track time scale units. See MP4ConvertFromTrackDuration() for how to map this value to another time scale.

The sample rendering offset is typically zero for all media types other than video. For video, encodings such as those defined by MPEG have three types of frames: I, P, and B. To increase coding efficiency B frames can depend on I or P frames that should be rendered after the B frame. However to decode the B frame the I or P frame must already have been decoded. This situation is addressed by placing the frames in decoding order in the video track, and then setting the rendering offset property to indicate when the video frame should actually be rendered to the screen. Hence the start time of a sample indicates when it should be decoded, the start time plus the rendering offset indicates when it should be rendered.

SEE ALSO

MP4(3) MP4ConvertFromTrackDuration(3)