+
+ return p_block;
+}
+
+
+/*****************************************************************************
+ * Port_finder: compare ports with the regexp entered
+ *****************************************************************************/
+static void Port_finder( demux_t *p_demux )
+{
+
+ demux_sys_t *p_sys = p_demux->p_sys;
+ char *psz_expr = p_sys->psz_ports;
+ char *token = NULL;
+ char *state = NULL;
+ char *psz_uri = NULL;
+ const char **pp_jack_port_output = NULL;
+ int i_out_ports = 0;
+ int i_total_out_ports =0;
+ p_sys->pp_jack_port_table = NULL;
+
+ /* parse the ports part of the MRL */
+ for( token = strtok_r( psz_expr, ",", &state ); token;
+ token = strtok_r( NULL, ",", &state ) )
+ {
+ psz_uri = decode_URI_duplicate( token );
+ /* get the ports which match the regexp */
+ pp_jack_port_output = jack_get_ports( p_sys->p_jack_client,
+ psz_uri, NULL, JackPortIsOutput );
+ if( pp_jack_port_output == NULL )
+ {
+ msg_Err( p_demux, "port(s) asked not found:%s", psz_uri );
+ free( pp_jack_port_output );
+ }
+ else
+ {
+ while( pp_jack_port_output && pp_jack_port_output[i_out_ports] )
+ {
+ i_out_ports++;
+ }
+ /* alloc an array to store all the matched ports */
+ p_sys->pp_jack_port_table = realloc( p_sys->pp_jack_port_table,
+ (i_out_ports * sizeof( char * ) + i_total_out_ports * sizeof( char * ) ) );