1 /*****************************************************************************
2 * rc.c : remote control stdin/stdout plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
5 * $Id: rc.c,v 1.31 2003/05/04 22:42:15 gbazin Exp $
7 * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
30 #include <errno.h> /* ENOMEM */
44 #ifdef HAVE_SYS_TIME_H
45 # include <sys/time.h>
47 #include <sys/types.h>
51 #define MAX_LINE_LENGTH 256
53 /*****************************************************************************
55 *****************************************************************************/
56 static int Activate ( vlc_object_t * );
57 static void Run ( intf_thread_t *p_intf );
59 static int Input ( vlc_object_t *, char const *,
60 vlc_value_t, vlc_value_t, void * );
61 static int Playlist ( vlc_object_t *, char const *,
62 vlc_value_t, vlc_value_t, void * );
63 static int Quit ( vlc_object_t *, char const *,
64 vlc_value_t, vlc_value_t, void * );
65 static int Intf ( vlc_object_t *, char const *,
66 vlc_value_t, vlc_value_t, void * );
67 static int Volume ( vlc_object_t *, char const *,
68 vlc_value_t, vlc_value_t, void * );
69 static int VolumeMove ( vlc_object_t *, char const *,
70 vlc_value_t, vlc_value_t, void * );
71 static int AudioConfig ( vlc_object_t *, char const *,
72 vlc_value_t, vlc_value_t, void * );
74 /*****************************************************************************
76 *****************************************************************************/
77 #define POS_TEXT N_("show stream position")
78 #define POS_LONGTEXT N_("Show the current position in seconds within the stream from time to time.")
80 #define TTY_TEXT N_("fake TTY")
81 #define TTY_LONGTEXT N_("Force the rc plugin to use stdin as if it was a TTY.")
84 add_category_hint( N_("Remote control"), NULL, VLC_TRUE );
85 add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
87 add_bool( "fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, VLC_TRUE );
89 set_description( _("remote control interface") );
90 set_capability( "interface", 20 );
91 set_callbacks( Activate, NULL );
94 /*****************************************************************************
95 * Activate: initialize and create stuff
96 *****************************************************************************/
97 static int Activate( vlc_object_t *p_this )
99 intf_thread_t *p_intf = (intf_thread_t*)p_this;
101 #if defined(HAVE_ISATTY) && !defined(WIN32)
102 /* Check that stdin is a TTY */
103 if( !config_GetInt( p_intf, "fake-tty" ) && !isatty( 0 ) )
105 msg_Warn( p_intf, "fd 0 is not a TTY" );
110 /* Non-buffered stdout */
111 setvbuf( stdout, (char *)NULL, _IOLBF, 0 );
113 p_intf->pf_run = Run;
117 printf( "remote control interface initialized, `h' for help\n" );
121 /*****************************************************************************
123 *****************************************************************************
124 * This part of the interface is in a separate thread so that we can call
125 * exec() from within it without annoying the rest of the program.
126 *****************************************************************************/
127 static void Run( intf_thread_t *p_intf )
129 input_thread_t * p_input;
130 playlist_t * p_playlist;
132 char p_buffer[ MAX_LINE_LENGTH + 1 ];
133 vlc_bool_t b_showpos = config_GetInt( p_intf, "rc-show-pos" );
134 input_info_category_t * p_category;
135 input_info_t * p_info;
141 double f_ratio = 1.0;
145 INPUT_RECORD input_record;
152 /* Register commands that will be cleaned up upon object destruction */
153 var_Create( p_intf, "quit", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
154 var_AddCallback( p_intf, "quit", Quit, NULL );
155 var_Create( p_intf, "intf", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
156 var_AddCallback( p_intf, "intf", Intf, NULL );
158 var_Create( p_intf, "add", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
159 var_AddCallback( p_intf, "add", Playlist, NULL );
160 var_Create( p_intf, "playlist", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
161 var_AddCallback( p_intf, "playlist", Playlist, NULL );
162 var_Create( p_intf, "play", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
163 var_AddCallback( p_intf, "play", Playlist, NULL );
164 var_Create( p_intf, "stop", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
165 var_AddCallback( p_intf, "stop", Playlist, NULL );
166 var_Create( p_intf, "prev", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
167 var_AddCallback( p_intf, "prev", Playlist, NULL );
168 var_Create( p_intf, "next", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
169 var_AddCallback( p_intf, "next", Playlist, NULL );
171 var_Create( p_intf, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
172 var_AddCallback( p_intf, "pause", Input, NULL );
173 var_Create( p_intf, "seek", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
174 var_AddCallback( p_intf, "seek", Input, NULL );
175 var_Create( p_intf, "title", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
176 var_AddCallback( p_intf, "title", Input, NULL );
177 var_Create( p_intf, "title_n", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
178 var_AddCallback( p_intf, "title_n", Input, NULL );
179 var_Create( p_intf, "title_p", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
180 var_AddCallback( p_intf, "title_p", Input, NULL );
181 var_Create( p_intf, "chapter", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
182 var_AddCallback( p_intf, "chapter", Input, NULL );
183 var_Create( p_intf, "chapter_n", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
184 var_AddCallback( p_intf, "chapter_n", Input, NULL );
185 var_Create( p_intf, "chapter_p", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
186 var_AddCallback( p_intf, "chapter_p", Input, NULL );
188 var_Create( p_intf, "volume", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
189 var_AddCallback( p_intf, "volume", Volume, NULL );
190 var_Create( p_intf, "volup", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
191 var_AddCallback( p_intf, "volup", VolumeMove, NULL );
192 var_Create( p_intf, "voldown", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
193 var_AddCallback( p_intf, "voldown", VolumeMove, NULL );
194 var_Create( p_intf, "adev", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
195 var_AddCallback( p_intf, "adev", AudioConfig, NULL );
196 var_Create( p_intf, "achan", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
197 var_AddCallback( p_intf, "achan", AudioConfig, NULL );
200 /* Get the file descriptor of the console input */
201 hConsoleIn = GetStdHandle(STD_INPUT_HANDLE);
202 if( hConsoleIn == INVALID_HANDLE_VALUE )
204 msg_Err( p_intf, "Couldn't open STD_INPUT_HANDLE" );
205 p_intf->b_die = VLC_TRUE;
209 while( !p_intf->b_die )
211 vlc_bool_t b_complete = VLC_FALSE;
219 tv.tv_usec = (long)INTF_IDLE_SLEEP;
221 FD_SET( STDIN_FILENO, &fds );
223 i_dummy = select( STDIN_FILENO + 1, &fds, NULL, NULL, &tv );
225 /* On Win32, select() only works on socket descriptors */
226 i_dummy = ( WaitForSingleObject( hConsoleIn, INTF_IDLE_SLEEP/1000 )
233 while( !p_intf->b_die
234 && i_size < MAX_LINE_LENGTH
236 && read( STDIN_FILENO, p_buffer + i_size, 1 ) > 0
238 && ReadConsoleInput( hConsoleIn, &input_record, 1,
244 if( input_record.EventType != KEY_EVENT ||
245 !input_record.Event.KeyEvent.bKeyDown )
247 /* nothing interesting */
252 input_record.Event.KeyEvent.uChar.AsciiChar;
254 /* Echo out the command */
255 putc( p_buffer[ i_size ], stdout );
257 /* Handle special keys */
258 if( p_buffer[ i_size ] == '\r' || p_buffer[ i_size ] == '\n' )
260 putc( '\n', stdout );
263 switch( p_buffer[ i_size ] )
270 putc( '\b', stdout );
281 if( p_buffer[ i_size ] == '\r' || p_buffer[ i_size ] == '\n' )
290 if( i_size == MAX_LINE_LENGTH
291 || p_buffer[ i_size ] == '\r'
292 || p_buffer[ i_size ] == '\n' )
294 p_buffer[ i_size ] = 0;
295 b_complete = VLC_TRUE;
299 /* Manage the input part */
300 if( p_input == NULL )
304 p_input = vlc_object_find( p_playlist, VLC_OBJECT_INPUT,
309 p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
313 p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
318 else if( p_input->b_dead )
320 vlc_object_release( p_input );
324 if( p_input && b_showpos )
327 vlc_mutex_lock( &p_input->stream.stream_lock );
328 if( !p_input->b_die && p_input->stream.i_mux_rate )
330 #define A p_input->stream.p_selected_area
331 f_ratio = 1.0 / ( 50 * p_input->stream.i_mux_rate );
332 i_newpos = A->i_tell * f_ratio;
334 if( i_oldpos != i_newpos )
337 printf( "pos: %li s / %li s\n", (long int)i_newpos,
338 (long int)(f_ratio * A->i_size) );
342 vlc_mutex_unlock( &p_input->stream.stream_lock );
345 /* Is there something to do? */
348 char *psz_cmd, *psz_arg;
350 /* Skip heading spaces */
352 while( *psz_cmd == ' ' )
357 /* Split psz_cmd at the first space and make sure that
358 * psz_arg is valid */
359 psz_arg = strchr( psz_cmd, ' ' );
363 while( *psz_arg == ' ' )
373 /* If the user typed a registered local command, try it */
374 if( var_Type( p_intf, psz_cmd ) & VLC_VAR_ISCOMMAND )
379 val.psz_string = psz_arg;
380 i_ret = var_Set( p_intf, psz_cmd, val );
381 printf( "%s: returned %i (%s)\n",
382 psz_cmd, i_ret, vlc_error( i_ret ) );
384 /* Or maybe it's a global command */
385 else if( var_Type( p_intf->p_libvlc, psz_cmd ) & VLC_VAR_ISCOMMAND )
390 val.psz_string = psz_arg;
391 /* FIXME: it's a global command, but we should pass the
392 * local object as an argument, not p_intf->p_libvlc. */
393 i_ret = var_Set( p_intf->p_libvlc, psz_cmd, val );
394 printf( "%s: returned %i (%s)\n",
395 psz_cmd, i_ret, vlc_error( i_ret ) );
397 else if( !strcmp( psz_cmd, "info" ) )
401 vlc_mutex_lock( &p_input->stream.stream_lock );
402 p_category = p_input->stream.p_info;
405 printf( "+----[ %s ]\n", p_category->psz_name );
407 p_info = p_category->p_info;
410 printf( "| %s: %s\n", p_info->psz_name,
412 p_info = p_info->p_next;
414 p_category = p_category->p_next;
417 printf( "+----[ end of stream info ]\n" );
418 vlc_mutex_unlock( &p_input->stream.stream_lock );
422 printf( "no input\n" );
425 else switch( psz_cmd[0] )
431 vout_thread_t *p_vout;
432 p_vout = vlc_object_find( p_input,
433 VLC_OBJECT_VOUT, FIND_CHILD );
437 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
438 vlc_object_release( p_vout );
451 printf("+----[ remote control commands ]\n");
453 printf("| add XYZ . . . . . . . . . . add XYZ to playlist\n");
454 printf("| playlist . . . show items currently in playlist\n");
455 printf("| play . . . . . . . . . . . . . . . . play stream\n");
456 printf("| stop . . . . . . . . . . . . . . . . stop stream\n");
457 printf("| next . . . . . . . . . . . . next playlist item\n");
458 printf("| prev . . . . . . . . . . previous playlist item\n");
459 printf("| title [X] . . . . set/get title in current item\n");
460 printf("| title_n . . . . . . next title in current item\n");
461 printf("| title_p . . . . previous title in current item\n");
462 printf("| chapter [X] . . set/get chapter in current item\n");
463 printf("| chapter_n . . . . next chapter in current item\n");
464 printf("| chapter_p . . previous chapter in current item\n");
466 printf("| seek X . seek in seconds, for instance `seek 12'\n");
467 printf("| pause . . . . . . . . . . . . . . toggle pause\n");
468 printf("| f . . . . . . . . . . . . . . toggle fullscreen\n");
469 printf("| info . . . information about the current stream\n");
471 printf("| volume [X] . . . . . . . . set/get audio volume\n");
472 printf("| volup [X] . . . . . raise audio volume X steps\n");
473 printf("| voldown [X] . . . . lower audio volume X steps\n");
474 printf("| adev [X] . . . . . . . . . set/get audio device\n");
475 printf("| achan [X]. . . . . . . . set/get audio channels\n");
477 printf("| help . . . . . . . . . . . . . this help message\n");
478 printf("| quit . . . . . . . . . . . . . . . . . quit vlc\n");
480 printf("+----[ end of help ]\n");
483 /* Ignore empty lines */
486 printf( "unknown command `%s', type `help' for help\n", psz_cmd );
494 vlc_object_release( p_input );
500 vlc_object_release( p_playlist );
505 static int Input( vlc_object_t *p_this, char const *psz_cmd,
506 vlc_value_t oldval, vlc_value_t newval, void *p_data )
508 input_thread_t * p_input;
510 p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
517 /* Parse commands that only require an input */
518 if( !strcmp( psz_cmd, "pause" ) )
520 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
521 vlc_object_release( p_input );
524 else if( !strcmp( psz_cmd, "seek" ) )
526 input_Seek( p_input, atoi( newval.psz_string ),
527 INPUT_SEEK_SECONDS | INPUT_SEEK_SET );
529 else if( !strcmp( psz_cmd, "chapter" ) ||
530 !strcmp( psz_cmd, "chapter_n" ) ||
531 !strcmp( psz_cmd, "chapter_p" ) )
533 unsigned int i_chapter = 0;
535 if( !strcmp( psz_cmd, "chapter" ) )
537 if ( *newval.psz_string )
540 i_chapter = atoi( newval.psz_string );
545 vlc_mutex_lock( &p_input->stream.stream_lock );
546 printf( "Currently playing chapter %d/%d\n",
547 p_input->stream.p_selected_area->i_part,
548 p_input->stream.p_selected_area->i_part_nb - 1 );
549 vlc_mutex_unlock( &p_input->stream.stream_lock );
551 vlc_object_release( p_input );
555 else if( !strcmp( psz_cmd, "chapter_n" ) )
557 vlc_mutex_lock( &p_input->stream.stream_lock );
558 i_chapter = p_input->stream.p_selected_area->i_part + 1;
559 vlc_mutex_unlock( &p_input->stream.stream_lock );
561 else if( !strcmp( psz_cmd, "chapter_p" ) )
563 vlc_mutex_lock( &p_input->stream.stream_lock );
564 i_chapter = p_input->stream.p_selected_area->i_part - 1;
565 vlc_mutex_unlock( &p_input->stream.stream_lock );
568 vlc_mutex_lock( &p_input->stream.stream_lock );
569 if( ( i_chapter > 0 ) && ( i_chapter <
570 p_input->stream.p_selected_area->i_part_nb ) )
572 input_area_t *p_area = p_input->stream.p_selected_area;
573 p_input->stream.p_selected_area->i_part = i_chapter;
574 vlc_mutex_unlock( &p_input->stream.stream_lock );
575 input_ChangeArea( p_input, p_area );
576 input_SetStatus( p_input, INPUT_STATUS_PLAY );
577 vlc_mutex_lock( &p_input->stream.stream_lock );
579 vlc_mutex_unlock( &p_input->stream.stream_lock );
581 vlc_object_release( p_input );
584 else if( !strcmp( psz_cmd, "title" ) ||
585 !strcmp( psz_cmd, "title_n" ) ||
586 !strcmp( psz_cmd, "title_p" ) )
588 unsigned int i_title = 0;
590 if( !strcmp( psz_cmd, "title" ) )
592 if ( *newval.psz_string )
595 i_title = atoi( newval.psz_string );
600 vlc_mutex_lock( &p_input->stream.stream_lock );
601 printf( "Currently playing title %d/%d\n",
602 p_input->stream.p_selected_area->i_id,
603 p_input->stream.i_area_nb - 1 );
604 vlc_mutex_unlock( &p_input->stream.stream_lock );
606 vlc_object_release( p_input );
610 else if( !strcmp( psz_cmd, "title_n" ) )
612 vlc_mutex_lock( &p_input->stream.stream_lock );
613 i_title = p_input->stream.p_selected_area->i_id + 1;
614 vlc_mutex_unlock( &p_input->stream.stream_lock );
616 else if( !strcmp( psz_cmd, "title_p" ) )
618 vlc_mutex_lock( &p_input->stream.stream_lock );
619 i_title = p_input->stream.p_selected_area->i_id - 1;
620 vlc_mutex_unlock( &p_input->stream.stream_lock );
623 vlc_mutex_lock( &p_input->stream.stream_lock );
624 if( ( i_title > 0 ) && ( i_title < p_input->stream.i_area_nb ) )
626 input_area_t *p_area = p_input->stream.pp_areas[i_title];
627 vlc_mutex_unlock( &p_input->stream.stream_lock );
628 input_ChangeArea( p_input, p_area );
629 input_SetStatus( p_input, INPUT_STATUS_PLAY );
630 vlc_mutex_lock( &p_input->stream.stream_lock );
632 vlc_mutex_unlock( &p_input->stream.stream_lock );
634 vlc_object_release( p_input );
642 static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
643 vlc_value_t oldval, vlc_value_t newval, void *p_data )
645 playlist_t * p_playlist;
647 p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
654 /* Parse commands that require a playlist */
655 if( !strcmp( psz_cmd, "prev" ) )
657 playlist_Prev( p_playlist );
659 else if( !strcmp( psz_cmd, "next" ) )
661 playlist_Next( p_playlist );
663 else if( !strcmp( psz_cmd, "play" ) )
665 playlist_Play( p_playlist );
667 else if( !strcmp( psz_cmd, "stop" ) )
669 playlist_Stop( p_playlist );
671 else if( !strcmp( psz_cmd, "add" ) )
673 printf( "trying to add %s to playlist\n", newval.psz_string );
674 playlist_Add( p_playlist, newval.psz_string,
675 PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
677 else if( !strcmp( psz_cmd, "playlist" ) )
680 for ( i = 0; i < p_playlist->i_size; i++ )
682 printf( "|%s%s %s|\n", i == p_playlist->i_index?"*":" ",
683 p_playlist->pp_items[i]->psz_name,
684 p_playlist->pp_items[i]->psz_uri );
688 printf( "| no entries\n" );
696 printf( "unknown command!\n" );
699 vlc_object_release( p_playlist );
703 static int Quit( vlc_object_t *p_this, char const *psz_cmd,
704 vlc_value_t oldval, vlc_value_t newval, void *p_data )
706 p_this->p_vlc->b_die = VLC_TRUE;
710 static int Intf( vlc_object_t *p_this, char const *psz_cmd,
711 vlc_value_t oldval, vlc_value_t newval, void *p_data )
713 intf_thread_t *p_newintf;
715 p_newintf = intf_Create( p_this->p_vlc, newval.psz_string );
719 p_newintf->b_block = VLC_FALSE;
720 if( intf_RunThread( p_newintf ) )
722 vlc_object_detach( p_newintf );
723 intf_Destroy( p_newintf );
730 static int Volume( vlc_object_t *p_this, char const *psz_cmd,
731 vlc_value_t oldval, vlc_value_t newval, void *p_data )
735 if ( *newval.psz_string )
738 audio_volume_t i_volume = atoi( newval.psz_string );
739 if ( i_volume > AOUT_VOLUME_MAX )
741 printf( "Volume must be in the range %d-%d\n", AOUT_VOLUME_MIN,
743 i_error = VLC_EBADVAR;
745 else i_error = aout_VolumeSet( p_this, i_volume );
750 audio_volume_t i_volume;
751 if ( aout_VolumeGet( p_this, &i_volume ) < 0 )
753 i_error = VLC_EGENERIC;
757 printf( "Volume is %d\n", i_volume );
758 i_error = VLC_SUCCESS;
765 static int VolumeMove( vlc_object_t *p_this, char const *psz_cmd,
766 vlc_value_t oldval, vlc_value_t newval, void *p_data )
768 audio_volume_t i_volume;
769 int i_nb_steps = atoi(newval.psz_string);
770 int i_error = VLC_SUCCESS;
772 if ( i_nb_steps <= 0 || i_nb_steps > (AOUT_VOLUME_MAX/AOUT_VOLUME_STEP) )
777 if ( !strcmp(psz_cmd, "volup") )
779 if ( aout_VolumeUp( p_this, i_nb_steps, &i_volume ) < 0 )
780 i_error = VLC_EGENERIC;
784 if ( aout_VolumeDown( p_this, i_nb_steps, &i_volume ) < 0 )
785 i_error = VLC_EGENERIC;
788 if ( !i_error ) printf( "Volume is %d\n", i_volume );
792 static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
793 vlc_value_t oldval, vlc_value_t newval, void *p_data )
795 aout_instance_t * p_aout;
796 const char * psz_variable;
797 vlc_value_t val_name;
800 p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE );
801 if ( p_aout == NULL ) return VLC_ENOOBJ;
803 if ( !strcmp( psz_cmd, "adev" ) )
805 psz_variable = "audio-device";
809 psz_variable = "audio-channels";
812 /* Get the descriptive name of the variable */
813 var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_GETTEXT,
815 if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable);
817 if ( !*newval.psz_string )
819 /* Retrieve all registered ***. */
820 vlc_value_t val, text;
823 if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 )
825 vlc_object_release( (vlc_object_t *)p_aout );
830 if ( var_Change( (vlc_object_t *)p_aout, psz_variable,
831 VLC_VAR_GETLIST, &val, &text ) < 0 )
833 vlc_object_release( (vlc_object_t *)p_aout );
837 printf( "+----[ %s ]\n", val_name.psz_string );
838 for ( i = 0; i < val.p_list->i_count; i++ )
840 if ( i_value == val.p_list->p_values[i].i_int )
841 printf( "| %i - %s *\n", val.p_list->p_values[i].i_int,
842 text.p_list->p_values[i].psz_string );
844 printf( "| %i - %s\n", val.p_list->p_values[i].i_int,
845 text.p_list->p_values[i].psz_string );
847 var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST,
849 printf( "+----[ end of %s ]\n", val_name.psz_string );
851 if( val_name.psz_string ) free( val_name.psz_string );
852 i_error = VLC_SUCCESS;
857 val.i_int = atoi( newval.psz_string );
859 i_error = var_Set( (vlc_object_t *)p_aout, psz_variable, val );
861 vlc_object_release( (vlc_object_t *)p_aout );