📄 aviplay_8c.html
字号:
Referenced by <a class="el" href="aviplay_8c-source.html#l00144">PlayAvi()</a>.<p><pre class="fragment"><div>00015 {00016 00017 xdata <a class="code" href="unionAddress.html">addressType</a> instream;00018 xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> blockType = 0;00019 bit isPadded = 0;00020 00021 <a class="code" href="aviplay_8c.html#a4">GetLongWord</a>();00022 <span class="keywordflow">if</span> ((instream.b.b2 == <span class="charliteral">'w'</span>) && (instream.b.b3 == <span class="charliteral">'b'</span>)){00023 blockType = <a class="code" href="aviplay_8c.html#a3">btAUDIO</a>;00024 }00025 <span class="keywordflow">if</span> (instream.l==1414744396){ <span class="comment">//LIST</span>00026 blockType = <a class="code" href="aviplay_8c.html#a1">btLIST</a>;00027 }00028 <a class="code" href="aviplay_8c.html#a4">GetLongWord</a>();00029 <span class="comment">//instream.l should now contain the chunk size.</span>00030 <span class="comment">//its length must be even by spec. if it's odd, a pad byte is </span>00031 <span class="comment">//in the file but its NOT part of chunk data.</span>00032 <span class="keywordflow">if</span> (instream.b.b0&1){00033 isPadded = 1; <span class="comment">//There is a pad byte to make chunk len even</span>00034 }<span class="keywordflow">else</span>{00035 isPadded = 0;00036 }00037 00038 00039 <span class="keywordflow">if</span> (blockType == <a class="code" href="aviplay_8c.html#a3">btAUDIO</a>){00040 <span class="comment">//--------THIS PACKET IS SENT TO VS10xx---------</span>00041 <span class="comment">//superbly hilarious effects could happen if the avifile has</span>00042 <span class="comment">//more than 1 soundtrack as all of them would be sent to VS10xx</span>00043 00044 <span class="keywordflow">while</span>(instream.l){00045 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c;00046 00047 <span class="keywordflow">while</span> ((instream.l>16)&&(<a class="code" href="buffer_8c.html#a1">dataBufPtr</a> < <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>+496)){00048 <span class="comment">//We have at least 16 octets of continuous stream in mem.</span>00049 <span class="keywordflow">if</span> (!<a class="code" href="board_8h.html#a9">MP3_DREQ</a>){00050 <a class="code" href="board_8h.html#a11">GREEN_LED</a> = <a class="code" href="board_8h.html#a12">LED_ON</a>;00051 <span class="keywordflow">while</span> (!<a class="code" href="board_8h.html#a9">MP3_DREQ</a>){00052 <a class="code" href="board_8h.html#a8">Mp3DeselectData</a>();00053 <a class="code" href="player_8c.html#a12">AvailableProcessorTime</a>();00054 }00055 }00056 <a class="code" href="board_8h.html#a11">GREEN_LED</a> = <a class="code" href="board_8h.html#a13">LED_OFF</a>;00057 <a class="code" href="board_8h.html#a7">Mp3SelectData</a>();00058 <a class="code" href="board_8h.html#a43">SPIPutCharWithoutWaiting</a>(*dataBufPtr++);00059 <a class="code" href="board_8h.html#a41">SPIWait</a>();00060 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00061 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00062 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00063 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00064 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00065 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00066 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00067 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00068 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00069 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00070 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00071 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00072 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00073 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00074 <a class="code" href="board_8h.html#a42">SPIPutChar</a>(*dataBufPtr++);00075 instream.l-=16;00076 <a class="code" href="filesys_8c.html#a7">fileSize</a>-=16;00077 <a class="code" href="board_8h.html#a41">SPIWait</a>(); 00078 }00079 00080 <a class="code" href="board_8h.html#a6">MP3_XDCS</a>=1;00081 instream.l--;00082 c=<a class="code" href="filesys_8c.html#a21">FGetChar</a>(); <span class="comment">//data comes first until end of sector and</span>00083 <span class="comment">//then a new sector is loaded automagically.</span>00084 <a class="code" href="board_8h.html#a6">MP3_XDCS</a>=0;00085 <a class="code" href="board_8h.html#a43">SPIPutCharWithoutWaiting</a>(c);00086 <span class="comment">//SPIWait(); </span>00087 } 00088 <a class="code" href="board_8h.html#a6">MP3_XDCS</a>=1;00089 }<span class="keywordflow">else</span> <span class="keywordflow">if</span> (blockType == <a class="code" href="aviplay_8c.html#a1">btLIST</a>){00090 ConsoleWrite(<span class="stringliteral">"\rAVI: List of "</span>);00091 <a class="code" href="aviplay_8c.html#a4">GetLongWord</a>();00092 ConsolePutChar(instream.b.b0);00093 ConsolePutChar(instream.b.b1);00094 ConsolePutChar(instream.b.b2);00095 ConsolePutChar(instream.b.b3);00096 00097 }<span class="keywordflow">else</span>{00098 <span class="comment">//We don't need this chunk. Let's quickly skip over it.</span>00099 00100 <span class="comment">//Is pad byte insertion needed?</span>00101 <span class="keywordflow">if</span> (isPadded){00102 instream.l++; <span class="comment">//instream.l contains chunk size</span>00103 isPadded = 0;00104 }00105 00106 <span class="comment">//Skip to the end of sector</span>00107 <span class="keywordflow">if</span> (instream.l>(<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>=<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>+512-<a class="code" href="buffer_8c.html#a1">dataBufPtr</a>)){00108 <span class="comment">//The packet continues after end of sector</span>00109 instream.l -= <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>;00110 <a class="code" href="filesys_8c.html#a7">fileSize</a> -= <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o1">i</a>;00111 <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>++; <span class="comment">//Sector handled, go to next.</span>00112 <a class="code" href="buffer_8c.html#a1">dataBufPtr</a> = 0; <span class="comment">//Complete sector is handled.</span>00113 }00114 00115 <span class="comment">//Skip unnecessary sectors</span>00116 <span class="keywordflow">if</span> (instream.l>512){00117 <span class="keywordflow">while</span> (instream.l>512){00118 <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>++;00119 instream.l -= 512;00120 <a class="code" href="filesys_8c.html#a7">fileSize</a> -= 512;00121 }00122 <a class="code" href="buffer_8c.html#a1">dataBufPtr</a> = 0; <span class="comment">//Initialize for next call to FGetChar();</span>00123 }00124 00125 <span class="comment">//Read last sector into memory</span>00126 <span class="keywordflow">if</span> (<a class="code" href="buffer_8c.html#a1">dataBufPtr</a> == 0){00127 <a class="code" href="storage_8h.html#a2">ReadDiskSector</a>(<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00128 <a class="code" href="buffer_8c.html#a1">dataBufPtr</a> = <a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>;00129 }00130 <span class="keywordflow">while</span> (instream.l--){00131 <a class="code" href="buffer_8c.html#a1">dataBufPtr</a>++;00132 } 00133 }<span class="comment">//nothing interesting,skip block</span>00134 00135 <span class="keywordflow">if</span> (isPadded){00136 <a class="code" href="filesys_8c.html#a21">FGetChar</a>();00137 }00138 00139 }</div></pre><p>Here is the call graph for this function:<p><center><img src="aviplay_8c_a5_cgraph.png" border="0" usemap="#aviplay_8c_a5_cgraph_map" alt=""></center><map name="aviplay_8c_a5_cgraph_map"><area href="player_8c.html#a12" shape="rect" coords="148,132,297,156" alt=""><area href="filesys_8c.html#a21" shape="rect" coords="191,277,255,301" alt=""><area href="storage_8h.html#a2" shape="rect" coords="521,301,622,325" alt=""><area href="lcd_8c.html#a4" shape="rect" coords="376,6,437,30" alt=""><area href="lcd_8h.html#a5" shape="rect" coords="526,32,617,56" alt=""><area href="vs10xx_8h.html#a38" shape="rect" coords="516,132,628,156" alt=""><area href="player_8c.html#a11" shape="rect" coords="345,156,468,180" alt=""><area href="display_8c.html#a7" shape="rect" coords="361,203,452,227" alt=""><area href="filesys_8c.html#a20" shape="rect" coords="356,251,457,275" alt=""></map> </td> </tr></table><a class="anchor" name="a6" doxytag="aviplay.c::PlayAvi" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> unsigned char PlayAvi </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Try to play an avi file at current sector. <p>Returns 0x11 if AVI header is not found, 0 if the file is played. <p>Definition at line <a class="el" href="aviplay_8c-source.html#l00144">144</a> of file <a class="el" href="aviplay_8c-source.html">aviplay.c</a>.<p>References <a class="el" href="buffer_8h-source.html#l00107">DiskBlock::Raw::buf</a>, <a class="el" href="buffer_8c-source.html#l00013">dataBufPtr</a>, <a class="el" href="buffer_8c-source.html#l00010">diskSect</a>, <a class="el" href="filesys_8c-source.html#l00047">fileSize</a>, <a class="el" href="aviplay_8c-source.html#l00015">GetAVIBlock()</a>, <a class="el" href="buffer_8h-source.html#l00129">Address::l</a>, <a class="el" href="unionDiskBlock.html#o1">DiskBlock::raw</a>, <a class="el" href="storage_8c-source.html#l00110">ReadDiskSector()</a>, and <a class="el" href="buffer_8c-source.html#l00015">sectorAddress</a>.<p>Referenced by <a class="el" href="vs10xx_8c-source.html#l00202">PlayDiskSectors()</a>.<p><pre class="fragment"><div>00144 {00145 00146 <a class="code" href="storage_8h.html#a2">ReadDiskSector</a>(<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00147 00148 <span class="comment">//DumpDiskSector();</span>00149 00150 <span class="keywordflow">if</span> (<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[8]!=<span class="charliteral">'A'</span>) <span class="keywordflow">return</span> 0x11;00151 <span class="keywordflow">if</span> (<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[9]!=<span class="charliteral">'V'</span>) <span class="keywordflow">return</span> 0x11;00152 <span class="keywordflow">if</span> (<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>[10]!=<span class="charliteral">'I'</span>) <span class="keywordflow">return</span> 0x11;00153 ConsoleWrite(<span class="stringliteral">"\rPlayAvi()\r"</span>);00154 00155 <a class="code" href="buffer_8c.html#a1">dataBufPtr</a>=<a class="code" href="buffer_8c.html#a0">diskSect</a>.<a class="code" href="unionDiskBlock.html#o1">raw</a>.<a class="code" href="structDiskBlock_1_1Raw.html#o0">buf</a>+12;00156 00157 <span class="keywordflow">while</span>(<a class="code" href="filesys_8c.html#a7">fileSize</a>){00158 <a class="code" href="aviplay_8c.html#a5">GetAVIBlock</a>();00159 }00160 00161 <span class="keywordflow">return</span> 0;00162 }</div></pre><p>Here is the call graph for this function:<p><center><img src="aviplay_8c_a6_cgraph.png" border="0" usemap="#aviplay_8c_a6_cgraph_map" alt=""></center><map name="aviplay_8c_a6_cgraph_map"><area href="aviplay_8c.html#a5" shape="rect" coords="116,80,199,104" alt=""><area href="storage_8h.html#a2" shape="rect" coords="445,104,546,128" alt=""><area href="player_8c.html#a12" shape="rect" coords="247,6,396,30" alt=""><area href="filesys_8c.html#a21" shape="rect" coords="289,54,353,78" alt=""></map> </td> </tr></table><hr><FONT SIZE="-1">All software copyright 2000-2004 <a href="http://www.vlsi.fi/"> VLSI Solution OY.</a>Redistribution of these software modules are limited to promotional use onlyand only with the VS1011 / VS1002 / VS1003 MP3-Evakit evaluation boards. Free orcommercial use of these software modules in MP3 players is ok if theproduct includes MP3 decoder chip(s) from VLSI. You can request the complete(compilable) package from mp3@vlsi.fi</FONT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -