gpt4 book ai didi

c++ - IMediaSample 时间和 MediaTime

转载 作者:太空宇宙 更新时间:2023-11-04 13:35:12 25 4
gpt4 key购买 nike

SetTime 和 SetMediaTime 之间的主要区别是什么?

现在在我的 directshow 直播源中我是这样计算时间的

REFERENCE_TIME rtStart = m_rtLastSampleTime;
m_rtLastSampleTime += pVih->AvgTimePerFrame;
pms->SetTime(&rtStart, &m_rtLastSampleTime);
pms->SetSyncPoint(TRUE);
pms->SetDiscontinuity(rtStart <= 1);

这不适用于某些编码器。
我注意到与这些编码器一起工作的源设置了媒体时间,它们似乎跳起来了。

最佳答案

Media Times :

Optionally, the filter can also specify a media time for the sample. In a video stream, media time represents the frame number. In an audio stream, media time represents the sample number in the packet. For example, if each packet contains one second of 44.1 kilohertz (kHz) audio, the first packet has a media start time of zero and a media stop time of 44100. In a seekable stream, the media time is always relative to the start time of the stream. For example, suppose you seek to 2 seconds from the start of a 15-fps video stream. The first media sample after the seek has a time stamp of zero but a media time of 30.

Renderer and mux filters can use the media time to determine whether frames or samples have been dropped, by checking for gaps. However, filters are not required to set the media time. To set the media time on a sample, call the IMediaSample::SetMediaTime method.

我不认为它实际上用于任何地方。 SetTime 恰恰相反,它很重要。

关于c++ - IMediaSample 时间和 MediaTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29802917/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com