mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
mp4点播支持pts
This commit is contained in:
parent
030d8f6d53
commit
adf0e09262
@ -219,7 +219,8 @@ inline bool MP4Reader::readVideoSample(int iTimeInc,bool justSeekSyncFrame) {
|
|||||||
for (; iIdx < iNextSample; iIdx++) {
|
for (; iIdx < iNextSample; iIdx++) {
|
||||||
uint8_t *pBytes = _pcVideoSample.get();
|
uint8_t *pBytes = _pcVideoSample.get();
|
||||||
uint32_t numBytes = _video_sample_max_size;
|
uint32_t numBytes = _video_sample_max_size;
|
||||||
if(MP4ReadSample(_hMP4File, _video_trId, iIdx + 1, &pBytes, &numBytes,NULL,NULL,NULL,&_bSyncSample)){
|
MP4Duration pRenderingOffset;
|
||||||
|
if(MP4ReadSample(_hMP4File, _video_trId, iIdx + 1, &pBytes, &numBytes,NULL,NULL,&pRenderingOffset,&_bSyncSample)){
|
||||||
if (!justSeekSyncFrame) {
|
if (!justSeekSyncFrame) {
|
||||||
uint32_t iOffset = 0;
|
uint32_t iOffset = 0;
|
||||||
while (iOffset < numBytes) {
|
while (iOffset < numBytes) {
|
||||||
@ -230,7 +231,8 @@ inline bool MP4Reader::readVideoSample(int iTimeInc,bool justSeekSyncFrame) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(pBytes + iOffset, "\x0\x0\x0\x1", 4);
|
memcpy(pBytes + iOffset, "\x0\x0\x0\x1", 4);
|
||||||
writeH264(pBytes + iOffset, iFrameLen + 4, (double) _video_ms * iIdx / _video_num_samples, 0);
|
uint32_t dts = (double) _video_ms * iIdx / _video_num_samples;
|
||||||
|
writeH264(pBytes + iOffset, iFrameLen + 4, dts, dts + pRenderingOffset / 90);
|
||||||
iOffset += (iFrameLen + 4);
|
iOffset += (iFrameLen + 4);
|
||||||
}
|
}
|
||||||
}else if(_bSyncSample){
|
}else if(_bSyncSample){
|
||||||
|
Loading…
Reference in New Issue
Block a user