diff options
Diffstat (limited to 'source/blender/blenkernel/intern/movieclip.c')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index b387c7d2d1b..fe38fedd7aa 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -69,7 +69,6 @@ #include "BKE_image.h" /* openanim */ #include "BKE_tracking.h" -#include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" #include "IMB_moviecache.h" @@ -78,8 +77,6 @@ # include "intern/openexr/openexr_multi.h" #endif -#include "NOD_composite.h" - /*********************** movieclip buffer loaders *************************/ static int sequence_guess_offset(const char *full_name, int head_len, unsigned short numlen) @@ -391,7 +388,7 @@ static int user_frame_to_cache_frame(MovieClip *clip, int framenr) static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags) { - MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)userkey; + const MovieClipImBufCacheKey *key = userkey; *framenr = key->framenr; *proxy = key->proxy; @@ -400,7 +397,7 @@ static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *ren static unsigned int moviecache_hashhash(const void *keyv) { - MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)keyv; + const MovieClipImBufCacheKey *key = keyv; int rval = key->framenr; return rval; @@ -408,8 +405,8 @@ static unsigned int moviecache_hashhash(const void *keyv) static bool moviecache_hashcmp(const void *av, const void *bv) { - const MovieClipImBufCacheKey *a = (MovieClipImBufCacheKey *)av; - const MovieClipImBufCacheKey *b = (MovieClipImBufCacheKey *)bv; + const MovieClipImBufCacheKey *a = av; + const MovieClipImBufCacheKey *b = bv; return ((a->framenr != b->framenr) || (a->proxy != b->proxy) || @@ -528,6 +525,15 @@ static bool put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i } } +static bool moviecache_check_free_proxy(ImBuf *UNUSED(ibuf), + void *userkey, + void *UNUSED(userdata)) +{ + MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)userkey; + + return !(key->proxy == IMB_PROXY_NONE && key->render_flag == 0); +} + /*********************** common functions *************************/ /* only image block itself */ @@ -1170,6 +1176,15 @@ void BKE_movieclip_clear_cache(MovieClip *clip) free_buffers(clip); } +void BKE_movieclip_clear_proxy_cache(MovieClip *clip) +{ + if (clip->cache && clip->cache->moviecache) { + IMB_moviecache_cleanup(clip->cache->moviecache, + moviecache_check_free_proxy, + NULL); + } +} + void BKE_movieclip_reload(MovieClip *clip) { /* clear cache */ |