X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fjack.c;h=b7fb6d62440639d5905bd13fed8719c3c2ea4b02;hb=1d543482fe7bd816c58e4808e334461c1d3be6b8;hp=d5df31df15f63c174ed69412dfc20ac14daa4b66;hpb=ceb891be9cba5fe02dd564e643ca39e6cd9df876;p=vlc diff --git a/modules/access/jack.c b/modules/access/jack.c index d5df31df15..b7fb6d6244 100644 --- a/modules/access/jack.c +++ b/modules/access/jack.c @@ -1,7 +1,7 @@ /***************************************************************************** * jack.c: JACK audio input module ***************************************************************************** - * Copyright (C) 2007 the VideoLAN team + * Copyright (C) 2007-2008 the VideoLAN team * Copyright (C) 2007 Société des arts technologiques * Copyright (C) 2007 Savoir-faire Linux * @@ -41,15 +41,12 @@ #include #include #include -#include -#include #include #include #include #include -#include #include #include @@ -70,23 +67,23 @@ static void Close( vlc_object_t * ); #define AUTO_CONNECT_LONGTEXT N_( \ "Automatically connect VLC input ports to available output ports." ) -vlc_module_begin(); - set_description( N_("JACK audio input") ); - set_capability( "access_demux", 0 ); - set_shortname( N_( "JACK Input" ) ); - set_category( CAT_INPUT ); - set_subcategory( SUBCAT_INPUT_ACCESS ); +vlc_module_begin () + set_description( N_("JACK audio input") ) + set_capability( "access_demux", 0 ) + set_shortname( N_( "JACK Input" ) ) + set_category( CAT_INPUT ) + set_subcategory( SUBCAT_INPUT_ACCESS ) add_integer( "jack-input-caching", DEFAULT_PTS_DELAY / 1000, NULL, - CACHING_TEXT, CACHING_LONGTEXT, true ); + CACHING_TEXT, CACHING_LONGTEXT, true ) add_bool( "jack-input-use-vlc-pace", false, NULL, - PACE_TEXT, PACE_LONGTEXT, true ); + PACE_TEXT, PACE_LONGTEXT, true ) add_bool( "jack-input-auto-connect", false, NULL, - AUTO_CONNECT_TEXT, AUTO_CONNECT_LONGTEXT, true ); + AUTO_CONNECT_TEXT, AUTO_CONNECT_LONGTEXT, true ) - add_shortcut( "jack" ); - set_callbacks( Open, Close ); -vlc_module_end(); + add_shortcut( "jack" ) + set_callbacks( Open, Close ) +vlc_module_end () /***************************************************************************** * Local prototypes @@ -142,9 +139,8 @@ static int Open( vlc_object_t *p_this ) /* Allocate structure */ p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); - if( p_sys == NULL ) + if( !p_sys ) return VLC_ENOMEM; - memset( p_sys, 0, sizeof( demux_sys_t ) ); /* Parse MRL */ Parse( p_demux ); @@ -170,7 +166,7 @@ static int Open( vlc_object_t *p_this ) } /* find some specifics ports if user entered a regexp */ - if( p_sys->psz_ports) + if( p_sys->psz_ports ) { Port_finder( p_demux ); if( p_sys->i_channels == 0 ) @@ -306,7 +302,7 @@ static int Open( vlc_object_t *p_this ) p_sys->jack_sample_size = sizeof( jack_default_audio_sample_t ); /* Define output format */ - es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'f','l','3','2' ) ); + es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_FL32 ); fmt.audio.i_channels = p_sys->i_channels; fmt.audio.i_rate = p_sys->jack_sample_rate; fmt.audio.i_bitspersample = p_sys->jack_sample_size * 8; @@ -368,8 +364,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) case DEMUX_GET_PTS_DELAY: pi64 = ( int64_t* )va_arg( args, int64_t * ); - *pi64 = ( int64_t )var_GetInteger( p_demux, "jack-input-caching" ) - * 1000; + *pi64 = var_GetInteger( p_demux, "jack-input-caching" ) * 1000; return VLC_SUCCESS; case DEMUX_GET_TIME: @@ -446,7 +441,7 @@ int Process( jack_nframes_t i_frames, void *p_arg ) } } - return 1; + return 0; } @@ -464,6 +459,8 @@ static block_t *GrabJack( demux_t *p_demux ) if( i_read < 100 ) /* avoid small read */ { /* vlc has too much free time on its hands? */ +#undef msleep +#warning Hmm.... looks wrong msleep(1000); return NULL; } @@ -541,7 +538,7 @@ static void Port_finder( demux_t *p_demux ) 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, + p_sys->pp_jack_port_table = xrealloc( p_sys->pp_jack_port_table, (i_out_ports * sizeof( char * ) + i_total_out_ports * sizeof( char * ) ) ); for(int i=0; ip_sys; - char *psz_dup = strdup( p_demux->psz_path ); + char *psz_dup = strdup( p_demux->psz_location ); char *psz_parser = psz_dup; if( !strncmp( psz_parser, "channels=", strlen( "channels=" ) ) )