1 /*****************************************************************************
2 * rc.c : remote control stdin/stdout module for vlc
3 *****************************************************************************
4 * Copyright (C) 2004 VideoLAN
7 * Author: 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>
49 #include "vlc_error.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 module to use stdin as if it was a TTY.")
84 set_description( _("Remote control interface") );
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_capability( "interface", 20 );
90 set_callbacks( Activate, NULL );
93 /*****************************************************************************
94 * Activate: initialize and create stuff
95 *****************************************************************************/
96 static int Activate( vlc_object_t *p_this )
98 intf_thread_t *p_intf = (intf_thread_t*)p_this;
100 #if defined(HAVE_ISATTY) && !defined(WIN32)
101 /* Check that stdin is a TTY */
102 if( !config_GetInt( p_intf, "fake-tty" ) && !isatty( 0 ) )
104 msg_Warn( p_intf, "fd 0 is not a TTY" );
109 /* Non-buffered stdout */
110 setvbuf( stdout, (char *)NULL, _IOLBF, 0 );
112 p_intf->pf_run = Run;
116 printf( _("Remote control interface initialized, `h' for help\n") );
120 /*****************************************************************************
122 *****************************************************************************
123 * This part of the interface is in a separate thread so that we can call
124 * exec() from within it without annoying the rest of the program.
125 *****************************************************************************/
126 static void Run( intf_thread_t *p_intf )
128 input_thread_t * p_input;
129 playlist_t * p_playlist;
131 char p_buffer[ MAX_LINE_LENGTH + 1 ];
132 vlc_bool_t b_showpos = config_GetInt( p_intf, "rc-show-pos" );
138 double f_ratio = 1.0;
142 INPUT_RECORD input_record;
149 /* Register commands that will be cleaned up upon object destruction */
150 var_Create( p_intf, "quit", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
151 var_AddCallback( p_intf, "quit", Quit, NULL );
152 var_Create( p_intf, "intf", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
153 var_AddCallback( p_intf, "intf", Intf, NULL );
155 var_Create( p_intf, "add", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
156 var_AddCallback( p_intf, "add", Playlist, NULL );
157 var_Create( p_intf, "playlist", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
158 var_AddCallback( p_intf, "playlist", Playlist, NULL );
159 var_Create( p_intf, "play", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
160 var_AddCallback( p_intf, "play", Playlist, NULL );
161 var_Create( p_intf, "stop", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
162 var_AddCallback( p_intf, "stop", Playlist, NULL );
163 var_Create( p_intf, "prev", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
164 var_AddCallback( p_intf, "prev", Playlist, NULL );
165 var_Create( p_intf, "next", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
166 var_AddCallback( p_intf, "next", Playlist, NULL );
168 var_Create( p_intf, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
169 var_AddCallback( p_intf, "pause", Input, NULL );
170 var_Create( p_intf, "seek", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
171 var_AddCallback( p_intf, "seek", Input, NULL );
172 var_Create( p_intf, "title", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
173 var_AddCallback( p_intf, "title", Input, NULL );
174 var_Create( p_intf, "title_n", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
175 var_AddCallback( p_intf, "title_n", Input, NULL );
176 var_Create( p_intf, "title_p", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
177 var_AddCallback( p_intf, "title_p", Input, NULL );
178 var_Create( p_intf, "chapter", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
179 var_AddCallback( p_intf, "chapter", Input, NULL );
180 var_Create( p_intf, "chapter_n", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
181 var_AddCallback( p_intf, "chapter_n", Input, NULL );
182 var_Create( p_intf, "chapter_p", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
183 var_AddCallback( p_intf, "chapter_p", Input, NULL );
185 var_Create( p_intf, "volume", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
186 var_AddCallback( p_intf, "volume", Volume, NULL );
187 var_Create( p_intf, "volup", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
188 var_AddCallback( p_intf, "volup", VolumeMove, NULL );
189 var_Create( p_intf, "voldown", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
190 var_AddCallback( p_intf, "voldown", VolumeMove, NULL );
191 var_Create( p_intf, "adev", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
192 var_AddCallback( p_intf, "adev", AudioConfig, NULL );
193 var_Create( p_intf, "achan", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
194 var_AddCallback( p_intf, "achan", AudioConfig, NULL );
197 /* Get the file descriptor of the console input */
198 hConsoleIn = GetStdHandle(STD_INPUT_HANDLE);
199 if( hConsoleIn == INVALID_HANDLE_VALUE )
201 msg_Err( p_intf, "Couldn't open STD_INPUT_HANDLE" );
202 p_intf->b_die = VLC_TRUE;
206 while( !p_intf->b_die )
208 vlc_bool_t b_complete = VLC_FALSE;
216 tv.tv_usec = (long)INTF_IDLE_SLEEP;
218 FD_SET( STDIN_FILENO, &fds );
220 i_dummy = select( STDIN_FILENO + 1, &fds, NULL, NULL, &tv );
222 /* On Win32, select() only works on socket descriptors */
223 i_dummy = ( WaitForSingleObject( hConsoleIn, INTF_IDLE_SLEEP/1000 )
230 while( !p_intf->b_die
231 && i_size < MAX_LINE_LENGTH
233 && read( STDIN_FILENO, p_buffer + i_size, 1 ) > 0
235 && ReadConsoleInput( hConsoleIn, &input_record, 1,
241 if( input_record.EventType != KEY_EVENT ||
242 !input_record.Event.KeyEvent.bKeyDown ||
243 input_record.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT ||
244 input_record.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL||
245 input_record.Event.KeyEvent.wVirtualKeyCode == VK_MENU ||
246 input_record.Event.KeyEvent.wVirtualKeyCode == VK_CAPITAL )
248 /* nothing interesting */
253 input_record.Event.KeyEvent.uChar.AsciiChar;
255 /* Echo out the command */
256 putc( p_buffer[ i_size ], stdout );
258 /* Handle special keys */
259 if( p_buffer[ i_size ] == '\r' || p_buffer[ i_size ] == '\n' )
261 putc( '\n', stdout );
264 switch( p_buffer[ i_size ] )
271 putc( '\b', stdout );
282 if( p_buffer[ i_size ] == '\r' || p_buffer[ i_size ] == '\n' )
291 if( i_size == MAX_LINE_LENGTH
292 || p_buffer[ i_size ] == '\r'
293 || p_buffer[ i_size ] == '\n' )
295 p_buffer[ i_size ] = 0;
296 b_complete = VLC_TRUE;
300 /* Manage the input part */
301 if( p_input == NULL )
305 p_input = vlc_object_find( p_playlist, VLC_OBJECT_INPUT,
310 p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
314 p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
319 else if( p_input->b_dead )
321 vlc_object_release( p_input );
325 if( p_input && b_showpos )
328 vlc_mutex_lock( &p_input->stream.stream_lock );
329 if( !p_input->b_die && p_input->stream.i_mux_rate )
331 #define A p_input->stream.p_selected_area
332 f_ratio = 1.0 / ( 50 * p_input->stream.i_mux_rate );
333 i_newpos = A->i_tell * f_ratio;
335 if( i_oldpos != i_newpos )
338 printf( "pos: %li s / %li s\n", (long int)i_newpos,
339 (long int)(f_ratio * A->i_size) );
343 vlc_mutex_unlock( &p_input->stream.stream_lock );
346 /* Is there something to do? */
349 char *psz_cmd, *psz_arg;
351 /* Skip heading spaces */
353 while( *psz_cmd == ' ' )
358 /* Split psz_cmd at the first space and make sure that
359 * psz_arg is valid */
360 psz_arg = strchr( psz_cmd, ' ' );
364 while( *psz_arg == ' ' )
374 /* If the user typed a registered local command, try it */
375 if( var_Type( p_intf, psz_cmd ) & VLC_VAR_ISCOMMAND )
380 val.psz_string = psz_arg;
381 i_ret = var_Set( p_intf, psz_cmd, val );
382 printf( _("%s: returned %i (%s)\n"),
383 psz_cmd, i_ret, vlc_error( i_ret ) );
385 /* Or maybe it's a global command */
386 else if( var_Type( p_intf->p_libvlc, psz_cmd ) & VLC_VAR_ISCOMMAND )
391 val.psz_string = psz_arg;
392 /* FIXME: it's a global command, but we should pass the
393 * local object as an argument, not p_intf->p_libvlc. */
394 i_ret = var_Set( p_intf->p_libvlc, psz_cmd, val );
395 printf( _("%s: returned %i (%s)\n"),
396 psz_cmd, i_ret, vlc_error( i_ret ) );
398 else if( !strcmp( psz_cmd, "info" ) )
403 vlc_mutex_lock( &p_input->p_item->lock );
404 for ( i = 0; i < p_input->p_item->i_categories; i++ )
406 info_category_t *p_category =
407 p_input->p_item->pp_categories[i];
409 printf( "+----[ %s ]\n", p_category->psz_name );
411 for ( j = 0; j < p_category->i_infos; j++ )
413 info_t *p_info = p_category->pp_infos[j];
414 printf( "| %s: %s\n", p_info->psz_name,
419 printf( _("+----[ end of stream info ]\n") );
420 vlc_mutex_unlock( &p_input->p_item->lock );
424 printf( _("no input\n") );
427 else switch( psz_cmd[0] )
433 vout_thread_t *p_vout;
434 p_vout = vlc_object_find( p_input,
435 VLC_OBJECT_VOUT, FIND_CHILD );
439 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
440 vlc_object_release( p_vout );
453 printf(_("+----[ Remote control commands ]\n"));
455 printf(_("| add XYZ . . . . . . . . . . add XYZ to playlist\n"));
456 printf(_("| playlist . . . show items currently in playlist\n"));
457 printf(_("| play . . . . . . . . . . . . . . . . play stream\n"));
458 printf(_("| stop . . . . . . . . . . . . . . . . stop stream\n"));
459 printf(_("| next . . . . . . . . . . . . next playlist item\n"));
460 printf(_("| prev . . . . . . . . . . previous playlist item\n"));
461 printf(_("| title [X] . . . . set/get title in current item\n"));
462 printf(_("| title_n . . . . . . next title in current item\n"));
463 printf(_("| title_p . . . . previous title in current item\n"));
464 printf(_("| chapter [X] . . set/get chapter in current item\n"));
465 printf(_("| chapter_n . . . . next chapter in current item\n"));
466 printf(_("| chapter_p . . previous chapter in current item\n"));
468 printf(_("| seek X . seek in seconds, for instance `seek 12'\n"));
469 printf(_("| pause . . . . . . . . . . . . . . toggle pause\n"));
470 printf(_("| f . . . . . . . . . . . . . . toggle fullscreen\n"));
471 printf(_("| info . . . information about the current stream\n"));
473 printf(_("| volume [X] . . . . . . . . set/get audio volume\n"));
474 printf(_("| volup [X] . . . . . raise audio volume X steps\n"));
475 printf(_("| voldown [X] . . . . lower audio volume X steps\n"));
476 printf(_("| adev [X] . . . . . . . . . set/get audio device\n"));
477 printf(_("| achan [X]. . . . . . . . set/get audio channels\n"));
479 printf(_("| help . . . . . . . . . . . . . this help message\n"));
480 printf(_("| quit . . . . . . . . . . . . . . . . . quit vlc\n"));
482 printf(_("+----[ end of help ]\n"));
485 /* Ignore empty lines */
488 printf( _("unknown command `%s', type `help' for help\n"), psz_cmd );
496 vlc_object_release( p_input );
502 vlc_object_release( p_playlist );
507 static int Input( vlc_object_t *p_this, char const *psz_cmd,
508 vlc_value_t oldval, vlc_value_t newval, void *p_data )
510 input_thread_t * p_input;
513 p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
520 /* Parse commands that only require an input */
521 if( !strcmp( psz_cmd, "pause" ) )
525 var_Set( p_input, "state", val );
526 vlc_object_release( p_input );
529 else if( !strcmp( psz_cmd, "seek" ) )
531 if( strlen( newval.psz_string ) > 0 &&
532 newval.psz_string[strlen( newval.psz_string ) - 1] == '%' )
534 val.f_float = (float)atoi( newval.psz_string ) / 100.0;
535 var_Set( p_input, "position", val );
539 val.i_time = ((int64_t)atoi( newval.psz_string )) * 1000000;
540 var_Set( p_input, "time", val );
542 vlc_object_release( p_input );
545 else if( !strcmp( psz_cmd, "chapter" ) ||
546 !strcmp( psz_cmd, "chapter_n" ) ||
547 !strcmp( psz_cmd, "chapter_p" ) )
549 if( !strcmp( psz_cmd, "chapter" ) )
551 if ( *newval.psz_string )
554 val.i_int = atoi( newval.psz_string );
555 var_Set( p_input, "chapter", val );
559 vlc_value_t val_list;
562 var_Get( p_input, "chapter", &val );
563 var_Change( p_input, "chapter", VLC_VAR_GETCHOICES, &val_list, NULL );
564 printf( _("Currently playing chapter %d/%d\n"), val.i_int, val_list.p_list->i_count );
565 var_Change( p_this, "chapter", VLC_VAR_FREELIST, &val_list, NULL );
568 else if( !strcmp( psz_cmd, "chapter_n" ) )
570 val.b_bool = VLC_TRUE;
571 var_Set( p_input, "next-chapter", val );
573 else if( !strcmp( psz_cmd, "chapter_p" ) )
575 val.b_bool = VLC_TRUE;
576 var_Set( p_input, "prev-chapter", val );
579 vlc_object_release( p_input );
582 else if( !strcmp( psz_cmd, "title" ) ||
583 !strcmp( psz_cmd, "title_n" ) ||
584 !strcmp( psz_cmd, "title_p" ) )
586 if( !strcmp( psz_cmd, "title" ) )
588 if ( *newval.psz_string )
591 val.i_int = atoi( newval.psz_string );
592 var_Set( p_input, "title", val );
596 vlc_value_t val_list;
599 var_Get( p_input, "title", &val );
600 var_Change( p_input, "title", VLC_VAR_GETCHOICES, &val_list, NULL );
601 printf( _("Currently playing title %d/%d\n"), val.i_int, val_list.p_list->i_count );
602 var_Change( p_this, "title", VLC_VAR_FREELIST, &val_list, NULL );
605 else if( !strcmp( psz_cmd, "title_n" ) )
607 val.b_bool = VLC_TRUE;
608 var_Set( p_input, "next-title", val );
610 else if( !strcmp( psz_cmd, "title_p" ) )
612 val.b_bool = VLC_TRUE;
613 var_Set( p_input, "prev-title", val );
616 vlc_object_release( p_input );
624 static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
625 vlc_value_t oldval, vlc_value_t newval, void *p_data )
627 playlist_t * p_playlist;
629 p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
636 /* Parse commands that require a playlist */
637 if( !strcmp( psz_cmd, "prev" ) )
639 playlist_Prev( p_playlist );
641 else if( !strcmp( psz_cmd, "next" ) )
643 playlist_Next( p_playlist );
645 else if( !strcmp( psz_cmd, "play" ) )
647 playlist_Play( p_playlist );
649 else if( !strcmp( psz_cmd, "stop" ) )
651 playlist_Stop( p_playlist );
653 else if( !strcmp( psz_cmd, "add" ) )
655 printf( _("trying to add %s to playlist\n"), newval.psz_string );
656 playlist_Add( p_playlist, newval.psz_string, newval.psz_string,
657 PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
659 else if( !strcmp( psz_cmd, "playlist" ) )
662 for ( i = 0; i < p_playlist->i_size; i++ )
664 printf( "|%s%s %s|\n", i == p_playlist->i_index?"*":" ",
665 p_playlist->pp_items[i]->input.psz_name,
666 p_playlist->pp_items[i]->input.psz_uri );
670 printf( _("| no entries\n") );
678 printf( _("unknown command!\n") );
681 vlc_object_release( p_playlist );
685 static int Quit( vlc_object_t *p_this, char const *psz_cmd,
686 vlc_value_t oldval, vlc_value_t newval, void *p_data )
688 p_this->p_vlc->b_die = VLC_TRUE;
692 static int Intf( vlc_object_t *p_this, char const *psz_cmd,
693 vlc_value_t oldval, vlc_value_t newval, void *p_data )
695 intf_thread_t *p_newintf;
697 p_newintf = intf_Create( p_this->p_vlc, newval.psz_string );
701 p_newintf->b_block = VLC_FALSE;
702 if( intf_RunThread( p_newintf ) )
704 vlc_object_detach( p_newintf );
705 intf_Destroy( p_newintf );
712 static int Volume( vlc_object_t *p_this, char const *psz_cmd,
713 vlc_value_t oldval, vlc_value_t newval, void *p_data )
717 if ( *newval.psz_string )
720 audio_volume_t i_volume = atoi( newval.psz_string );
721 if ( i_volume > AOUT_VOLUME_MAX )
723 printf( _("Volume must be in the range %d-%d\n"), AOUT_VOLUME_MIN,
725 i_error = VLC_EBADVAR;
727 else i_error = aout_VolumeSet( p_this, i_volume );
732 audio_volume_t i_volume;
733 if ( aout_VolumeGet( p_this, &i_volume ) < 0 )
735 i_error = VLC_EGENERIC;
739 printf( _("Volume is %d\n"), i_volume );
740 i_error = VLC_SUCCESS;
747 static int VolumeMove( vlc_object_t *p_this, char const *psz_cmd,
748 vlc_value_t oldval, vlc_value_t newval, void *p_data )
750 audio_volume_t i_volume;
751 int i_nb_steps = atoi(newval.psz_string);
752 int i_error = VLC_SUCCESS;
754 if ( i_nb_steps <= 0 || i_nb_steps > (AOUT_VOLUME_MAX/AOUT_VOLUME_STEP) )
759 if ( !strcmp(psz_cmd, "volup") )
761 if ( aout_VolumeUp( p_this, i_nb_steps, &i_volume ) < 0 )
762 i_error = VLC_EGENERIC;
766 if ( aout_VolumeDown( p_this, i_nb_steps, &i_volume ) < 0 )
767 i_error = VLC_EGENERIC;
770 if ( !i_error ) printf( _("Volume is %d\n"), i_volume );
774 static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
775 vlc_value_t oldval, vlc_value_t newval, void *p_data )
777 aout_instance_t * p_aout;
778 const char * psz_variable;
779 vlc_value_t val_name;
782 p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE );
783 if ( p_aout == NULL ) return VLC_ENOOBJ;
785 if ( !strcmp( psz_cmd, "adev" ) )
787 psz_variable = "audio-device";
791 psz_variable = "audio-channels";
794 /* Get the descriptive name of the variable */
795 var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_GETTEXT,
797 if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable);
799 if ( !*newval.psz_string )
801 /* Retrieve all registered ***. */
802 vlc_value_t val, text;
805 if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 )
807 vlc_object_release( (vlc_object_t *)p_aout );
812 if ( var_Change( (vlc_object_t *)p_aout, psz_variable,
813 VLC_VAR_GETLIST, &val, &text ) < 0 )
815 vlc_object_release( (vlc_object_t *)p_aout );
819 printf( "+----[ %s ]\n", val_name.psz_string );
820 for ( i = 0; i < val.p_list->i_count; i++ )
822 if ( i_value == val.p_list->p_values[i].i_int )
823 printf( "| %i - %s *\n", val.p_list->p_values[i].i_int,
824 text.p_list->p_values[i].psz_string );
826 printf( "| %i - %s\n", val.p_list->p_values[i].i_int,
827 text.p_list->p_values[i].psz_string );
829 var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST,
831 printf( _("+----[ end of %s ]\n"), val_name.psz_string );
833 if( val_name.psz_string ) free( val_name.psz_string );
834 i_error = VLC_SUCCESS;
839 val.i_int = atoi( newval.psz_string );
841 i_error = var_Set( (vlc_object_t *)p_aout, psz_variable, val );
843 vlc_object_release( (vlc_object_t *)p_aout );