Blender V5.0
movie_proxy_indexer.cc File Reference
#include <cstdlib>
#include "MEM_guardedalloc.h"
#include "BLI_endian_defines.h"
#include "BLI_endian_switch.h"
#include "BLI_fileops.h"
#include "BLI_math_base.h"
#include "BLI_math_base.hh"
#include "BLI_path_utils.hh"
#include "BLI_string.h"
#include "BLI_string_utils.hh"
#include "BLI_threads.h"
#include "BLI_time.h"
#include "BLI_utildefines.h"
#include "CLG_log.h"
#include "MOV_read.hh"
#include "ffmpeg_swscale.hh"
#include "movie_proxy_indexer.hh"
#include "movie_read.hh"
#include "movie_util.hh"

Go to the source code of this file.

Macros

#define INDEX_FILE_VERSION   2

Functions

static MovieIndexmovie_index_open (const char *filepath)
static void movie_index_free (MovieIndex *idx)
static int proxy_size_to_array_index (IMB_Proxy_Size pr_size)
static void get_index_dir (const MovieReader *anim, char *index_dir, size_t index_dir_maxncpy)
static bool get_proxy_filepath (const MovieReader *anim, IMB_Proxy_Size preview_size, char *filepath, bool temp)
static void get_tc_filepath (MovieReader *anim, IMB_Timecode_Type tc, char *filepath)
MovieProxyBuilder * MOV_proxy_builder_start (MovieReader *anim, IMB_Timecode_Type tcs_in_use, int proxy_sizes_in_use, int quality, const bool overwrite, blender::Set< std::string > *processed_paths, bool build_only_on_bad_performance)
void MOV_proxy_builder_process (MovieProxyBuilder *context, bool *stop, bool *do_update, float *progress)
void MOV_proxy_builder_finish (MovieProxyBuilder *context, const bool stop)
void MOV_close_proxies (MovieReader *anim)
void MOV_set_custom_proxy_dir (MovieReader *anim, const char *dir)
MovieReadermovie_open_proxy (MovieReader *anim, IMB_Proxy_Size preview_size)
const MovieIndexmovie_open_index (MovieReader *anim, IMB_Timecode_Type tc)
int MOV_calc_frame_index_with_timecode (MovieReader *anim, IMB_Timecode_Type tc, int position)
int MOV_get_existing_proxies (const MovieReader *anim)

Variables

static CLG_LogRef LOG = {"video.proxy"}
static const char binary_header_str [] = "BlenMIdx"
static const IMB_Proxy_Size proxy_sizes []
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 52 of file movie_proxy_indexer.cc.

Referenced by movie_index_open().

Function Documentation

◆ get_index_dir()

void get_index_dir ( const MovieReader * anim,
char * index_dir,
size_t index_dir_maxncpy )
static

◆ get_proxy_filepath()

◆ get_tc_filepath()

void get_tc_filepath ( MovieReader * anim,
IMB_Timecode_Type tc,
char * filepath )
static

◆ MOV_calc_frame_index_with_timecode()

int MOV_calc_frame_index_with_timecode ( MovieReader * anim,
IMB_Timecode_Type tc,
int position )

Given a frame index, calculate final frame index taking timecode into account.

This does nothing (returns input frame position) if IMB_TC_NONE is used, or movie proxy/index file is not built.

When a timecode index file is present and is requested to be used, this can return a different frame index than input frame, particularly for IMB_TC_RECORD_RUN_NO_GAPS.

Definition at line 1305 of file movie_proxy_indexer.cc.

References MovieIndex::get_frame_index(), and movie_open_index().

Referenced by MOV_decode_frame(), and blender::seq::seq_proxy_fetch().

◆ MOV_close_proxies()

◆ MOV_get_existing_proxies()

int MOV_get_existing_proxies ( const MovieReader * anim)

Queries which proxies exist for this movie.

Note that it does not check whether proxies are up to date, or valid files; just merely whether the expected files exist.

Returns bitmask of IMB_Proxy_Size flags.

Definition at line 1316 of file movie_proxy_indexer.cc.

References BLI_exists(), FILE_MAX, get_proxy_filepath(), i, IMB_PROXY_MAX_SLOT, IMB_PROXY_NONE, and proxy_sizes.

Referenced by MOV_proxy_builder_start(), and blender::seq::seq_proxy_need_rebuild().

◆ MOV_proxy_builder_finish()

void MOV_proxy_builder_finish ( MovieProxyBuilder * context,
bool stop )

Finish building proxies / time-codes indices, and delete the builder.

Definition at line 1199 of file movie_proxy_indexer.cc.

References proxy_sizes, and UNUSED_VARS.

Referenced by proxy_endjob(), and blender::seq::proxy_rebuild_finish().

◆ MOV_proxy_builder_process()

void MOV_proxy_builder_process ( MovieProxyBuilder * context,
bool * stop,
bool * do_update,
float * progress )

Will rebuild all used indices and proxies at once.

Definition at line 1181 of file movie_proxy_indexer.cc.

References UNUSED_VARS.

Referenced by do_movie_proxy(), and blender::seq::proxy_rebuild().

◆ MOV_proxy_builder_start()

MovieProxyBuilder * MOV_proxy_builder_start ( MovieReader * anim,
IMB_Timecode_Type tcs_in_use,
int proxy_sizes_in_use,
int quality,
const bool overwrite,
blender::Set< std::string > * processed_paths,
bool build_only_on_bad_performance )

◆ MOV_set_custom_proxy_dir()

void MOV_set_custom_proxy_dir ( MovieReader * anim,
const char * dir )

Custom directory to be used for loading or building proxies. By default "BL_proxy" within the directory of the movie file is used.

Definition at line 1236 of file movie_proxy_indexer.cc.

References MovieReader::index_dir, MOV_close_proxies(), STREQ, and STRNCPY().

Referenced by movieclip_open_anim_file(), and blender::seq::seq_proxy_index_dir_set().

◆ movie_index_free()

void movie_index_free ( MovieIndex * idx)
static

Definition at line 259 of file movie_proxy_indexer.cc.

Referenced by MOV_close_proxies().

◆ movie_index_open()

◆ movie_open_index()

◆ movie_open_proxy()

◆ proxy_size_to_array_index()

int proxy_size_to_array_index ( IMB_Proxy_Size pr_size)
static

Variable Documentation

◆ binary_header_str

const char binary_header_str[] = "BlenMIdx"
static

Definition at line 46 of file movie_proxy_indexer.cc.

Referenced by movie_index_open().

◆ LOG

CLG_LogRef LOG = {"video.proxy"}
static

Definition at line 35 of file movie_proxy_indexer.cc.

◆ proxy_fac

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

Definition at line 50 of file movie_proxy_indexer.cc.

Referenced by get_proxy_filepath().

◆ proxy_sizes