MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / init

Method init

Engine/source/core/ogg/oggInputStream.cpp:139–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139bool OggInputStream::init()
140{
141 if( !mStream->hasCapability( Stream::StreamPosition ) )
142 return false;
143
144 mStream->setPosition( 0 );
145
146 // Read all beginning-of-stream pages and construct decoders
147 // for all streams we recognize.
148
149 while( 1 )
150 {
151 // Read next page.
152
153 ogg_page startPage;
154 _pullNextPage( &startPage );
155
156 // If not a beginning-of-stream page, push it to the decoders
157 // and stop reading headers.
158
159 if( !ogg_page_bos( &startPage ) )
160 {
161 _pushNextPage( &startPage );
162 break;
163 }
164
165 // Try the list of constructors for one that consumes
166 // the page.
167
168 for( U32 i = 0; i < mConstructors.size(); ++ i )
169 {
170 OggDecoder* decoder = mConstructors[ i ]( this );
171 if( decoder->_detect( &startPage ) )
172 mDecoders.push_back( decoder );
173 else
174 delete decoder;
175 }
176 }
177
178 // Initialize decoders and let all them finish up header processing.
179
180 for( U32 i = 0; i < mDecoders.size(); ++ i )
181 if( !mDecoders[ i ]->_init() )
182 {
183 delete mDecoders[ i ];
184 mDecoders.erase( i );
185 -- i;
186 }
187
188 if( !mDecoders.size() )
189 return false;
190
191 return true;
192}
193
194void OggInputStream::_freeDecoders()
195{

Callers

nothing calls this directly

Calls 8

ogg_page_bosFunction · 0.85
hasCapabilityMethod · 0.45
setPositionMethod · 0.45
sizeMethod · 0.45
_detectMethod · 0.45
push_backMethod · 0.45
_initMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected