Blender  V2.93
IMB_moviecache.h
Go to the documentation of this file.
1 /*
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.
6  *
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.
11  *
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.
15  *
16  * The Original Code is Copyright (C) 2011 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
26 #include "BLI_ghash.h"
27 #include "BLI_utildefines.h"
28 
29 /* Cache system for movie data - now supports storing ImBufs only
30  * Supposed to provide unified cache system for movie clips, sequencer and
31  * other movie-related areas */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 struct ImBuf;
38 struct MovieCache;
39 
40 typedef void (*MovieCacheGetKeyDataFP)(void *userkey, int *framenr, int *proxy, int *render_flags);
41 
42 typedef void *(*MovieCacheGetPriorityDataFP)(void *userkey);
43 typedef int (*MovieCacheGetItemPriorityFP)(void *last_userkey, void *priority_data);
44 typedef void (*MovieCachePriorityDeleterFP)(void *priority_data);
45 
46 void IMB_moviecache_init(void);
47 void IMB_moviecache_destruct(void);
48 
49 struct MovieCache *IMB_moviecache_create(const char *name,
50  int keysize,
59 
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 void IMB_moviecache_remove(struct MovieCache *cache, void *userkey);
64 bool IMB_moviecache_has_frame(struct MovieCache *cache, void *userkey);
65 void IMB_moviecache_free(struct MovieCache *cache);
66 
68  bool(cleanup_check_cb)(struct ImBuf *ibuf,
69  void *userkey,
70  void *userdata),
71  void *userdata);
72 
74  struct MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points);
75 
76 struct MovieCacheIter;
77 struct MovieCacheIter *IMB_moviecacheIter_new(struct MovieCache *cache);
78 void IMB_moviecacheIter_free(struct MovieCacheIter *iter);
79 bool IMB_moviecacheIter_done(struct MovieCacheIter *iter);
80 void IMB_moviecacheIter_step(struct MovieCacheIter *iter);
81 struct ImBuf *IMB_moviecacheIter_getImBuf(struct MovieCacheIter *iter);
82 void *IMB_moviecacheIter_getUserKey(struct MovieCacheIter *iter);
83 
84 #ifdef __cplusplus
85 }
86 #endif
bool(* GHashCmpFP)(const void *a, const void *b)
Definition: BLI_ghash.h:48
unsigned int(* GHashHashFP)(const void *key)
Definition: BLI_ghash.h:46
bool IMB_moviecache_has_frame(struct MovieCache *cache, void *userkey)
Definition: moviecache.c:422
struct MovieCache * IMB_moviecache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp)
Definition: moviecache.c:262
int(* MovieCacheGetItemPriorityFP)(void *last_userkey, void *priority_data)
void IMB_moviecache_set_getdata_callback(struct MovieCache *cache, MovieCacheGetKeyDataFP getdatafp)
Definition: moviecache.c:289
void IMB_moviecacheIter_free(struct MovieCacheIter *iter)
Definition: moviecache.c:580
void IMB_moviecache_remove(struct MovieCache *cache, void *userkey)
Definition: moviecache.c:390
void IMB_moviecache_cleanup(struct MovieCache *cache, bool(cleanup_check_cb)(struct ImBuf *ibuf, void *userkey, void *userdata), void *userdata)
struct MovieCacheIter * IMB_moviecacheIter_new(struct MovieCache *cache)
Definition: moviecache.c:570
struct ImBuf * IMB_moviecache_get(struct MovieCache *cache, void *userkey)
Definition: moviecache.c:398
void IMB_moviecache_destruct(void)
Definition: moviecache.c:255
void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf)
Definition: moviecache.c:364
void IMB_moviecache_free(struct MovieCache *cache)
Definition: moviecache.c:434
void IMB_moviecache_get_cache_segments(struct MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points)
Definition: moviecache.c:480
bool IMB_moviecacheIter_done(struct MovieCacheIter *iter)
Definition: moviecache.c:585
bool IMB_moviecache_put_if_possible(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf)
Definition: moviecache.c:369
void IMB_moviecacheIter_step(struct MovieCacheIter *iter)
Definition: moviecache.c:590
void(* MovieCachePriorityDeleterFP)(void *priority_data)
void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGetPriorityDataFP getprioritydatafp, MovieCacheGetItemPriorityFP getitempriorityfp, MovieCachePriorityDeleterFP prioritydeleterfp)
Definition: moviecache.c:294
void IMB_moviecache_init(void)
Definition: moviecache.c:247
void * IMB_moviecacheIter_getUserKey(struct MovieCacheIter *iter)
Definition: moviecache.c:601
struct ImBuf * IMB_moviecacheIter_getImBuf(struct MovieCacheIter *iter)
Definition: moviecache.c:595
void *(* MovieCacheGetPriorityDataFP)(void *userkey)
void(* MovieCacheGetKeyDataFP)(void *userkey, int *framenr, int *proxy, int *render_flags)
void * userdata
MovieCacheGetKeyDataFP getdatafp
Definition: moviecache.c:62
GHashHashFP hashfp
Definition: moviecache.c:60
int keysize
Definition: moviecache.c:72
void * last_userkey
Definition: moviecache.c:74
MovieCacheGetItemPriorityFP getitempriorityfp
Definition: moviecache.c:65
MovieCachePriorityDeleterFP prioritydeleterfp
Definition: moviecache.c:66
int render_flags
Definition: moviecache.c:76
char name[64]
Definition: moviecache.c:57
GHashCmpFP cmpfp
Definition: moviecache.c:61
MovieCacheGetPriorityDataFP getprioritydatafp
Definition: moviecache.c:64