seek.m 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. function worked = seek(vr,fnum)
  2. %WORKED=SEEK(VR,FNUM)
  3. % Attempts to go to frame number FNUM in video VR. Returns 0 if the user
  4. % attempts to seek past the end of the video. For most video plugins, the
  5. % first frame is 0 (not 1), thus in the following example, both IM1 and
  6. % IM2 should be the same for most plugins.
  7. % vr = videoReader(...);
  8. % if (~next(vr)), error('couldn''t read first frame'); end
  9. % im1 = getframe(vr);
  10. % if (~seek(vr,0)), error('could not seek to frame 0'); end
  11. % im2 = getframe(vr);
  12. % if (any(im1 ~= im2)),
  13. % error('first frame and frame 0 are not the same');
  14. % end
  15. % ...
  16. % vr = close(vr);
  17. % FNUM should be an integer.
  18. %
  19. % After the videoReader constructor is called, NEXT, SEEK, or STEP should
  20. % be called at least once before GETFRAME is called.
  21. %
  22. % See videoReader/getinfo for more details on how many frames can be read
  23. % from a video.
  24. %
  25. %SEE ALSO
  26. % videoReader
  27. %
  28. %Copyright (c) 2006 Gerald Dalley
  29. %See "MIT.txt" in the installation directory for licensing details (especially
  30. %when using this library on GNU/Linux).
  31. worked = feval(vr.plugin, 'seek', vr.handle, fnum);