summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorniels <niels@dyne.org>2015-07-30 20:14:16 (GMT)
committer niels <niels@dyne.org>2015-07-30 20:14:16 (GMT)
commitc77fe52f8206afcf4facf1025f00601d658d920a (patch)
treef8c0af752e08bf1fd4772a1d2130fce7a471f998
parent38eb645f83e604d3c5751ecc235c66db708ad839 (diff)
update livido plugins to new api
-rw-r--r--veejay-current/veejay-server/livido-plugins/README5
-rw-r--r--veejay-current/veejay-server/livido-plugins/lvd_colortone.c15
-rw-r--r--veejay-current/veejay-server/livido-plugins/lvd_displaywall.c13
-rw-r--r--veejay-current/veejay-server/livido-plugins/lvd_shmin.c39
-rw-r--r--veejay-current/veejay-server/livido-plugins/lvd_shmout.c26
-rw-r--r--veejay-current/veejay-server/livido-plugins/lvd_solid.c4
-rw-r--r--veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c14
7 files changed, 54 insertions, 62 deletions
diff --git a/veejay-current/veejay-server/livido-plugins/README b/veejay-current/veejay-server/livido-plugins/README
index 4ed6d22..25f9f88 100644
--- a/veejay-current/veejay-server/livido-plugins/README
+++ b/veejay-current/veejay-server/livido-plugins/README
@@ -1,8 +1,5 @@
-livido plugin example very beta
-lvd_solid.c implements same functionality as dummy stream
+Livido
-tag type 'solid' / dummy mode will try to load this plugin
-if plugin.cfg contains path to .so object
diff --git a/veejay-current/veejay-server/livido-plugins/lvd_colortone.c b/veejay-current/veejay-server/livido-plugins/lvd_colortone.c
index 4bdd192..24fc8ae 100644
--- a/veejay-current/veejay-server/livido-plugins/lvd_colortone.c
+++ b/veejay-current/veejay-server/livido-plugins/lvd_colortone.c
@@ -28,7 +28,7 @@ livido_deinit_f deinit_instance( livido_port_t *my_instance )
}
-livido_process_f process_instance( livido_port_t *my_instance, double timecode )
+int process_instance( livido_port_t *my_instance, double timecode )
{
int len =0;
uint8_t *A[4] = {NULL,NULL,NULL,NULL};
@@ -40,10 +40,12 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette );
if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE;
-
- lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
+ return LIVIDO_ERROR_NO_OUTPUT_CHANNELS;
+ error = lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
+ if( error != LIVIDO_NO_ERROR )
+ return LIVIDO_ERROR_NO_INPUT_CHANNELS;
+
int uv_len = lvd_uv_plane_len( palette,w,h );
len = w * h;
@@ -51,8 +53,9 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
int green = lvd_extract_param_index( my_instance,"in_parameters", 1 );
int blue = lvd_extract_param_index( my_instance,"in_parameters", 2 );
int shift = 1;
- if( palette == LIVIDO_PALETTE_YUV444P )
- shift = 0;
+
+ if( palette == LIVIDO_PALETTE_YUV444P )
+ shift = 0;
if( O[0] != A[0] ) {
livido_memcpy( A[0], O[0], len );
diff --git a/veejay-current/veejay-server/livido-plugins/lvd_displaywall.c b/veejay-current/veejay-server/livido-plugins/lvd_displaywall.c
index 98aabec..8fc0725 100644
--- a/veejay-current/veejay-server/livido-plugins/lvd_displaywall.c
+++ b/veejay-current/veejay-server/livido-plugins/lvd_displaywall.c
@@ -56,7 +56,7 @@ static void displaywall_initVec(displaywall_t *wall, int w, int h)
}
}
-static int displaywall_tick( displaywall_t *wall, int video_width, int video_height )
+static void displaywall_tick( displaywall_t *wall, int video_width, int video_height )
{
wall->speed += wall->speedi;
if(wall->speed < 0) wall->speed = 0;
@@ -143,9 +143,8 @@ livido_deinit_f deinit_instance( livido_port_t *my_instance )
}
-livido_process_f process_instance( livido_port_t *my_instance, double timecode )
+int process_instance( livido_port_t *my_instance, double timecode )
{
- int len =0;
uint8_t *A[4] = {NULL,NULL,NULL,NULL};
uint8_t *O[4]= {NULL,NULL,NULL,NULL};
@@ -155,11 +154,11 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette );
if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_NO_OUTPUT_CHANNELS;
- lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
-
- len = w * h;
+ error = lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
+ if( error != LIVIDO_NO_ERROR )
+ return LIVIDO_ERROR_NO_INPUT_CHANNELS;
int scale = lvd_extract_param_index( my_instance,"in_parameters", 0 );
int mode = lvd_extract_param_index( my_instance,"in_parameters", 1 );
diff --git a/veejay-current/veejay-server/livido-plugins/lvd_shmin.c b/veejay-current/veejay-server/livido-plugins/lvd_shmin.c
index 4486c8f..95fae34 100644
--- a/veejay-current/veejay-server/livido-plugins/lvd_shmin.c
+++ b/veejay-current/veejay-server/livido-plugins/lvd_shmin.c
@@ -89,13 +89,13 @@ livido_init_f init_instance( livido_port_t *my_instance )
int fd = open( path, O_RDWR );
if(fd <= 0) {
printf("no env var VEEJAY_SHMID set and no file '%s' found!\n",path );
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_ENVIRONMENT
}
char buf[256];
livido_memset(buf,0,sizeof(buf));
read( fd, buf, 256 );
if(sscanf(buf, "master: %d", &shm_id ) != 1 )
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_ENVIRONMENT;
close(fd);
}
else if( env_id != NULL ) {
@@ -105,7 +105,7 @@ livido_init_f init_instance( livido_port_t *my_instance )
int r = shmget( shm_id, 0, 0400 );
if( r == -1 ) {
printf("error: %s for shm_id %d\n", strerror(errno),shm_id);
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_ENVIRONMENT;
}
char *ptr = (char*) shmat( r, NULL , 0 );
@@ -113,21 +113,20 @@ livido_init_f init_instance( livido_port_t *my_instance )
vj_shared_data *data = (vj_shared_data*) &(ptr[0]);
if( data == (char*) (-1) ) {
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
int dst_w = 0;
int dst_h = 0;
- lvd_extract_dimensions( my_instance, "out_channels", &dst_w, &dst_h );
-
+ if( lvd_extract_dimensions( my_instance, "out_channels", &dst_w, &dst_h ) != LIVIDO_NO_ERROR ) {
+ return LIVIDO_ERROR_NO_OUTPUT_CHANNELS;
+ }
//@ read format and dimensions from shared memory
int lvd_shm_palette = data->header[5]; //@ read livido palette format
int lvd_shm_width = data->header[0]; //@ read width of frame in shm
int lvd_shm_height = data->header[1]; //@ ... height ...
-
-
int cpu_flags = 0;
cpu_flags = cpu_flags | SWS_FAST_BILINEAR;
@@ -156,12 +155,7 @@ livido_init_f init_instance( livido_port_t *my_instance )
PIX_FMT_YUVJ422P or PIX_FMT_YUV422P
*/
-
( fullrange == 1 ? PIX_FMT_YUVJ422P : PIX_FMT_YUV422P ),
-
-
-
- // assume ldv_shmin is used in veejay, produce YUV 4:2:2 planar
cpu_flags,
NULL,
NULL,
@@ -220,24 +214,25 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
//@ get output channel details
int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette );
if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky
+ return LIVIDO_ERROR_NO_OUTPUT_CHANNELS; //@ error codes in livido flanky
int uv_len = lvd_uv_plane_len( palette,w,h );
char *addr = NULL;
error = livido_property_get( my_instance, "PLUGIN_private", 0, &addr );
+ if( error != LIVIDO_NO_ERROR )
+ return LIVIDO_ERROR_INTERNAL;
struct SwsContext *sws = NULL;
error = livido_property_get( my_instance, "PLUGIN_scaler", 0, &sws );
+ if( error != LIVIDO_NO_ERROR )
+ return LIVIDO_ERROR_INTERNAL;
vj_shared_data *v =(vj_shared_data*) &(addr[0]);
-
- if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE;
int res = pthread_rwlock_rdlock( &v->rwlock );
if( res == -1 ) {
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
uint8_t *start_addr = addr + 4096; //v->memptr
@@ -274,15 +269,9 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
sws_scale( sws, (const uint8_t *const *)in, strides,0, srcH,(uint8_t * const*) O, dst_strides );
- /*
- livido_memcpy( O[0], y, len );
- livido_memcpy( O[1], u, uv_len );
- livido_memcpy( O[2], v1, uv_len );
- */
-
res = pthread_rwlock_unlock( &v->rwlock );
if( res == -1 ) {
- return LIVIDO_ERROR_HARDWARE; //@ fix this in livido asap
+ return LIVIDO_ERROR_RESOURCE;
}
diff --git a/veejay-current/veejay-server/livido-plugins/lvd_shmout.c b/veejay-current/veejay-server/livido-plugins/lvd_shmout.c
index f6070c0..c631739 100644
--- a/veejay-current/veejay-server/livido-plugins/lvd_shmout.c
+++ b/veejay-current/veejay-server/livido-plugins/lvd_shmout.c
@@ -135,7 +135,7 @@ livido_init_f init_instance( livido_port_t *my_instance )
char *homedir = getenv("HOME");
if(!homedir) {
printf("HOME not set!\n");
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_ENVIRONMENT;
}
snprintf( path, sizeof(path)-1, "%s/.veejay", homedir );
@@ -143,7 +143,7 @@ livido_init_f init_instance( livido_port_t *my_instance )
}
if(!vj_shm_file_ref( v, plugin_dir ) ) {
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
int w = 0, h = 0;
@@ -160,13 +160,13 @@ livido_init_f init_instance( livido_port_t *my_instance )
v->shm_id = shmget( v->key, shm_size, IPC_CREAT | 0666 );
if( v->shm_id == -1 ) {
failed_init_cleanup(v);
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
v->sms = shmat( v->shm_id, NULL, 0 );
if( v->sms == NULL || v->sms == (char*) (-1) ) {
failed_init_cleanup(v);
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
pthread_rwlockattr_t rw_lock_attr;
@@ -189,20 +189,20 @@ livido_init_f init_instance( livido_port_t *my_instance )
int res = pthread_rwlockattr_init( &rw_lock_attr );
if( res == -1 ) {
failed_init_cleanup(v);
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
res = pthread_rwlockattr_setpshared( &rw_lock_attr, PTHREAD_PROCESS_SHARED );
if( res == -1 ) {
printf("cant use PTHREAD_PROCESS_SHARED: %s",strerror(errno));
failed_init_cleanup(v);
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
res = pthread_rwlock_init( &data->rwlock, &rw_lock_attr );
if( res == -1 ) {
failed_init_cleanup(v);
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
livido_property_set( my_instance , "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR, 1, &v );
@@ -241,7 +241,7 @@ livido_deinit_f deinit_instance( livido_port_t *my_instance )
return LIVIDO_NO_ERROR;
}
-livido_process_f process_instance( livido_port_t *my_instance, double timecode )
+int process_instance( livido_port_t *my_instance, double timecode )
{
int len =0;
int i = 0;
@@ -255,7 +255,7 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
//@ get output channel details
int error = lvd_extract_channel_values( my_instance, "in_channels", 0, &w,&h, I,&palette );
if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky
+ return LIVIDO_ERROR_NO_OUTPUT_CHANNELS; //@ error codes in livido flanky
int uv_len = lvd_uv_plane_len( palette,w,h );
len = w * h;
@@ -263,14 +263,14 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
shared_video_t *v = NULL;
error = livido_property_get( my_instance, "PLUGIN_private", 0, &v );
if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_INTERNAL;
char *addr = (char*)v->sms;
vj_shared_data *data = (vj_shared_data*) v->sms;
int res = pthread_rwlock_wrlock( &data->rwlock );
if( res == -1 ) {
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
uint8_t *ptr = addr + 4096;
@@ -282,7 +282,7 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
printf("shared resource in %d x %d, your frame in %d x %d\n",
data->header[0],data->header[1],w,h);
pthread_rwlock_unlock( &data->rwlock );
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
livido_memcpy( y, I[0], len );
livido_memcpy( u, I[1], uv_len );
@@ -290,7 +290,7 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
res = pthread_rwlock_unlock( &data->rwlock );
if( res == -1 ) {
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_RESOURCE;
}
return LIVIDO_NO_ERROR;
diff --git a/veejay-current/veejay-server/livido-plugins/lvd_solid.c b/veejay-current/veejay-server/livido-plugins/lvd_solid.c
index 79788bb..dd53821 100644
--- a/veejay-current/veejay-server/livido-plugins/lvd_solid.c
+++ b/veejay-current/veejay-server/livido-plugins/lvd_solid.c
@@ -40,7 +40,7 @@ livido_deinit_f deinit_instance( livido_port_t *my_instance )
}
-livido_process_f process_instance( livido_port_t *my_instance, double timecode )
+int process_instance( livido_port_t *my_instance, double timecode )
{
int len =0;
uint8_t *O[4]= {NULL,NULL,NULL,NULL};
@@ -52,7 +52,7 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
//@ get output channel details
int error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w,&h, O,&palette );
if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE; //@ error codes in livido flanky
+ return LIVIDO_ERROR_NO_OUTPUT_CHANNELS; //@ error codes in livido flanky
int uv_len = lvd_uv_plane_len( palette,w,h );
len = w * h;
diff --git a/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c b/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c
index 1ecddf9..08953fd 100644
--- a/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c
+++ b/veejay-current/veejay-server/livido-plugins/lvd_stroboscope.c
@@ -149,7 +149,7 @@ static inline void fading_stroboscopeUV(
}
}
-livido_process_f process_instance( livido_port_t *my_instance, double timecode )
+int process_instance( livido_port_t *my_instance, double timecode )
{
int len =0;
uint8_t *A[4] = {NULL,NULL,NULL,NULL};
@@ -169,10 +169,15 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
error = livido_property_get( my_instance, "PLUGIN_private", 0, &ptr );
if( error != LIVIDO_NO_ERROR )
- return LIVIDO_ERROR_HARDWARE;
+ return LIVIDO_ERROR_INTERNAL;
- lvd_extract_channel_values( my_instance, "out_channels", 0, &w, &h, O, &palette );
- lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
+ error = lvd_extract_channel_values( my_instance, "out_channels", 0, &w, &h, O, &palette );
+ if( error != LIVIDO_NO_ERROR )
+ return LIVIDO_ERROR_INTERNAL;
+
+ error = lvd_extract_channel_values( my_instance, "in_channels" , 0, &w, &h, A, &palette );
+ if( error != LIVIDO_NO_ERROR )
+ return LIVIDO_ERROR_INTERNAL;
len = w * h;
@@ -235,7 +240,6 @@ livido_process_f process_instance( livido_port_t *my_instance, double timecode
}
livido_port_t *livido_setup(livido_setup_t list[], int version)
-
{
LIVIDO_IMPORT(list);