2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2011 Blender Foundation.
17 * All rights reserved.
20 #ifndef __IMB_MOVIECACHE_H__
21 #define __IMB_MOVIECACHE_H__
27 #include "BLI_utildefines.h"
28 #include "BLI_ghash.h"
30 /* Cache system for movie data - now supports storing ImBufs only
31 * Supposed to provide unified cache system for movie clips, sequencer and
32 * other movie-related areas */
37 typedef void (*MovieCacheGetKeyDataFP) (void *userkey, int *framenr, int *proxy, int *render_flags);
39 typedef void *(*MovieCacheGetPriorityDataFP) (void *userkey);
40 typedef int (*MovieCacheGetItemPriorityFP) (void *last_userkey, void *priority_data);
41 typedef void (*MovieCachePriorityDeleterFP) (void *priority_data);
43 void IMB_moviecache_init(void);
44 void IMB_moviecache_destruct(void);
46 struct MovieCache *IMB_moviecache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp);
47 void IMB_moviecache_set_getdata_callback(struct MovieCache *cache, MovieCacheGetKeyDataFP getdatafp);
48 void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGetPriorityDataFP getprioritydatafp,
49 MovieCacheGetItemPriorityFP getitempriorityfp,
50 MovieCachePriorityDeleterFP prioritydeleterfp);
52 void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
53 bool IMB_moviecache_put_if_possible(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
54 struct ImBuf *IMB_moviecache_get(struct MovieCache *cache, void *userkey);
55 bool IMB_moviecache_has_frame(struct MovieCache *cache, void *userkey);
56 void IMB_moviecache_free(struct MovieCache *cache);
58 void IMB_moviecache_cleanup(struct MovieCache *cache,
59 bool (cleanup_check_cb) (struct ImBuf *ibuf, void *userkey, void *userdata),
62 void IMB_moviecache_get_cache_segments(struct MovieCache *cache, int proxy, int render_flags, int *totseg_r, int **points_r);
64 struct MovieCacheIter;
65 struct MovieCacheIter *IMB_moviecacheIter_new(struct MovieCache *cache);
66 void IMB_moviecacheIter_free(struct MovieCacheIter *iter);
67 bool IMB_moviecacheIter_done(struct MovieCacheIter *iter);
68 void IMB_moviecacheIter_step(struct MovieCacheIter *iter);
69 struct ImBuf *IMB_moviecacheIter_getImBuf(struct MovieCacheIter *iter);
70 void *IMB_moviecacheIter_getUserKey(struct MovieCacheIter *iter);