4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "cachebase.h"
27 #include "indexable.inc"
34 // Simply a table of images described by frame position and dimensions.
35 // The frame position is relative to the frame rate of the source file.
36 // This object is used by File for playback.
37 // and MWindow for timeline drawing.
38 // CICache scans all the files for
39 // frame caches and deletes what's needed to maintain the cache size.
41 class FrameCacheItem : public CacheItemBase
54 class FrameCache : public CacheBase
60 // Returns 1 if frame exists in cache and copies it to the frame argument.
61 int get_frame(VFrame *frame,
66 // Returns pointer to cache entry if frame exists or 0.
67 // If a frame is found, the frame cache is left in the locked state until
68 // unlock is called. If nothing is found, the frame cache is unlocked before
69 // returning. This keeps the item from being deleted.
70 // asset - supplied by user if the cache is not part of a file.
71 VFrame* get_frame_ptr(int64_t position,
78 // Puts the frame in cache.
79 // use_copy - if 1 a copy of the frame is made. if 0 the argument is stored.
80 // The copy of the frame is deleted by FrameCache in a future delete_oldest.
81 // asset - supplied by user if the cache is not part of a file.
82 void put_frame(VFrame *frame,
87 Indexable *indexable);
96 // Return 1 if matching frame exists.
98 int frame_exists(VFrame *format,
102 FrameCacheItem **item_return,
104 int frame_exists(int64_t position,
110 FrameCacheItem **item_return,