]> git.sesse.net Git - mlt/commitdiff
Use JACK to lookup default ports.
authorDan Dennedy <dan@dennedy.org>
Sat, 6 Aug 2011 17:34:37 +0000 (10:34 -0700)
committerDan Dennedy <dan@dennedy.org>
Sat, 6 Aug 2011 17:34:37 +0000 (10:34 -0700)
src/modules/jackrack/consumer_jack.c

index 06efb3759cc70b9712b7f1266ad46bb6ff2a436d..b47a99560854fe869b8e815358cce2b6399f4534 100644 (file)
@@ -248,6 +248,7 @@ static void initialise_jack_ports( consumer_jack self )
        int i;
        char mlt_name[20], con_name[30];
        mlt_properties properties = MLT_CONSUMER_PROPERTIES( &self->parent );
+       const char **ports = NULL;
 
        // Propogate these for the Jack processing callback
        int channels = mlt_properties_get_int( properties, "channels" );
@@ -276,11 +277,19 @@ static void initialise_jack_ports( consumer_jack self )
                if ( mlt_properties_get( properties, con_name ) )
                        snprintf( con_name, sizeof( con_name ), "%s", mlt_properties_get( properties, con_name ) );
                else
-                       snprintf( con_name, sizeof( con_name ), "system:playback_%d", i + 1);
-
+               {
+                       if ( !ports )
+                               ports = jack_get_ports( self->jack, NULL, NULL, JackPortIsPhysical | JackPortIsInput );
+                       if ( ports )
+                               strcpy( con_name, ports[i] );
+                       else
+                               snprintf( con_name, sizeof( con_name ), "system:playback_%d", i + 1);
+               }
                mlt_log_verbose( NULL, "JACK connect %s to %s\n", mlt_name, con_name );
                jack_connect( self->jack, mlt_name, con_name );
        }
+       if ( ports )
+               jack_free( ports );
 }
 
 static int consumer_play_audio( consumer_jack self, mlt_frame frame, int init_audio, int *duration )