Posted by billf
on June 9, 2010 at 5:04 PM PDT
I just added a new feature to the GRIN playlist feature that I thought it would be worth drawing attention to. I added support for playlist marks, both navigating to them and triggering commands when they're encountered.
One thing that's maybe a little different is that I didn't use BD-J playlist marks at all. GRIN is pretty heavily based on polling things once per animation frame, so I just poll the media time. At worst, if the new media time has changed to a random value, that results in a binary search, and O(log n) is more than fast enough here. Because it polls media time, commands get triggered even if you enter into a video segment due to chapter skip, fast forward or rewind.
Another interesting thing about this design is that is uses java_command a lot. If there are really a huge number of playlist marks, I guess this could stress the java_command system, but as long as no limits are reached this turns into really efficient code -- no new classes!
Details are at https://hdcookbook.dev.java.net/javadocs/grin/javame/com/hdcookbook/grin... under "PLAYLIST MARKS" if folks are interested.