14#define DEC_PLUGIN_VERSION_MAJOR 3
15#define DEC_PLUGIN_VERSION_MINOR 0
24# define ALLOW_UNUSED __attribute__((unused))
32#include "../../../libweed/weed-palettes.h"
34#include <weed/weed-palettes.h>
37#if defined (IS_DARWIN) || defined (__FreeBSD__)
67 double buffer_flush_time;
68 double kframe_nseek_time;
69 double kframe_delay_time;
71 double kframe_kframe_time;
72 double kframe_inter_time;
73 double kframe_extra_time;
91#define LIVES_SEEK_FAST (1<<0)
92#define LIVES_SEEK_FAST_REV (1<<1)
95#define LIVES_SEEK_NEEDS_CALCULATION (1<<2)
96#define LIVES_SEEK_QUALITY_LOSS (1<<3)
99typedef void *(*malloc_f)(size_t);
101typedef void *(*memset_f)(
void *, int, size_t);
102typedef void *(*memcpy_f)(
void *,
const void *, size_t);
103typedef void *(*realloc_f)(
void *, size_t);
104typedef void *(*calloc_f)(size_t, size_t);
105typedef void *(*memmove_f)(
void *,
const void *, size_t);
108#if defined NEED_TIMING || !defined HAVE_GETENTROPY
116static inline int64_t get_current_ticks(
void) {
120 clock_gettime(CLOCK_MONOTONIC, &ts);
121 ret = ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
124 gettimeofday(&
tv, NULL);
125 ret =
tv.tv_sec * 1000000 +
tv.tv_usec;
131#ifndef HAVE_GETENTROPY
135#define myfastrand1(fval) ((fval) ^ ((fval) << 13))
136#define myfastrand2(fval) ((fval) ^ ((fval) >> 7))
137#define myfastrand3(fval) ((fval) ^ ((fval) << 17))
138#define myfastrand0(fval) (myfastrand3(myfastrand2(myfastrand1((fval)))))
140static inline void myrand(
void *ptr,
size_t size) {
141 static uint64_t fval = 0;
143 fval = 0xAAAAAAAAAAAAAAAA ^ (get_current_ticks() >> 17);
146 memcpy(ptr, &fval, size);
149#define LSD_RANDFUNC(ptr, size) myrand(ptr, size)
152#include "../../../src/lsd.h"
154#define PLUGIN_TYPE_DECODER "decoder"
155#define PLUGIN_SUBTYPE_DLL "dll"
160 int api_version_major;
161 int api_version_minor;
163 int pl_version_major;
164 int pl_version_minor;
169typedef struct _lives_clip_data {
187 char container_name[512];
212 float video_start_time;
217 float max_decode_fps;
218 int64_t fwd_seek_time;
221 int64_t kframe_start;
236 char video_name[512];
244 char audio_name[512];
249#define SYNC_HINT_AUDIO_TRIM_START (1<<0)
250#define SYNC_HINT_AUDIO_PAD_START (1<<1)
251#define SYNC_HINT_AUDIO_TRIM_END (1<<2)
252#define SYNC_HINT_AUDIO_PAD_END (1<<3)
254#define SYNC_HINT_VIDEO_PAD_START (1<<4)
255#define SYNC_HINT_VIDEO_PAD_END (1<<5)
295#define get_le16int(p) (*(p + 1) << 8 | *(p))
296#define get_le32int(p) ((get_le16int(p + 2) << 16) | get_le16int(p))
297#define get_le64int(p) (int64_t)(((uint64_t)(get_le32int(p + 4)) << 32) | (uint64_t)(get_le32int(p)))
299#define ABS(a) ((a) >= 0. ? (a) : -(a))
311#define CREATOR_ID "LiVES decoder plugin"
314static void make_acid(
void) {
315 cdata_lsd = lsd_create(
"lives_clip_data_t",
sizeof(
lives_clip_data_t),
"sync_hint", 6);
316 if (!cdata_lsd)
return;
322 "priv", 0, NULL, NULL, NULL);
324 "URI", 0, NULL, NULL, NULL);
326 "title", 1024, NULL, NULL, NULL);
328 "author", 1024, NULL, NULL, NULL);
330 "comment", 1024, NULL, NULL, NULL);
332 "palettes", 4, NULL, NULL, NULL);
333 lives_struct_init(cdata_lsd, cdata, &cdata->
lsd);
342 if (data) cdata = data;
345 if (!cdata_lsd) make_acid();
346 if (!cdata_lsd)
return NULL;
347 cdata = lives_struct_create(cdata_lsd);
361static void cdata_stamp(
lives_clip_data_t *cdata,
const char *name,
int vmaj,
int vmin) {
369 if (!cdata)
return NULL;
370 if (!cdata_lsd) make_acid();
371 return lives_struct_copy((
void *)&cdata->
lsd);
boolean set_palette(lives_clip_data_t *)
#define DEC_PLUGIN_VERSION_MINOR
lives_clip_data_t * get_clip_data(const char *URI, lives_clip_data_t *)
pass in NULL clip_data for the first call, subsequent calls (if the URI, current_clip or current_pale...
void *(* malloc_f)(size_t)
#define DEC_PLUGIN_VERSION_MAJOR
int64_t rip_audio(const lives_clip_data_t *, const char *fname, int64_t stframe, int64_t nframes, unsigned char **abuff)
void clip_data_free(lives_clip_data_t *)
free clip data - this should be called for each instance before unloading the module
#define PLUGIN_TYPE_DECODER
void *(* memset_f)(void *, int, size_t)
@ LIVES_MEDIA_TYPE_UNKNOWN
boolean rip_audio_sequential(const lives_clip_data_t *, const char *fname)
void *(* memmove_f)(void *, const void *, size_t)
void *(* memcpy_f)(void *, const void *, size_t)
#define PLUGIN_SUBTYPE_DLL
const char * module_check_init(void)
double get_fps(const char *uri)
const char * version(void)
boolean get_frame(const lives_clip_data_t *, int64_t frame, int *rowstrides, int height, void **pixel_data)
frame starts at 0
boolean chill_out(const lives_clip_data_t *cdata)
free buffers when we arent playing sequentially / on standby
#define myfastrand0(fval)
void *(* realloc_f)(void *, size_t)
void *(* calloc_f)(size_t, size_t)
@ LIVES_INTERLACE_TOP_FIRST
@ LIVES_INTERLACE_BOTTOM_FIRST
void rip_audio_cleanup(const lives_clip_data_t *)
#define LIVES_FIELD_ARRAY
#define LIVES_FIELD_CHARPTR
#define LIVES_FIELD_FLAG_ZERO_ON_COPY
#define LIVES_FIELD_FLAG_FREE_ON_DELETE
< field wiill be freed in lives_struct_delete free(struct->field)
int * palettes
number forames from one keyframe to the next, 0 if unknown
lives_plugin_id_t plugin_id
char * URI
the URI of this cdata
char name[64]
e.g. "mkv_decoder"
void * capabilities
for future use
char subtype[16]
e.g. "dll"
int api_version_major
version of interface API
char type[16]
e.g. "decoder"
int pl_version_major
version of plugin
lives_special_field_t ** special_fields
user_data for delete_struct_callback