Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
indexer.c File Reference
#include <stdlib.h>
#include "MEM_guardedalloc.h"
#include "BLI_endian_defines.h"
#include "BLI_endian_switch.h"
#include "BLI_fileops.h"
#include "BLI_ghash.h"
#include "BLI_math.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include "IMB_anim.h"
#include "IMB_indexer.h"
#include "imbuf.h"

Go to the source code of this file.

Classes

struct  IndexBuildContext
 

Macros

#define INDEX_FILE_VERSION   2
 

Typedefs

typedef struct IndexBuildContext IndexBuildContext
 

Functions

anim_index_builderIMB_index_builder_create (const char *name)
 
void IMB_index_builder_add_entry (anim_index_builder *fp, int frameno, uint64_t seek_pos, uint64_t seek_pos_pts, uint64_t seek_pos_dts, uint64_t pts)
 
void IMB_index_builder_proc_frame (anim_index_builder *fp, uchar *buffer, int data_size, int frameno, uint64_t seek_pos, uint64_t seek_pos_pts, uint64_t seek_pos_dts, uint64_t pts)
 
void IMB_index_builder_finish (anim_index_builder *fp, int rollback)
 
struct anim_indexIMB_indexer_open (const char *name)
 
uint64_t IMB_indexer_get_seek_pos (struct anim_index *idx, int frame_index)
 
uint64_t IMB_indexer_get_seek_pos_pts (struct anim_index *idx, int frame_index)
 
uint64_t IMB_indexer_get_seek_pos_dts (struct anim_index *idx, int frame_index)
 
int IMB_indexer_get_frame_index (struct anim_index *idx, int frameno)
 
uint64_t IMB_indexer_get_pts (struct anim_index *idx, int frame_index)
 
int IMB_indexer_get_duration (struct anim_index *idx)
 
int IMB_indexer_can_scan (struct anim_index *idx, int old_frame_index, int new_frame_index)
 
void IMB_indexer_close (struct anim_index *idx)
 
int IMB_proxy_size_to_array_index (IMB_Proxy_Size pr_size)
 
int IMB_timecode_to_array_index (IMB_Timecode_Type tc)
 
static void get_index_dir (struct anim *anim, char *index_dir, size_t index_dir_len)
 
void IMB_anim_get_fname (struct anim *anim, char *file, int size)
 
static bool get_proxy_filepath (struct anim *anim, IMB_Proxy_Size preview_size, char *filepath, bool temp)
 
static void get_tc_filename (struct anim *anim, IMB_Timecode_Type tc, char *filepath)
 
IndexBuildContextIMB_anim_index_rebuild_context (struct anim *anim, IMB_Timecode_Type tcs_in_use, IMB_Proxy_Size proxy_sizes_in_use, int quality, const bool overwrite, GSet *file_list, bool build_only_on_bad_performance)
 
void IMB_anim_index_rebuild (struct IndexBuildContext *context, short *stop, short *do_update, float *progress)
 
void IMB_anim_index_rebuild_finish (IndexBuildContext *context, short stop)
 
void IMB_free_indices (struct anim *anim)
 
void IMB_anim_set_index_dir (struct anim *anim, const char *dir)
 
struct animIMB_anim_open_proxy (struct anim *anim, IMB_Proxy_Size preview_size)
 
struct anim_indexIMB_anim_open_index (struct anim *anim, IMB_Timecode_Type tc)
 
int IMB_anim_index_get_frame_index (struct anim *anim, IMB_Timecode_Type tc, int position)
 
IMB_Proxy_Size IMB_anim_proxy_get_existing (struct anim *anim)
 

Variables

static const char binary_header_str [] = "BlenMIdx"
 
static const char temp_ext [] = "_part"
 
static const int proxy_sizes [] = {IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75, IMB_PROXY_100}
 
static const float proxy_fac [] = {0.25, 0.50, 0.75, 1.00}
 

Macro Definition Documentation

◆ INDEX_FILE_VERSION

#define INDEX_FILE_VERSION   2

Definition at line 55 of file indexer.c.

Typedef Documentation

◆ IndexBuildContext

Function Documentation

◆ get_index_dir()

static void get_index_dir ( struct anim anim,
char *  index_dir,
size_t  index_dir_len 
)
static

◆ get_proxy_filepath()

static bool get_proxy_filepath ( struct anim anim,
IMB_Proxy_Size  preview_size,
char *  filepath,
bool  temp 
)
static

◆ get_tc_filename()

static void get_tc_filename ( struct anim anim,
IMB_Timecode_Type  tc,
char *  filepath 
)
static

◆ IMB_anim_get_fname()

void IMB_anim_get_fname ( struct anim anim,
char *  file,
int  size 
)

Definition at line 389 of file indexer.c.

References BLI_split_dirfile(), BLI_strncpy(), file, FILE_MAXFILE, anim::name, and size().

Referenced by seq_proxy_index_dir_set().

◆ IMB_anim_index_get_frame_index()

int IMB_anim_index_get_frame_index ( struct anim anim,
IMB_Timecode_Type  tc,
int  position 
)

Definition at line 1590 of file indexer.c.

References IMB_anim_open_index(), and IMB_indexer_get_frame_index().

Referenced by IMB_anim_absolute(), and seq_proxy_fetch().

◆ IMB_anim_index_rebuild()

void IMB_anim_index_rebuild ( struct IndexBuildContext context,
short *  stop,
short *  do_update,
float progress 
)

Will rebuild all used indices and proxies at once.

Definition at line 1460 of file indexer.c.

References ANIM_FFMPEG, blender::compositor::context, and UNUSED_VARS.

Referenced by do_movie_proxy(), and SEQ_proxy_rebuild().

