Example #1
0
 public void setCurrentFrame(int frameIdx) {
   final FramePositioningControl fpc = getFramePosCtrl();
   if (fpc != null) {
     // f*****g scheiss don't work
     //			fpc.seek( frameIdx );
     // this don't work either. returns null
     final Time t = fpc.mapFrameToTime(frameIdx);
     // System.err.println( t );
     if ((t != null) && (t != Time.TIME_UNKNOWN)) {
       mp.setMediaTime(t);
     } else {
       // fobs is in fact so sucky, it will never do what JMF defines.
       // for example mapTimeToFrame returns 0 instead of FRAME_UNKNOWN
       // so it's comletely useless. bloody bastards.
       //				final int currentFrame = fpc.mapTimeToFrame( mp.getMediaTime() );
       //				if( currentFrame != FramePositioningControl.FRAME_UNKNOWN ) {
       //					System.err.println( "currentFrame = "+currentFrame+" so delta is " + (frameIdx -
       // currentFrame) );
       //					skip( frameIdx - currentFrame );
       //				} else { // ok, try the cheesy way
       final FrameRateControl frc = getFrameRateCtrl();
       if (frc != null) {
         float fps;
         fps = frc.getPreferredFrameRate();
         if (fps <= 0f) {
           fps = frc.getFrameRate() / mp.getRate();
         }
         if (fps > 0f) { // sucky fobs returns 0f instead of -1f!!!
           System.err.println(
               "frameIdx "
                   + frameIdx
                   + "; fps = "
                   + fps
                   + "; frameIdx / fps = "
                   + (frameIdx / fps));
           mp.setMediaTime(new Time(frameIdx / fps));
         }
       } else {
         System.err.println("MovieView.setCurrentFrame : N.A.");
       }
       //				}
     }
   }
 }
Example #2
0
 public void skip(int numFrames) {
   final FramePositioningControl fpc = getFramePosCtrl();
   if (fpc != null) {
     fpc.skip(numFrames);
   }
 }