| 215 | //----------------------------------------------------------------------------- |
| 216 | |
| 217 | bool OggTheoraDecoder::_packetin( ogg_packet* packet ) |
| 218 | { |
| 219 | ogg_int64_t granulePos; |
| 220 | |
| 221 | if( th_decode_packetin( mTheoraDecoder, packet, &granulePos ) != 0 ) |
| 222 | return false; |
| 223 | |
| 224 | // See if we should drop this frame. |
| 225 | //RDTODO: if we have fallen too far behind, start skipping pages |
| 226 | |
| 227 | F32 granuleTime = th_granule_time( mTheoraDecoder, granulePos ); |
| 228 | mCurrentFrameTime = granuleTime; |
| 229 | mCurrentFrameNumber ++; |
| 230 | |
| 231 | bool dropThisFrame = false; |
| 232 | TimeSourceRef timeSource = mTimeSource; |
| 233 | if( timeSource ) |
| 234 | { |
| 235 | F32 currentTick = F32( timeSource->getPosition() ) / 1000.f; |
| 236 | |
| 237 | if( currentTick >= ( mCurrentFrameTime + mFrameDuration ) ) |
| 238 | dropThisFrame = true; |
| 239 | } |
| 240 | |
| 241 | #ifdef DEBUG_SPEW |
| 242 | Platform::outputDebugString( "[OggTheoraDecoder] new frame %i at %f sec%s", |
| 243 | U32( th_granule_frame( mTheoraDecoder, granulePos ) ), |
| 244 | granuleTime, |
| 245 | dropThisFrame ? " !! DROPPED !!" : "" ); |
| 246 | #endif |
| 247 | |
| 248 | return !dropThisFrame; |
| 249 | } |
| 250 | |
| 251 | //----------------------------------------------------------------------------- |
| 252 |
nothing calls this directly
no test coverage detected