Go to the documentation of this file.
6 #ifndef __DECPLUGIN_H__
7 #define __DECPLUGIN_H__
14 #define DEC_PLUGIN_VERSION_MAJOR 3
15 #define DEC_PLUGIN_VERSION_MINOR 0
18 #include <sys/types.h>
24 # define ALLOW_UNUSED __attribute__((unused))
31 #ifdef NEED_LOCAL_WEED
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)
99 typedef void *(*malloc_f)(size_t);
101 typedef void *(*memset_f)(
void *, int, size_t);
102 typedef void *(*memcpy_f)(
void *,
const void *, size_t);
103 typedef void *(*realloc_f)(
void *, size_t);
104 typedef void *(*calloc_f)(size_t, size_t);
105 typedef void *(*memmove_f)(
void *,
const void *, size_t);
108 #if defined NEED_TIMING || !defined HAVE_GETENTROPY
113 #include <sys/time.h>
116 static 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)))))
140 static 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;
169 typedef 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))
310 #ifdef NEED_CLONEFUNC
311 #define CREATOR_ID "LiVES decoder plugin"
314 static 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;
344 #ifdef NEED_CLONEFUNC
345 if (!cdata_lsd) make_acid();
346 if (!cdata_lsd)
return NULL;
347 cdata = lives_struct_create(cdata_lsd);
361 static void cdata_stamp(
lives_clip_data_t *cdata,
const char *name,
int vmaj,
int vmin) {
367 #ifdef NEED_CLONEFUNC
369 if (!cdata)
return NULL;
370 if (!cdata_lsd) make_acid();
371 return lives_struct_copy((
void *)&cdata->
lsd);
379 #endif // #ifndef __DECPLUGIN_H__
void *(* memcpy_f)(void *, const void *, size_t)
int api_version_major
version of interface API
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...
char subtype[16]
e.g. "dll"
char * URI
the URI of this cdata
boolean rip_audio_sequential(const lives_clip_data_t *, const char *fname)
int * palettes
number forames from one keyframe to the next, 0 if unknown
int64_t rip_audio(const lives_clip_data_t *, const char *fname, int64_t stframe, int64_t nframes, unsigned char **abuff)
#define LIVES_FIELD_CHARPTR
boolean chill_out(const lives_clip_data_t *cdata)
free buffers when we arent playing sequentially / on standby
#define LIVES_FIELD_FLAG_ZERO_ON_COPY
@ LIVES_INTERLACE_TOP_FIRST
const char * version(void)
const char * module_check_init(void)
void *(* malloc_f)(size_t)
double get_fps(const char *uri)
void *(* realloc_f)(void *, size_t)
#define PLUGIN_TYPE_DECODER
void clip_data_free(lives_clip_data_t *)
free clip data - this should be called for each instance before unloading the module
boolean set_palette(lives_clip_data_t *)
#define PLUGIN_SUBTYPE_DLL
char name[64]
e.g. "mkv_decoder"
#define LIVES_FIELD_FLAG_FREE_ON_DELETE
< field wiill be freed in lives_struct_delete free(struct->field)
char type[16]
e.g. "decoder"
void rip_audio_cleanup(const lives_clip_data_t *)
boolean get_frame(const lives_clip_data_t *, int64_t frame, int *rowstrides, int height, void **pixel_data)
frame starts at 0
@ LIVES_MEDIA_TYPE_UNKNOWN
lives_plugin_id_t plugin_id
#define DEC_PLUGIN_VERSION_MAJOR
int pl_version_major
version of plugin
void *(* memmove_f)(void *, const void *, size_t)
lives_special_field_t ** special_fields
user_data for delete_struct_callback
void *(* calloc_f)(size_t, size_t)
#define DEC_PLUGIN_VERSION_MINOR
#define LIVES_FIELD_ARRAY
void * capabilities
for future use
#define myfastrand0(fval)
void *(* memset_f)(void *, int, size_t)
@ LIVES_INTERLACE_BOTTOM_FIRST