mirror of
https://github.com/game-stop/veejay.git
synced 2026-06-16 04:31:23 +02:00
repurpose 'toggle multicast' for vims trickplay forwarding, safer status length handling, resolve CPU hog
This commit is contained in:
@@ -17487,13 +17487,13 @@ Events may not always be triggered if veejay is configured to keep in sync (hard
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="toggle_multicast">
|
||||
<object class="GtkToggleButton" id="toggle_vims_forwarding">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="has-tooltip">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Enable Multicast frame sender</property>
|
||||
<signal name="toggled" handler="on_toggle_multicast_toggled" swapped="no"/>
|
||||
<property name="tooltip-text" translatable="yes">Enable Forwarding of VIMS trickplay</property>
|
||||
<signal name="toggled" handler="on_toggle_vims_forwarding_toggled" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="image51">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -11663,13 +11663,13 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="toggle_multicast">
|
||||
<object class="GtkToggleButton" id="toggle_vims_forwarding">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Enable Multicast frame sender</property>
|
||||
<signal name="toggled" handler="on_toggle_multicast_toggled" swapped="no"/>
|
||||
<property name="tooltip_text" translatable="yes">Enable Forwarding of VIMS trickplay</property>
|
||||
<signal name="toggled" handler="on_toggle_vims_forwarding_toggled" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="image51">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -14634,26 +14634,6 @@ Quicktime-MJPEG</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">1</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="record_vp">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Record video from Viewport</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="clicked" handler="on_record_vp_clicked" last_modification_time="Sun, 21 Jan 2007 19:33:45 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="setup_viewport">
|
||||
<property name="can_focus">True</property>
|
||||
|
||||
@@ -5061,11 +5061,6 @@ void on_uq_button_clicked( GtkWidget *w, gpointer data ) // 1/8
|
||||
vj_msg(VEEJAY_MSG_INFO,"Live view quality set to an eighth resolution");
|
||||
}
|
||||
|
||||
void on_record_vp_clicked( GtkWidget *w, gpointer data )
|
||||
{
|
||||
single_vims( VIMS_RECVIEWPORT );
|
||||
}
|
||||
|
||||
void on_subrender_entry_toggle_toggled(GtkWidget *w, gpointer data)
|
||||
{
|
||||
if(info->status_lock || info->parameter_lock)
|
||||
@@ -5273,6 +5268,7 @@ void on_button_vloop_start_clicked(GtkWidget *widget, gpointer user_data)
|
||||
multi_vims( VIMS_VLOOPBACK_START, "%d", get_nums( "spin_vloop" ) );
|
||||
}
|
||||
|
||||
/*
|
||||
void on_toggle_multicast_toggled(GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
if( is_button_toggled( "toggle_multicast" ) ) {
|
||||
@@ -5283,6 +5279,14 @@ void on_toggle_multicast_toggled(GtkWidget *widget, gpointer user_data)
|
||||
single_vims( VIMS_VIDEO_MCAST_STOP );
|
||||
vj_msg(VEEJAY_MSG_INFO, "Multicast disabled");
|
||||
}
|
||||
}*/
|
||||
|
||||
void on_toggle_vims_forwarding_toggled(GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
if(info->status_lock)
|
||||
return;
|
||||
int is_active = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget));
|
||||
multi_vims( VIMS_MESSAGE_FORWARDING, "%d", is_active);
|
||||
}
|
||||
|
||||
void on_stream_loopstop_value_changed( GtkWidget *widget, gpointer user_data )
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
#ifndef GVRCOMMON_H
|
||||
#define GVRCOMMON_H
|
||||
#define STATUS_TOKENS 40
|
||||
|
||||
#define STATUS_LENGTH 1024
|
||||
#define VEEJAY_CODENAME VERSION
|
||||
/* Status bytes */
|
||||
@@ -56,6 +56,7 @@
|
||||
#define SAMPLE_INV_COUNT 36
|
||||
#define FEEDBACK 35
|
||||
#define GLOBAL_CHAIN 37
|
||||
#define MESSAGE_FORWARDING 38
|
||||
#define SAMPLE_TRANSITION_ACTIVE 32
|
||||
#define SAMPLE_TRANSITION_LENGTH 33
|
||||
#define SAMPLE_TRANSITION_SHAPE 34
|
||||
@@ -75,4 +76,8 @@
|
||||
|
||||
#define __MAX_TRACKS 16
|
||||
|
||||
|
||||
#define STATUS_ARRAY_SIZE (VIMS_STATUS_TOKENS+1)
|
||||
#define HISTORY_PLAYMODES 4
|
||||
|
||||
#endif
|
||||
|
||||
@@ -100,10 +100,24 @@ typedef struct {
|
||||
GApplication *app;
|
||||
} GuiContext;
|
||||
|
||||
static int draw_count = 0;
|
||||
|
||||
static gboolean vj_gui_idle_cb(gpointer data)
|
||||
{
|
||||
GuiContext *ctx = (GuiContext *)data;
|
||||
static gint64 last = 0;
|
||||
const gint64 now = g_get_monotonic_time();
|
||||
static int counter = 0;
|
||||
if (++counter % 1000000 == 0)
|
||||
fprintf(stderr, "idle alive\n");
|
||||
if (now - last < 20000) {
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
last = now;
|
||||
|
||||
|
||||
|
||||
GuiContext *ctx = (GuiContext *)data;
|
||||
|
||||
if (!gveejay_idle(NULL)) {
|
||||
g_application_quit(ctx->app);
|
||||
return G_SOURCE_REMOVE;
|
||||
@@ -111,12 +125,26 @@ static gboolean vj_gui_idle_cb(gpointer data)
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
static gboolean vj_gui_idle_cb1(gpointer data)
|
||||
{
|
||||
GuiContext *ctx = data;
|
||||
if (!gveejay_idle(NULL)) {
|
||||
fprintf(stderr, "Quiting application");
|
||||
g_application_quit(ctx->app);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void vj_gui_activate(GApplication *app, gpointer user_data)
|
||||
{
|
||||
GuiContext *ctx = g_new0(GuiContext, 1);
|
||||
ctx->app = app;
|
||||
|
||||
|
||||
g_application_hold(app);
|
||||
|
||||
vj_gui_set_debug_level(verbosity, n_tracks, 0, 0);
|
||||
default_bank_values(&col, &row);
|
||||
|
||||
@@ -130,7 +158,14 @@ static void vj_gui_activate(GApplication *app, gpointer user_data)
|
||||
use_threads, load_midi, midi_file,
|
||||
arg_beta, arg_autoconnect, arg_fasterui);
|
||||
|
||||
g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, vj_gui_idle_cb, ctx,(GDestroyNotify)g_free);
|
||||
g_timeout_add_full(
|
||||
G_PRIORITY_DEFAULT,
|
||||
16,
|
||||
vj_gui_idle_cb1,
|
||||
ctx,
|
||||
(GDestroyNotify)g_free
|
||||
);
|
||||
//g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, vj_gui_idle_cb, ctx,(GDestroyNotify)g_free);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -249,8 +284,6 @@ gint vj_gui_command_line (GApplication *app,
|
||||
|
||||
g_application_activate(app);
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO, "See you!");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +65,9 @@ typedef struct
|
||||
uint8_t *status_buffer;
|
||||
int track_list[__MAX_TRACKS];
|
||||
int track_items; //shared
|
||||
int status_tokens[STATUS_TOKENS]; //shared
|
||||
int active;
|
||||
int have_frame;
|
||||
int status_tokens[STATUS_ARRAY_SIZE]; //shared
|
||||
int active;
|
||||
int have_frame;
|
||||
int grey_scale;
|
||||
int full_range;
|
||||
int preview;
|
||||
@@ -112,7 +112,7 @@ void *gvr_preview_init(int max_tracks, int use_threads)
|
||||
int i;
|
||||
|
||||
for( i = 0; i < max_tracks; i++ )
|
||||
vp->track_sync->status_tokens[i] = (int*) vj_calloc(sizeof(int) * STATUS_TOKENS);
|
||||
vp->track_sync->status_tokens[i] = (int*) vj_calloc(sizeof(int) * STATUS_ARRAY_SIZE);
|
||||
|
||||
vp->n_tracks = max_tracks;
|
||||
|
||||
@@ -366,7 +366,7 @@ static int veejay_process_status( veejay_preview_t *vp, veejay_track_t *v )
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( status_to_arr( (char*) v->status_buffer, v->status_tokens ) < 37 )
|
||||
if( status_to_arr( (char*) v->status_buffer, v->status_tokens ) < VIMS_STATUS_TOKENS )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_WARNING, "Expected more status tokens");
|
||||
return 0;
|
||||
@@ -878,8 +878,8 @@ static GdkPixbuf **gvr_grab_images(void *preview)
|
||||
|
||||
static int *int_dup( int *status )
|
||||
{
|
||||
int *res = (int*) vj_calloc( sizeof(int) * STATUS_TOKENS );
|
||||
veejay_memcpy( res, status, STATUS_TOKENS * sizeof(int));
|
||||
int *res = (int*) vj_calloc( sizeof(int) * STATUS_ARRAY_SIZE );
|
||||
veejay_memcpy( res, status, STATUS_ARRAY_SIZE * sizeof(int));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -350,6 +350,7 @@ enum {
|
||||
WIDGET_GLOBALCHAINTOGGLE = 249,
|
||||
WIDGET_GLOBALCHAINCOPY = 250,
|
||||
WIDGET_GLOBALCHAINLEVEL = 251,
|
||||
WIDGET_MESSAGE_FORWARDING = 252
|
||||
};
|
||||
|
||||
|
||||
@@ -754,6 +755,7 @@ static struct
|
||||
{ "chain_toggleglobalchain", WIDGET_GLOBALCHAINTOGGLE },
|
||||
{ "chain_copyglobalchain", WIDGET_GLOBALCHAINCOPY },
|
||||
{ "chain_globalchainlevel", WIDGET_GLOBALCHAINLEVEL},
|
||||
{ "toggle_vims_forwarding", WIDGET_MESSAGE_FORWARDING },
|
||||
{ NULL, -1 },
|
||||
};
|
||||
|
||||
@@ -1147,8 +1149,8 @@ typedef struct
|
||||
{
|
||||
GtkBuilder *main_window;
|
||||
vj_client *client;
|
||||
int status_tokens[STATUS_TOKENS]; /* current status tokens */
|
||||
int *history_tokens[4]; /* list last known status tokens */
|
||||
int status_tokens[STATUS_ARRAY_SIZE]; /* current status tokens */
|
||||
int *history_tokens[HISTORY_PLAYMODES]; /* list last known status tokens */
|
||||
int status_passed;
|
||||
int status_lock;
|
||||
int slider_lock;
|
||||
@@ -1161,13 +1163,10 @@ typedef struct
|
||||
int launch_sensitive;
|
||||
struct timeval alarm;
|
||||
struct timeval timer;
|
||||
// GIOChannel *channel;
|
||||
GdkVisual *color_map;
|
||||
gint connecting;
|
||||
// gint logging;
|
||||
gint streamrecording;
|
||||
gint samplerecording;
|
||||
// gint cpumeter;
|
||||
gint cachemeter;
|
||||
gint image_w;
|
||||
gint image_h;
|
||||
@@ -2952,8 +2951,9 @@ int gveejay_restart(void)
|
||||
|
||||
gboolean gveejay_running(void)
|
||||
{
|
||||
if(!running_g_)
|
||||
if(!running_g_) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3176,24 +3176,34 @@ static gchar *recv_vims_args(int slen, int *bytes_written, int *arg0, int *arg1,
|
||||
unsigned char tmp[tmp_len];
|
||||
veejay_memset(tmp,0,sizeof(tmp));
|
||||
int ret = vj_client_read( info->client, V_CMD, tmp, slen );
|
||||
if( ret == -1 )
|
||||
if( ret == -1 ) {
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Error receiving VIMS packet of len %d", slen);
|
||||
reloaded_schedule_restart();
|
||||
}
|
||||
int len = 0;
|
||||
if( sscanf( (char*)tmp, "%06d", &len ) != 1 )
|
||||
if( sscanf( (char*)tmp, "%06d", &len ) != 1 ) {
|
||||
return NULL;
|
||||
if( sscanf( (char*)tmp + 6, "%04d", arg0 ) != 1 )
|
||||
}
|
||||
if( sscanf( (char*)tmp + 6, "%04d", arg0 ) != 1 ) {
|
||||
return NULL;
|
||||
if( sscanf( (char*)tmp + 10, "%02d", arg1) != 1 )
|
||||
}
|
||||
if( sscanf( (char*)tmp + 10, "%02d", arg1) != 1 ) {
|
||||
return NULL;
|
||||
if( sscanf( (char*)tmp + 12, "%1d", arg2) != 1 )
|
||||
}
|
||||
if( sscanf( (char*)tmp + 12, "%1d", arg2) != 1 ) {
|
||||
return NULL;
|
||||
}
|
||||
unsigned char *result = NULL;
|
||||
if( ret <= 0 || len <= 0 || slen <= 0)
|
||||
if( ret <= 0 || len <= 0 || slen <= 0) {
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Got empty VIMS packet");
|
||||
return (gchar*)result;
|
||||
}
|
||||
result = (unsigned char*) vj_calloc(sizeof(unsigned char) * (len + 16) );
|
||||
*bytes_written = vj_client_read( info->client, V_CMD, result, len );
|
||||
if( *bytes_written == -1 )
|
||||
if( *bytes_written == -1 ) {
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Error reading requested bytes from VIMS packet");
|
||||
reloaded_schedule_restart();
|
||||
}
|
||||
|
||||
return (gchar*) result;
|
||||
}
|
||||
@@ -7051,15 +7061,6 @@ static int load_editlist_info(void)
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( widget_cache[ WIDGET_BUTTON_5_4 ] ) , values[8] );
|
||||
}
|
||||
|
||||
if( use_vims_mcast ) {
|
||||
if(!gtk_widget_is_sensitive(widget_cache[ WIDGET_TOGGLE_MULTICAST] ))
|
||||
gtk_widget_set_sensitive(widget_cache[ WIDGET_TOGGLE_MULTICAST ], TRUE);
|
||||
}
|
||||
else {
|
||||
if(gtk_widget_is_sensitive(widget_cache[ WIDGET_TOGGLE_MULTICAST ] ))
|
||||
gtk_widget_set_sensitive(widget_cache[ WIDGET_TOGGLE_MULTICAST ], FALSE);
|
||||
}
|
||||
|
||||
int button_global_state = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget_cache[ WIDGET_GLOBAL_TRANSITIONS_TOGGLE ]));
|
||||
if( button_global_state != global_transition_state ) {
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( widget_cache[ WIDGET_GLOBAL_TRANSITIONS_TOGGLE ]), global_transition_state );
|
||||
@@ -7321,7 +7322,7 @@ int veejay_update_multitrack( void *ptr )
|
||||
int tmp = 0, i;
|
||||
|
||||
if( s->status_list[s->master] != NULL ) {
|
||||
for ( i = 0; i < STATUS_TOKENS; i ++ )
|
||||
for ( i = 0; i < STATUS_ARRAY_SIZE; i ++ )
|
||||
{
|
||||
tmp += s->status_list[s->master][i];
|
||||
info->status_tokens[i] = s->status_list[s->master][i];
|
||||
@@ -7352,7 +7353,7 @@ int veejay_update_multitrack( void *ptr )
|
||||
#endif
|
||||
int *history = info->history_tokens[pm];
|
||||
|
||||
veejay_memcpy( history, info->status_tokens, sizeof(int) * STATUS_TOKENS );
|
||||
veejay_memcpy( history, info->status_tokens, sizeof(int) * VIMS_STATUS_TOKENS );
|
||||
|
||||
for( i = 0; i < s->tracks ; i ++ )
|
||||
{
|
||||
@@ -7642,6 +7643,12 @@ static void update_globalinfo(int *history, int pm, int last_pm)
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget_cache[WIDGET_GLOBALCHAINLEVEL]),after);
|
||||
}
|
||||
|
||||
if( info->status_tokens[MESSAGE_FORWARDING] != history[MESSAGE_FORWARDING])
|
||||
{
|
||||
int state = info->status_tokens[MESSAGE_FORWARDING];
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget_cache[WIDGET_MESSAGE_FORWARDING]), state);
|
||||
}
|
||||
|
||||
if( (pm == MODE_SAMPLE || pm == MODE_STREAM ) && info->status_tokens[CURRENT_ENTRY] != history[CURRENT_ENTRY] ) {
|
||||
info->uc.selected_chain_entry = info->status_tokens[CURRENT_ENTRY];
|
||||
select_chain_entry(info->uc.selected_chain_entry);
|
||||
@@ -8323,7 +8330,7 @@ void vj_gui_cb(int state, char *hostname, int port_num)
|
||||
int i;
|
||||
for( i = 0; i < 4; i ++ ) {
|
||||
int *h = info->history_tokens[i];
|
||||
veejay_memset( h, 0, sizeof(int) * STATUS_TOKENS );
|
||||
veejay_memset( h, 0, sizeof(int) * VIMS_STATUS_TOKENS );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8390,11 +8397,11 @@ void register_signals(void)
|
||||
void vj_gui_wipe(void)
|
||||
{
|
||||
int i;
|
||||
veejay_memset( info->status_tokens, 0, sizeof(int) * STATUS_TOKENS );
|
||||
veejay_memset( info->status_tokens, 0, sizeof(int) * VIMS_STATUS_TOKENS );
|
||||
veejay_memset( info->uc.entry_tokens,0, sizeof(int) * ENTRY_LAST);
|
||||
for( i = 0 ; i < 4; i ++ )
|
||||
{
|
||||
veejay_memset(info->history_tokens[i],0, sizeof(int) * (STATUS_TOKENS+1));
|
||||
veejay_memset(info->history_tokens[i],0, sizeof(int) * (VIMS_STATUS_TOKENS+1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8676,7 +8683,9 @@ void vj_gui_init(const char *glade_file,
|
||||
|
||||
veejay_msg(VEEJAY_MSG_DEBUG, "Loading glade file %s", glade_path);
|
||||
|
||||
veejay_memset( gui->status_tokens, 0, sizeof(int) * STATUS_TOKENS );
|
||||
int status_arr_size = sizeof(int) * sizeof(int) * VIMS_STATUS_TOKENS;
|
||||
|
||||
veejay_memset( gui->status_tokens, 0, status_arr_size );
|
||||
veejay_memset( gui->sample, 0, 2 );
|
||||
veejay_memset( gui->selection, 0, 3 );
|
||||
veejay_memset( &(gui->uc), 0, sizeof(veejay_user_ctrl_t));
|
||||
@@ -8685,10 +8694,11 @@ void vj_gui_init(const char *glade_file,
|
||||
gui->prev_mode = -1;
|
||||
veejay_memset( &(gui->el), 0, sizeof(veejay_el_t));
|
||||
|
||||
for( i = 0 ; i < 4; i ++ )
|
||||
for( i = 0 ; i < HISTORY_PLAYMODES; i ++ )
|
||||
{
|
||||
gui->history_tokens[i] = (int*) vj_calloc(sizeof(int) * (STATUS_TOKENS+1));
|
||||
gui->history_tokens[i] = (int*) vj_calloc(sizeof(int) * status_arr_size);
|
||||
}
|
||||
|
||||
for( i = 0; i < NUM_HINTS ; i ++ ) {
|
||||
gui->uc.reload_hint_checksums[i] = -1;
|
||||
}
|
||||
@@ -9058,9 +9068,9 @@ int vj_gui_reconnect(char *hostname,char *group_name, int port_num)
|
||||
{
|
||||
int k = 0;
|
||||
for( k = 0; k < 4; k ++ )
|
||||
veejay_memset( info->history_tokens[k] , 0, (sizeof(int) * STATUS_TOKENS) );
|
||||
veejay_memset( info->history_tokens[k] , 0, (sizeof(int) * STATUS_ARRAY_SIZE) );
|
||||
|
||||
veejay_memset( info->status_tokens, 0, sizeof(int) * STATUS_TOKENS );
|
||||
veejay_memset( info->status_tokens, 0, sizeof(int) * STATUS_ARRAY_SIZE );
|
||||
|
||||
if(!hostname && !group_name )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user