◆ IMB_anim_index_rebuild_context()

IndexBuildContext* IMB_anim_index_rebuild_context ( struct anim anim,
IMB_Timecode_Type  tcs_in_use,
IMB_Proxy_Size  proxy_sizes_in_use,
int  quality,
const bool  overwrite,
struct GSet file_list,
bool  build_only_on_bad_performance 
)

◆ IMB_anim_index_rebuild_finish()

void IMB_anim_index_rebuild_finish ( struct IndexBuildContext context,
short  stop 
)

Finish rebuilding proxies/time-codes and free temporary contexts used.

Definition at line 1486 of file indexer.c.

References ANIM_FFMPEG, blender::compositor::context, proxy_sizes, and UNUSED_VARS.

Referenced by proxy_endjob(), and SEQ_proxy_rebuild_finish().

◆ IMB_anim_open_index()

struct anim_index* IMB_anim_open_index ( struct anim anim,
IMB_Timecode_Type  tc 
)

◆ IMB_anim_open_proxy()

struct anim* IMB_anim_open_proxy ( struct anim anim,
IMB_Proxy_Size  preview_size 
)

◆ IMB_anim_proxy_get_existing()

IMB_Proxy_Size IMB_anim_proxy_get_existing ( struct anim anim)

◆ IMB_anim_set_index_dir()

void IMB_anim_set_index_dir ( struct anim anim,
const char *  dir 
)

Defaults to BL_proxy within the directory of the animation.

Definition at line 1527 of file indexer.c.

References BLI_strncpy(), IMB_free_indices(), anim::index_dir, and STREQ.

Referenced by movieclip_open_anim_file(), and seq_proxy_index_dir_set().

◆ IMB_free_indices()

void IMB_free_indices ( struct anim anim)

◆ IMB_index_builder_add_entry()

void IMB_index_builder_add_entry ( anim_index_builder fp,
int  frameno,
uint64_t  seek_pos,
uint64_t  seek_pos_pts,
uint64_t  seek_pos_dts,
uint64_t  pts 
)

Definition at line 95 of file indexer.c.

References anim_index_builder::fp.

Referenced by IMB_index_builder_proc_frame().

◆ IMB_index_builder_create()

anim_index_builder* IMB_index_builder_create ( const char *  name)

◆ IMB_index_builder_finish()

void IMB_index_builder_finish ( anim_index_builder fp,
int  rollback 
)

◆ IMB_index_builder_proc_frame()

void IMB_index_builder_proc_frame ( anim_index_builder fp,
uchar buffer,
int  data_size,
int  frameno,
uint64_t  seek_pos,
uint64_t  seek_pos_pts,
uint64_t  seek_pos_dts,
uint64_t  pts 
)

Definition at line 109 of file indexer.c.

References buffer, e, IMB_index_builder_add_entry(), and anim_index_builder::proc_frame.

◆ IMB_indexer_can_scan()

int IMB_indexer_can_scan ( struct anim_index idx,
int  old_frame_index,
int  new_frame_index 
)

Definition at line 319 of file indexer.c.

References IMB_indexer_get_seek_pos().

◆ IMB_indexer_close()

void IMB_indexer_close ( struct anim_index idx)

Definition at line 328 of file indexer.c.

References anim_index::entries, and MEM_freeN.

Referenced by IMB_free_indices().

◆ IMB_indexer_get_duration()

int IMB_indexer_get_duration ( struct anim_index idx)

Definition at line 311 of file indexer.c.

References anim_index::entries, anim_index_entry::frameno, and anim_index::num_entries.

Referenced by IMB_anim_get_duration().

◆ IMB_indexer_get_frame_index()

int IMB_indexer_get_frame_index ( struct anim_index idx,
int  frameno 
)

◆ IMB_indexer_get_pts()

uint64_t IMB_indexer_get_pts ( struct anim_index idx,
int  frame_index 
)

Definition at line 300 of file indexer.c.

References anim_index::entries, anim_index::num_entries, and anim_index_entry::pts.

◆ IMB_indexer_get_seek_pos()

uint64_t IMB_indexer_get_seek_pos ( struct anim_index idx,
int  frame_index 
)

Definition at line 233 of file indexer.c.

References anim_index::entries, anim_index::num_entries, and anim_index_entry::seek_pos.

Referenced by IMB_indexer_can_scan().

◆ IMB_indexer_get_seek_pos_dts()

uint64_t IMB_indexer_get_seek_pos_dts ( struct anim_index idx,
int  frame_index 
)

◆ IMB_indexer_get_seek_pos_pts()

uint64_t IMB_indexer_get_seek_pos_pts ( struct anim_index idx,
int  frame_index 
)

◆ IMB_indexer_open()

struct anim_index* IMB_indexer_open ( const char *  name)

◆ IMB_proxy_size_to_array_index()

int IMB_proxy_size_to_array_index ( IMB_Proxy_Size  pr_size)

◆ IMB_timecode_to_array_index()

int IMB_timecode_to_array_index ( IMB_Timecode_Type  tc)

Variable Documentation

◆ binary_header_str

const char binary_header_str[] = "BlenMIdx"
static

Definition at line 40 of file indexer.c.

Referenced by IMB_index_builder_create(), and IMB_indexer_open().

◆ proxy_fac

const float proxy_fac[] = {0.25, 0.50, 0.75, 1.00}
static

Definition at line 44 of file indexer.c.

Referenced by get_proxy_filepath().

◆ proxy_sizes

const int proxy_sizes[] = {IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75, IMB_PROXY_100}
static

◆ temp_ext

const char temp_ext[] = "_part"
static

Definition at line 41 of file indexer.c.

Referenced by IMB_index_builder_create().