![]() For example, a Dolby Digital (AC-3) decoder has a latency of 256 PCM samples. If each input buffer contains a one or more complete compressed frames, with no partial frames, the output time stamp equals the input time stamp, minus the known latency of the decoder.If the input samples contain time stamps, the decoder calculates the output time stamps from the input time stamps, as follows: The correct way to calculate output time stamps depends on whether the input samples contain time stamps. Audio Decodersįor audio decoders, the duration of each output sample is calculated from the audio sampling rate and the number of PCM samples per channel in the output buffer. The only time a transform should output a sample without a time stamp is if the MFT has never received a time stamp on an input sample, or if there is no way to calculate an accurate output time stamp from the previous input time stamp. For these formats, the decoder is responsible for putting a valid time stamp and duration on every output sample, by summing the implied durations of all the output since the last time-stamped input sample.įor video, if the duration is not available in the compressed format, the decoder should calculate the duration as the inverse of the frame rate, converted to 100-nanosecond units and rounded down.įor audio, if the duration is not available in the compressed format, the decoder should calculate the duration as the inverse of the audio sample rate multiplied by the number of samples in the output buffer, converted to 100-nanosecond units and rounded down. Some compressed formats, most notably MPEG-2, do not have time stamps on all input packets and often have no duration on any packet. Because the output is uncompressed, decoders have a special obligation to get the time stamps and durations correct. ![]() That said, there is no reason to deliberately shorten the durations, other than by rounding.Ī decoder converts compressed packets into uncompressed data. The pipeline has enough slack to handle durations that are slightly inaccurate, but it is easier for the pipeline to handle a duration that is 1% too short than a duration that is 1% too long. Calculated durations should be truncated (rounded down), not rounded to the nearest increment.If an input sample does not have duration, the MFT should calculate a duration if possible from the size of the output buffer or the data rate given by the media type. If the input samples have duration, that duration should be preserved.The second example at the end of this section illustrates this idea. To calculate the output time stamp, add the input time stamp of the appropriate input sample to the duration of data that has already been transformed from that sample. In that case, the MFT should calculate the output time stamp from the earliest input sample that contains data used to create the output sample. The output time stamps or durations might not match the input because the MFT is holding back data or breaking the output into different-sized pieces than the input.The time stamps and durations of the input samples should be preserved on the output samples as much as possible.Interpolation may be required for some output time stamps, especially for decoders. An MFT should try to put a time stamp and duration on all uncompressed video or audio output samples if an accurate time stamp or duration is given on the input samples or can be calculated.All MFTs should observe the following basic rules: However, many transforms are more complex than this and may require more complex calculations of output time. For a simple MFT that takes one input buffer and completely processes it into an output buffer, the MFT should just copy the time stamp and duration directly from the input sample to the output sample. This topic describes how Media Foundation Transforms should handle time stamps.Īn MFT must set as accurate a time stamp and duration as possible on all output samples.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |