tstools.cpp patch details.

tstools.cpp patch details.

The requirement here was that the code always move in the requested direction. The original code had problem with GOPs contain only an I-frame, as for these it could end up back where it started and then just keep looping. Some calls even went in the wrong direction, as there was a bug in the is_mpeg2 section as it forgot to call getStructureEntryFirst() to prime the cache point for its getStructureEntryNext() calls.

By ensuring that findFrame() always moves to the next I-frame in required direction, findNextPicture() can be guaranteed to return. If it has gone too far then that just means it will be asked to skip less next time.

It should now always continue in the right direction, but if some unforeseen circumstance could still prevent this then at least the code will no longer hang as the lock around the getNextPicture() call is now always being released (so you could get out of a loop by changing the FF/FR speed).