<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=gb2312"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@ËÎÌå";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-indent:21.0pt;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle18
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:2012945164;
mso-list-type:hybrid;
mso-list-template-ids:517657512 -1395105086 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:18.0pt;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-text:"%2\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:42.0pt;
text-indent:-21.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:63.0pt;
text-indent:-21.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:84.0pt;
text-indent:-21.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-text:"%5\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:105.0pt;
text-indent:-21.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:126.0pt;
text-indent:-21.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:147.0pt;
text-indent:-21.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-text:"%8\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:168.0pt;
text-indent:-21.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:189.0pt;
text-indent:-21.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link="#0563C1" vlink="#954F72" style='text-justify-trim:punctuation'><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Today I analyse the .tsx file¡¯s generation logical. Here is my founding:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-US>In MPEG2TransportStreamIndexFile.hh<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt;text-indent:0cm'><span lang=EN-US>#define INDEX_RECORD_SIZE 11<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-US>In MPEG2TransportStreamIndexFile.cpp<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>238 Boolean MPEG2TransportStreamIndexFile::seekToIndexRecord(unsigned long indexRecordNumber) {<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>239 if (!openFid()) return False;<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>240 <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>241 if (indexRecordNumber == fCurrentIndexRecordNum) return True; // we're already there<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>242 <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>243 if (SeekFile64(fFid, (int64_t)(indexRecordNumber*INDEX_RECORD_SIZE), SEEK_SET) != 0) return False;<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>244 fCurrentIndexRecordNum = indexRecordNumber;<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>245 return True;<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>246 }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Which we can got conclusion, the .tsx¡¯s item is 11 bytes long.<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-US>Still In MPEG2TransportStreamIndexFile.cpp<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>float MPEG2TransportStreamIndexFile::pcrFromBuf() { <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US> unsigned pcr_int = (fBuf[5]<<16) | (fBuf[4]<<8) | fBuf[3]; <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US> u_int8_t pcr_frac = fBuf[6]; <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US> return pcr_int + pcr_frac/256.0f; <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>} <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>//Conclusion A : item[3-6] is a time-anchor.<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US><o:p> </o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US>unsigned long MPEG2TransportStreamIndexFile::tsPacketNumFromBuf() { <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt'><span lang=EN-US> return (fBuf[10]<<24) | (fBuf[9]<<16) | (fBuf[8]<<8) | fBuf[7]; <o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:36.0pt;text-indent:3.0pt'><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:36.0pt;text-indent:3.0pt'><span lang=EN-US>//Conclusion B: item[7-10] is .tsx file¡¯s item index.<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:36.0pt;text-indent:3.0pt'><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US> Boolean MPEG2TransportStreamIndexFile::seekToIndexRecord(unsigned long indexRecordNumber) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> if (!openFid()) return False;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt'><span lang=EN-US>if (indexRecordNumber == fCurrentIndexRecordNum) return True; // we're already there<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal style='text-indent:31.5pt'><span lang=EN-US> if (SeekFile64(fFid, (int64_t)(indexRecordNumber*INDEX_RECORD_SIZE), SEEK_SET) != 0) return False;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:10.5pt;text-indent:21.0pt'><span lang=EN-US> fCurrentIndexRecordNum = indexRecordNumber;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:10.5pt;text-indent:21.0pt'><span lang=EN-US> return True;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt'><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoNormal style='margin-left:21.0pt;text-indent:21.0pt'><span lang=EN-US>//Conclusion C: item[0~7] is record the frame position in .ts file.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>It seems like Conclussion A, B, C can not be all right. Especially Conclusion B and C could not be both right.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>And, I have make a experiment, the trick play can not work property (through vlc media player).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Wait for your opionion, thanks a lot.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Fengxh, China<o:p></o:p></span></p></div></body></html>