Skip to content

Commit

Permalink
basics for a hypothetical PortRename callback
Browse files Browse the repository at this point in the history
This cannot be implemented at present because jack_port_set_name() does not take
a jack_client_t* as an argument, and thus no msg can be sent to the server
regarding the name change. Jack2 accomplishes this by walking its static array
of clients to find one that is in use and sends the msg using that one. This
is not possible in Jack1 because we do not use static arrays of clients (or
ports).
  • Loading branch information
pauldavisthefirst committed Oct 12, 2013
1 parent 16193a3 commit 94c819a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion include/internal.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ typedef enum {
ClientUnregistered, ClientUnregistered,
SaveSession, SaveSession,
LatencyCallback, LatencyCallback,
PropertyChange PropertyChange,
PortRename
} JackEventType; } JackEventType;


const char* jack_event_type_name (JackEventType); const char* jack_event_type_name (JackEventType);
Expand All @@ -244,6 +245,7 @@ typedef struct {
uint32_t key_size; /* key data will follow the event structure */ uint32_t key_size; /* key data will follow the event structure */
} y; } y;
union { union {
char other_name[JACK_PORT_NAME_SIZE];
jack_property_change_t property_change; jack_property_change_t property_change;
} z; } z;
} POST_PACKED_STRUCTURE jack_event_t; } POST_PACKED_STRUCTURE jack_event_t;
Expand Down Expand Up @@ -309,6 +311,7 @@ typedef volatile struct {
volatile uint8_t session_cbset; volatile uint8_t session_cbset;
volatile uint8_t latency_cbset; volatile uint8_t latency_cbset;
volatile uint8_t property_cbset; volatile uint8_t property_cbset;
volatile uint8_t port_rename_cbset;


} POST_PACKED_STRUCTURE jack_client_control_t; } POST_PACKED_STRUCTURE jack_client_control_t;


Expand Down
4 changes: 4 additions & 0 deletions libjack/client.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1853,6 +1853,10 @@ jack_client_process_events (jack_client_t* client)
if (key) { if (key) {
free (key); free (key);
} }
case PortRename:
if (control->port_rename_cbset) {
client->port_rename_cb (event.y.other_id, event.x.name, event.z.other_name, client->port_rename_cb_arg);
}
break; break;
} }


Expand Down
2 changes: 2 additions & 0 deletions libjack/local.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ struct _jack_client {
void *latency_cb_arg; void *latency_cb_arg;
JackPropertyChangeCallback property_cb; JackPropertyChangeCallback property_cb;
void *property_cb_arg; void *property_cb_arg;
JackPortRenameCallback port_rename_cb;
void *port_rename_cb_arg;


/* external clients: set by libjack /* external clients: set by libjack
* internal clients: set by engine */ * internal clients: set by engine */
Expand Down
2 changes: 1 addition & 1 deletion libjack/port.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ jack_port_set_name (jack_port_t *port, const char *new_name)
len = sizeof (port->shared->name) - len = sizeof (port->shared->name) -
((int) (colon - port->shared->name)) - 2; ((int) (colon - port->shared->name)) - 2;
snprintf (colon+1, len, "%s", new_name); snprintf (colon+1, len, "%s", new_name);
return 0; return 0;
} }


Expand Down

0 comments on commit 94c819a

Please sign in to comment.