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