FrameCache

Video frames kept between passes, so a video is decoded once: the faces pass saves each frame small (shortest side Side, what Smart Search's models look at), the Smart Search pass reads them back and deletes them. Decoding was most of a video's cost (~0.3 s a frame); saving and reading a small JPEG is a few ms. One folder per video; done marks a complete set, so a pass stopped mid-video doesn't leave Smart Search with half its frames.

Functions

Link copied to clipboard
fun begin(context: Context, mediaId: Long, modified: Long): File

Starts saving a video's frames, dropping any earlier attempt.

Link copied to clipboard
fun clear(context: Context)
Link copied to clipboard
fun drop(context: Context, mediaId: Long, modified: Long)
Link copied to clipboard
fun finish(folder: File)
Link copied to clipboard
fun frames(context: Context, mediaId: Long, modified: Long): List<Pair<Long, File>>?

A complete set of frames for this version of the video, oldest first; null if there isn't one.

Link copied to clipboard
fun prune(context: Context, keep: (mediaId: Long, modified: Long) -> Boolean)

Folders for videos that are gone, edited, or already indexed by Smart Search.

Link copied to clipboard
fun read(file: File): Bitmap?
Link copied to clipboard
fun save(folder: File, atMs: Long, frame: Bitmap)