Files
test/source/blender/imbuf/intern/IMB_indexer.h
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00

105 lines
3.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup imbuf
*/
#ifdef WIN32
# include <io.h>
#endif
#include "IMB_anim.h"
#include <stdio.h>
#include <stdlib.h>
/*
* separate animation index files to solve the following problems:
*
* a) different time-codes within one file (like DTS/PTS, Time-code-Track,
* "implicit" time-codes within DV-files and HDV-files etc.)
* b) seeking difficulties within FFMPEG for files with timestamp holes
* c) broken files that miss several frames / have varying frame-rates
* d) use proxies accordingly
*
* ... we need index files, that provide us with
*
* the binary(!) position, where we have to seek into the file *and*
* the continuous frame number (ignoring the holes) starting from the
* beginning of the file, so that we know, which proxy frame to serve.
*
* This index has to be only built once for a file and is written into
* the BL_proxy directory structure for later reuse in different blender files.
*/
typedef struct anim_index_entry {
int frameno;
uint64_t seek_pos;
uint64_t seek_pos_pts;
uint64_t seek_pos_dts;
uint64_t pts;
} anim_index_entry;
struct anim_index {
char name[1024];
int num_entries;
struct anim_index_entry *entries;
};
struct anim_index_builder;
typedef struct anim_index_builder {
FILE *fp;
char name[FILE_MAX];
char temp_name[FILE_MAX];
void *private_data;
void (*delete_priv_data)(struct anim_index_builder *idx);
void (*proc_frame)(struct anim_index_builder *idx,
unsigned char *buffer,
int data_size,
struct anim_index_entry *entry);
} anim_index_builder;
anim_index_builder *IMB_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,
unsigned char *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_index *IMB_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);
void IMB_free_indices(struct anim *anim);
struct anim *IMB_anim_open_proxy(struct anim *anim, IMB_Proxy_Size preview_size);
struct anim_index *IMB_anim_open_index(struct anim *anim, IMB_Timecode_Type tc);
int IMB_proxy_size_to_array_index(IMB_Proxy_Size pr_size);
int IMB_timecode_to_array_index(IMB_Timecode_Type tc);