mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-12 10:50:01 +01:00
fix freeframe
disabled freeframe plugin parameters fixes to yuv lib fixes to vevo lib bump version
This commit is contained in:
@@ -58,14 +58,23 @@ typedef struct
|
||||
//#if (V_BITS == 32)
|
||||
#define FF_CAP_V_BITS_VIDEO FF_CAP_32BITVIDEO
|
||||
static int freeframe_signature_ = VEVO_PLUG_FF;
|
||||
|
||||
|
||||
static void *rgb_conv_ = NULL;
|
||||
static void *yuv_conv_ = NULL;
|
||||
/*#elif (V_BITS == 24)
|
||||
#define FF_CAP_V_BITS_VIDEO FF_CAP_24BITVIDEO
|
||||
#else // V_BITS = 16
|
||||
#define FF_CAP_V_BITS_VIDEO FF_CAP_16BITVIDEO
|
||||
#endif*/
|
||||
|
||||
void freeframe_destroy( ) {
|
||||
if( rgb_conv_ ) {
|
||||
yuv_free_swscaler( rgb_conv_ );
|
||||
}
|
||||
if( yuv_conv_ ) {
|
||||
yuv_free_swscaler( yuv_conv_ );
|
||||
}
|
||||
}
|
||||
|
||||
void* deal_with_ff( void *handle, char *name )
|
||||
{
|
||||
void *port = vpn( VEVO_FF_PORT );
|
||||
@@ -125,8 +134,10 @@ void* deal_with_ff( void *handle, char *name )
|
||||
vevo_property_set( port, "num_inputs", VEVO_ATOM_TYPE_INT,1, &n_inputs );
|
||||
vevo_property_set( port, "HOST_plugin_type", VEVO_ATOM_TYPE_INT, 1, &freeframe_signature_ );
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO, "FF Load: '%s' , %d params, %d inputs", plugin_name, n_params, n_inputs );
|
||||
|
||||
// veejay_msg(VEEJAY_MSG_INFO, "FF Load: '%s' , %d params, %d inputs", plugin_name, n_params, n_inputs );
|
||||
|
||||
n_params = 0; //@ FIXME: parameter initialization
|
||||
|
||||
int p;
|
||||
for( p= 0; p < n_params; p ++ )
|
||||
{
|
||||
@@ -135,36 +146,58 @@ void* deal_with_ff( void *handle, char *name )
|
||||
|
||||
double min = 0;
|
||||
double max = 1.0;
|
||||
int kind = 0;
|
||||
int kind = -1;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case FF_TYPE_BOOLEAN:
|
||||
case 0:
|
||||
kind = HOST_PARAM_SWITCH;
|
||||
break;
|
||||
case FF_TYPE_RED:
|
||||
case FF_TYPE_BLUE:
|
||||
case FF_TYPE_GREEN:
|
||||
kind = HOST_PARAM_NUMBER;
|
||||
max = 255.0;
|
||||
min = 0.0;
|
||||
break;
|
||||
case FF_TYPE_XPOS:
|
||||
kind = HOST_PARAM_NUMBER;
|
||||
case FF_TYPE_YPOS:
|
||||
kind = HOST_PARAM_NUMBER;
|
||||
case FF_TYPE_STANDARD:
|
||||
kind = HOST_PARAM_NUMBER;
|
||||
min = 0.0;
|
||||
max = 100.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(kind)
|
||||
if(kind == -1) {
|
||||
#ifdef STRICT_CHECKING
|
||||
veejay_msg( VEEJAY_MSG_DEBUG, "Dont know about parameter type %d", type );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
void *parameter = vpn( VEVO_FF_PARAM_PORT );
|
||||
double ivalue = (double)q( FF_GETPARAMETERDEFAULT, (LPVOID) p, 0).fvalue;
|
||||
|
||||
char pname[32];
|
||||
q( FF_GETPARAMETERNAME, (LPVOID) p,pname );
|
||||
|
||||
vevo_property_set( parameter, "default", VEVO_ATOM_TYPE_DOUBLE,1 ,&ivalue );
|
||||
vevo_property_set( parameter, "value" , VEVO_ATOM_TYPE_DOUBLE,1, &ivalue );
|
||||
vevo_property_set( parameter, "min", VEVO_ATOM_TYPE_DOUBLE, 1, &min );
|
||||
vevo_property_set( parameter, "max", VEVO_ATOM_TYPE_DOUBLE,1, &max );
|
||||
vevo_property_set( parameter, "HOST_kind", VEVO_ATOM_TYPE_INT,1,&kind );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
|
||||
veejay_msg( VEEJAY_MSG_DEBUG, "parameter %d is %s, defaults to %g, range is %g - %g, kind is %d",
|
||||
p, pname, ivalue, min, max, kind );
|
||||
#endif
|
||||
|
||||
char key[20];
|
||||
snprintf(key,20, "p%02d", p );
|
||||
vevo_property_set( port, key, VEVO_ATOM_TYPE_VOIDPTR, 1, ¶meter );
|
||||
@@ -325,7 +358,7 @@ int freeframe_set_parameter_from_string( void *instance, int p, const char *str,
|
||||
|
||||
|
||||
|
||||
int freeframe_plug_init( void *plugin, int w, int h )
|
||||
void *freeframe_plug_init( void *plugin, int w, int h )
|
||||
{
|
||||
VideoInfoStruct v;
|
||||
v.frameWidth = w;
|
||||
@@ -333,6 +366,10 @@ int freeframe_plug_init( void *plugin, int w, int h )
|
||||
v.orientation = 1;
|
||||
v.bitDepth = FF_CAP_V_BITS_VIDEO;
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( v.bitDepth == FF_CAP_32BITVIDEO );
|
||||
#endif
|
||||
|
||||
void *base = NULL;
|
||||
int error = vevo_property_get( plugin, "base", 0, &base);
|
||||
#ifdef STRICT_CHECING
|
||||
@@ -351,72 +388,58 @@ int freeframe_plug_init( void *plugin, int w, int h )
|
||||
int num_channels = 0;
|
||||
int i;
|
||||
vevo_property_get( plugin, "num_inputs", 0, &num_channels );
|
||||
void *buf = vpn( VEVO_ANONYMOUS_PORT );
|
||||
error = vevo_property_set( instance, "HOST_buffers",
|
||||
VEVO_ATOM_TYPE_PORTPTR,1,&buf);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
// input channels
|
||||
for( i = 0; i < num_channels; i ++ )
|
||||
{
|
||||
// reserve rgb buffer
|
||||
char key[10];
|
||||
uint8_t *space = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h * 4 );
|
||||
sprintf(key ,"in%02d",i);
|
||||
// store space
|
||||
vevo_property_set( buf, key, VEVO_ATOM_TYPE_VOIDPTR,1,&space);
|
||||
}
|
||||
// output channel
|
||||
|
||||
uint8_t *space = (uint8_t*) vj_malloc(sizeof(uint8_t) * w * h * 4 );
|
||||
vevo_property_set( buf, "output", VEVO_ATOM_TYPE_VOIDPTR,1,&space);
|
||||
|
||||
uint8_t *space = (uint8_t*) vj_malloc( sizeof(uint8_t) * w * h * 4 * num_channels);
|
||||
error = vevo_property_set( plugin , "HOST_buffer", VEVO_ATOM_TYPE_VOIDPTR, 1, &space );
|
||||
if( error != VEVO_NO_ERROR ) {
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Unable to create HOST_buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
generic_process_f gpf = freeframe_plug_process;
|
||||
vevo_property_set( instance,
|
||||
vevo_property_set( plugin,
|
||||
"HOST_plugin_process_f",
|
||||
VEVO_ATOM_TYPE_VOIDPTR,
|
||||
1,
|
||||
&gpf );
|
||||
|
||||
generic_push_channel_f gpu = freeframe_push_channel;
|
||||
vevo_property_set( instance,
|
||||
vevo_property_set( plugin,
|
||||
"HOST_plugin_push_f",
|
||||
VEVO_ATOM_TYPE_VOIDPTR,
|
||||
1,
|
||||
&gpu );
|
||||
|
||||
generic_clone_parameter_f gcc = freeframe_clone_parameter;
|
||||
vevo_property_set( instance,
|
||||
vevo_property_set( plugin,
|
||||
"HOST_plugin_param_clone_f",
|
||||
VEVO_ATOM_TYPE_VOIDPTR,
|
||||
1,
|
||||
&gcc );
|
||||
|
||||
generic_reverse_clone_parameter_f grc = freeframe_reverse_clone_parameter;
|
||||
vevo_property_set( instance,
|
||||
vevo_property_set( plugin,
|
||||
"HOST_plugin_param_reverse_f",
|
||||
VEVO_ATOM_TYPE_VOIDPTR,
|
||||
1,
|
||||
&grc );
|
||||
|
||||
generic_default_values_f gdb = freeframe_plug_retrieve_default_values;
|
||||
vevo_property_set( instance,
|
||||
vevo_property_set( plugin,
|
||||
"HOST_plugin_defaults_f",
|
||||
VEVO_ATOM_TYPE_VOIDPTR,
|
||||
1,
|
||||
&gdb );
|
||||
|
||||
generic_deinit_f gin = freeframe_plug_deinit;
|
||||
vevo_property_set( instance,
|
||||
vevo_property_set( plugin,
|
||||
"HOST_plugin_deinit_f",
|
||||
VEVO_ATOM_TYPE_VOIDPTR,
|
||||
1,
|
||||
&gin );
|
||||
|
||||
|
||||
return 1;
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -440,29 +463,14 @@ void freeframe_plug_deinit( void *plugin )
|
||||
|
||||
q( FF_DEINSTANTIATE, NULL, instance );
|
||||
|
||||
void *channels = NULL;
|
||||
error = vevo_property_get( plugin, "HOST_buffers",0,&channels);
|
||||
uint8_t *space = NULL;
|
||||
error = vevo_property_get( plugin, "HOST_buffer",0,&space);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
char **items = vevo_list_properties( channels );
|
||||
int i;
|
||||
for( i = 0; items[i] != NULL ; i ++ )
|
||||
{
|
||||
uint8_t *space = NULL;
|
||||
error = vevo_property_get( channels, items[i], 0, &space );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
if( error == VEVO_NO_ERROR ) {
|
||||
free(space);
|
||||
}
|
||||
|
||||
uint8_t *space = NULL;
|
||||
error = vevo_property_get( plugin , "output", 0, &space );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
free(space);
|
||||
}
|
||||
|
||||
void freeframe_plug_free( void *plugin )
|
||||
@@ -490,23 +498,23 @@ void freeframe_push_channel( void *instance, const char *key,int n, VJFrame *fra
|
||||
}
|
||||
else
|
||||
{
|
||||
//@ convert rgb data
|
||||
sprintf(inkey, "in%02d",n );
|
||||
error = vevo_property_get( instance, "HOST_buffers",0,&chan );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
error = vevo_property_get( chan, inkey, 0, &space );
|
||||
error = vevo_property_get( instance, "HOST_buffer",0,&space );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
uint32_t chan_offset = frame->width * frame->height * 4 * n;
|
||||
|
||||
VJFrame *dst1 = yuv_rgb_template( space + chan_offset, frame->width,frame->height, PIX_FMT_RGB32 );
|
||||
|
||||
VJFrame *dst1 = yuv_rgb_template( space, frame->width,frame->height, PIX_FMT_RGB24 );
|
||||
if( yuv_conv_ == NULL ) {
|
||||
sws_template templ;
|
||||
templ.flags = 1;
|
||||
yuv_conv_ = yuv_init_swscaler( frame,dst1, &templ, yuv_sws_get_cpu_flags() );
|
||||
}
|
||||
|
||||
yuv_convert_any_ac( frame, dst1, frame->format, dst1->format );
|
||||
yuv_convert_and_scale_rgb( yuv_conv_, frame, dst1 );
|
||||
|
||||
free(dst1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -526,19 +534,13 @@ int freeframe_plug_process( void *plugin, double timecode )
|
||||
#ifdef STRICT_CHECING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
char *key = "in00";
|
||||
void *channels = NULL;
|
||||
error = vevo_property_get( plugin, "HOST_buffers",0,&channels );
|
||||
void *in = NULL;
|
||||
uint8_t *space = NULL;
|
||||
error = vevo_property_get( plugin, "HOST_buffer",0,&space );
|
||||
#ifdef STRICT_CHECING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
error = vevo_property_get( channels, key, 0, &in );
|
||||
#ifdef STRICT_CHECING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
q( FF_PROCESSFRAME, in, instance );
|
||||
|
||||
q( FF_PROCESSFRAME, space, instance );
|
||||
|
||||
VJFrame *output_frame = NULL;
|
||||
|
||||
@@ -546,11 +548,32 @@ int freeframe_plug_process( void *plugin, double timecode )
|
||||
#ifdef STRICT_CHECING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
VJFrame *dst1 = yuv_rgb_template( in, output_frame->width, output_frame->height, PIX_FMT_RGB24 );
|
||||
|
||||
yuv_convert_any_ac( dst1, output_frame, dst1->format, output_frame->format );
|
||||
|
||||
VJFrame *src1 = yuv_rgb_template( space, output_frame->width, output_frame->height, PIX_FMT_RGB32 );
|
||||
|
||||
// yuv_convert_any_ac( src1, output_frame, src1->format, output_frame->format );
|
||||
|
||||
if( rgb_conv_ == NULL ) {
|
||||
sws_template templ;
|
||||
templ.flags = 1;
|
||||
rgb_conv_ = yuv_init_swscaler( src1,output_frame, &templ, yuv_sws_get_cpu_flags() );
|
||||
}
|
||||
|
||||
yuv_convert_and_scale_from_rgb( rgb_conv_, src1, output_frame );
|
||||
|
||||
free(src1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void freeframe_plug_param_f( void *plugin, int seq_no, void *dargs )
|
||||
{
|
||||
int instance = 0;
|
||||
int error = vevo_property_get( plugin, "instance",0, &instance );
|
||||
#ifdef STRICT_CHECING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user