X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fjack.c;h=c68e63241c89855a2b83c9e8b2467d349b070036;hb=43a23ea6bd5d8a4e2e0f2d728093d73a6cf5383e;hp=6b4c48994b0a13c56ce7913517d7e7494a91d5df;hpb=78d87996ccb92d1dc91c9987685f976ed3be08a6;p=vlc diff --git a/modules/access/jack.c b/modules/access/jack.c index 6b4c48994b..c68e63241c 100644 --- a/modules/access/jack.c +++ b/modules/access/jack.c @@ -1,7 +1,7 @@ /***************************************************************************** * jack.c: JACK audio input module ***************************************************************************** - * Copyright (C) 2007-2008 the VideoLAN team + * Copyright (C) 2007-2008 VLC authors and VideoLAN * Copyright (C) 2007 Société des arts technologiques * Copyright (C) 2007 Savoir-faire Linux * @@ -9,19 +9,19 @@ * Julien Plissonneau Duquene <... at savoirfairelinux.com> * Pierre-Luc Beaudoin * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /** @@ -41,14 +41,12 @@ #include #include #include -#include #include #include #include #include -#include #include #include @@ -58,10 +56,6 @@ static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); -#define CACHING_TEXT N_("Caching value in ms") -#define CACHING_LONGTEXT N_( \ - "Make VLC buffer audio data captured from jack for the specified " \ - "length in milliseconds." ) #define PACE_TEXT N_( "Pace" ) #define PACE_LONGTEXT N_( \ "Read the audio stream at VLC pace rather than Jack pace." ) @@ -76,12 +70,10 @@ vlc_module_begin () set_category( CAT_INPUT ) set_subcategory( SUBCAT_INPUT_ACCESS ) - add_integer( "jack-input-caching", DEFAULT_PTS_DELAY / 1000, NULL, - CACHING_TEXT, CACHING_LONGTEXT, true ) - add_bool( "jack-input-use-vlc-pace", false, NULL, + add_bool( "jack-input-use-vlc-pace", false, PACE_TEXT, PACE_LONGTEXT, true ) - add_bool( "jack-input-auto-connect", false, NULL, - AUTO_CONNECT_TEXT, AUTO_CONNECT_LONGTEXT, true ) + add_bool( "jack-input-auto-connect", false, + AUTO_CONNECT_TEXT, AUTO_CONNECT_LONGTEXT, false ) add_shortcut( "jack" ) set_callbacks( Open, Close ) @@ -148,8 +140,6 @@ static int Open( vlc_object_t *p_this ) Parse( p_demux ); /* Create var */ - var_Create( p_demux, "jack-input-caching", - VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_demux, "jack-input-use-vlc-pace", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_demux, "jack-input-auto-connect", @@ -159,7 +149,7 @@ static int Open( vlc_object_t *p_this ) /* define name and connect to jack server */ char p_vlc_client_name[32]; sprintf( p_vlc_client_name, "vlc-input-%d", getpid() ); - p_sys->p_jack_client = jack_client_new( p_vlc_client_name ); + p_sys->p_jack_client = jack_client_open( p_vlc_client_name, JackNullOption, NULL ); if( p_sys->p_jack_client == NULL ) { msg_Err( p_demux, "failed to connect to JACK server" ); @@ -366,8 +356,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 = INT64_C(1000) * var_InheritInteger( p_demux, "live-caching" ); return VLC_SUCCESS; case DEMUX_GET_TIME: @@ -444,7 +433,7 @@ int Process( jack_nframes_t i_frames, void *p_arg ) } } - return 1; + return 0; } @@ -462,6 +451,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; } @@ -472,7 +463,7 @@ static block_t *GrabJack( demux_t *p_demux ) } else { - p_block = block_New( p_demux, i_read ); + p_block = block_Alloc( i_read ); } if( !p_block ) { @@ -539,7 +530,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=" ) ) )