[Scummvm-cvs-logs] CVS: scummvm/sword1 animation.cpp,1.22,1.23 animation.h,1.12,1.13
Max Horn
fingolfin at users.sourceforge.net
Mon Mar 22 16:21:07 CET 2004
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3834/sword1
Modified Files:
animation.cpp animation.h
Log Message:
Unify MPEG2 code even more
Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- animation.cpp 22 Mar 2004 20:46:30 -0000 1.22
+++ animation.cpp 23 Mar 2004 00:10:18 -0000 1.23
@@ -43,79 +43,13 @@
#endif
-bool AnimationState::decodeFrame() {
-#ifdef USE_MPEG2
- mpeg2_state_t state;
- const mpeg2_sequence_t *sequence_i;
- size_t size = (size_t) -1;
-
- do {
- state = mpeg2_parse(decoder);
- sequence_i = info->sequence;
-
- switch (state) {
- case STATE_BUFFER:
- size = mpgfile->read(buffer, BUFFER_SIZE);
- mpeg2_buffer(decoder, buffer, buffer + size);
- break;
-
- case STATE_SLICE:
- case STATE_END:
- if (info->display_fbuf) {
- /* simple audio video sync code:
- * we calculate the actual frame by taking the elapsed audio time and try
- * to stay inside +- 1 frame of this calculated frame number by dropping
- * frames if we run behind and delaying if we are too fast
- */
-
- /* Avoid deadlock is sound was too far ahead */
- if (bgSoundStream && !bgSound.isActive())
- return false;
-
- if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
- ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) ||
- frameskipped > 10) {
- if (frameskipped > 10) {
- warning("force frame %i redraw", framenum);
- frameskipped = 0;
- }
+void AnimationState::drawYUV(int width, int height, byte *const *dat) {
#ifdef BACKEND_8BIT
- _scr->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
+ _scr->plotYUV(lut, width, height, dat);
#else
- plotYUV(lookup, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
- _sys->copy_rect_overlay(overlay, MOVIE_WIDTH, 0, 40, MOVIE_WIDTH, MOVIE_HEIGHT);
-#endif
-
- if (bgSoundStream) {
- while ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum)
- _sys->delay_msecs(10);
- } else {
- ticks += 83;
- while (_sys->get_msecs() < ticks)
- _sys->delay_msecs(10);
- }
-
- } else {
- warning("dropped frame %i", framenum);
- frameskipped++;
- }
-
-#ifdef BACKEND_8BIT
- buildLookup(palnum + 1, lutcalcnum);
-#endif
-
- framenum++;
- return true;
-
- }
- break;
-
- default:
- break;
- }
- } while (size);
+ plotYUV(lookup, width, height, dat);
+ _sys->copy_rect_overlay(overlay, MOVIE_WIDTH, 0, 40, MOVIE_WIDTH, MOVIE_HEIGHT);
#endif
- return false;
}
MoviePlayer::MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys)
Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- animation.h 22 Mar 2004 20:46:30 -0000 1.12
+++ animation.h 23 Mar 2004 00:10:18 -0000 1.13
@@ -39,9 +39,8 @@
AnimationState(Screen *scr, SoundMixer *snd, OSystem *sys);
~AnimationState();
- bool decodeFrame();
-
private:
+ void drawYUV(int width, int height, byte *const *dat);
#ifdef BACKEND_8BIT
void setPalette(byte *pal);
More information about the Scummvm-git-logs
mailing list