[Live-devel] trick play works well? I don't think so.

冯旭辉 fengxh at hnthinker.com
Fri Feb 19 00:17:31 PST 2016


Today I analyse the .tsx file’s generation logical. Here is my founding:

 

1.       In MPEG2TransportStreamIndexFile.hh

#define INDEX_RECORD_SIZE 11

2.       In MPEG2TransportStreamIndexFile.cpp

238  Boolean MPEG2TransportStreamIndexFile::seekToIndexRecord(unsigned long
indexRecordNumber) {

239   if (!openFid()) return False;

240 

241   if (indexRecordNumber == fCurrentIndexRecordNum) return True; // we're
already there

242 

243   if (SeekFile64(fFid, (int64_t)(indexRecordNumber*INDEX_RECORD_SIZE),
SEEK_SET) != 0) return False;

244   fCurrentIndexRecordNum = indexRecordNumber;

245   return True;

246 }

Which we can got conclusion, the .tsx’s item is 11 bytes long.

3.       Still In MPEG2TransportStreamIndexFile.cpp

float MPEG2TransportStreamIndexFile::pcrFromBuf() { 

  unsigned pcr_int = (fBuf[5]<<16) | (fBuf[4]<<8) | fBuf[3]; 

  u_int8_t pcr_frac = fBuf[6]; 

  return pcr_int + pcr_frac/256.0f; 

} 

//Conclusion A : item[3-6] is a time-anchor.

 

unsigned long MPEG2TransportStreamIndexFile::tsPacketNumFromBuf() { 

  return (fBuf[10]<<24) | (fBuf[9]<<16) | (fBuf[8]<<8) | fBuf[7]; 

}

//Conclusion B: item[7-10] is .tsx file’s item index.

 

                   Boolean
MPEG2TransportStreamIndexFile::seekToIndexRecord(unsigned long
indexRecordNumber) {

                if (!openFid()) return False;

 

if (indexRecordNumber == fCurrentIndexRecordNum) return True; // we're
already there

 

  if (SeekFile64(fFid, (int64_t)(indexRecordNumber*INDEX_RECORD_SIZE),
SEEK_SET) != 0) return False;

  fCurrentIndexRecordNum = indexRecordNumber;

  return True;

}

//Conclusion C: item[0~7] is record the frame position in .ts file.

 

It seems like Conclussion A, B, C can not be all right. Especially
Conclusion B and C could not be both right.

 

And, I have make a experiment, the trick play can not work property (through
vlc media player).

Wait for your opionion, thanks a lot.

 

Fengxh, China

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20160219/c374307c/attachment.html>


More information about the live-devel mailing list