1 /*****************************************************************************
2 * media_instance.c: Libvlc API Media Instance management functions
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include "libvlc_internal.h"
26 #include <vlc/libvlc.h>
27 #include <vlc_demux.h>
28 #include <vlc_input.h>
32 input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
33 vlc_value_t oldval, vlc_value_t newval,
36 input_position_changed( vlc_object_t * p_this, char const * psz_cmd,
37 vlc_value_t oldval, vlc_value_t newval,
40 input_time_changed( vlc_object_t * p_this, char const * psz_cmd,
41 vlc_value_t oldval, vlc_value_t newval,
44 static const libvlc_state_t vlc_to_libvlc_state_array[] =
46 [INIT_S] = libvlc_Opening,
47 [OPENING_S] = libvlc_Opening,
48 [BUFFERING_S] = libvlc_Buffering,
49 [PLAYING_S] = libvlc_Playing,
50 [PAUSE_S] = libvlc_Paused,
51 [END_S] = libvlc_Ended,
52 [ERROR_S] = libvlc_Error,
54 static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
56 if( vlc_state < 0 || vlc_state > 6 )
57 return libvlc_Stopped;
59 return vlc_to_libvlc_state_array[vlc_state];
63 * Release the associated input thread
65 * Object lock is NOT held.
67 static void release_input_thread( libvlc_media_instance_t *p_mi )
69 input_thread_t *p_input_thread;
71 if( !p_mi || p_mi->i_input_id == -1 )
74 p_input_thread = (input_thread_t*)vlc_object_get( p_mi->i_input_id );
76 p_mi->i_input_id = -1;
81 /* release for previous vlc_object_get */
82 vlc_object_release( p_input_thread );
84 /* release for initial p_input_thread yield (see _new()) */
85 vlc_object_release( p_input_thread );
87 /* No one is tracking this input_thread appart us. Destroy it */
88 if( p_mi->b_own_its_input_thread )
90 var_DelCallback( p_input_thread, "state", input_state_changed, p_mi );
91 var_DelCallback( p_input_thread, "seekable", input_state_changed, p_mi );
92 var_DelCallback( p_input_thread, "pausable", input_state_changed, p_mi );
93 var_DelCallback( p_input_thread, "intf-change", input_position_changed, p_mi );
94 var_DelCallback( p_input_thread, "intf-change", input_time_changed, p_mi );
95 /* We owned this one */
96 input_StopThread( p_input_thread );
97 var_Destroy( p_input_thread, "drawable" );
98 //input_DestroyThread( p_input_thread );
102 /* XXX: hack the playlist doesn't retain the input thread,
103 * so we did it for the playlist (see _new_from_input_thread),
104 * revert that here. This will be deleted with the playlist API */
105 vlc_object_release( p_input_thread );
111 * Retrieve the input thread. Be sure to release the object
112 * once you are done with it. (libvlc Internal)
114 * Object lock is held.
116 input_thread_t *libvlc_get_input_thread( libvlc_media_instance_t *p_mi,
117 libvlc_exception_t *p_e )
119 input_thread_t *p_input_thread;
121 vlc_mutex_lock( &p_mi->object_lock );
123 if( !p_mi || p_mi->i_input_id == -1 )
125 vlc_mutex_unlock( &p_mi->object_lock );
126 RAISENULL( "Input is NULL" );
129 p_input_thread = (input_thread_t*)vlc_object_get( p_mi->i_input_id );
130 if( !p_input_thread )
132 vlc_mutex_unlock( &p_mi->object_lock );
133 RAISENULL( "Input does not exist" );
136 vlc_mutex_unlock( &p_mi->object_lock );
137 return p_input_thread;
141 * input_state_changed (Private) (input var "state" Callback)
144 input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
145 vlc_value_t oldval, vlc_value_t newval,
149 libvlc_media_instance_t * p_mi = p_userdata;
150 libvlc_event_t event;
151 libvlc_event_type_t type = newval.i_int;
153 if( strcmp( psz_cmd, "state" ) )
154 type = var_GetInteger( p_this, "state" );
159 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
160 event.type = libvlc_MediaInstanceReachedEnd;
163 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_Playing, NULL);
164 event.type = libvlc_MediaInstancePaused;
167 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_Playing, NULL);
168 event.type = libvlc_MediaInstancePlayed;
171 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_Error, NULL);
172 event.type = libvlc_MediaInstanceEncounteredError;
178 libvlc_event_send( p_mi->p_event_manager, &event );
183 * input_position_changed (Private) (input var "intf-change" Callback)
186 input_position_changed( vlc_object_t * p_this, char const * psz_cmd,
187 vlc_value_t oldval, vlc_value_t newval,
191 libvlc_media_instance_t * p_mi = p_userdata;
194 if (!strncmp(psz_cmd, "intf", 4 /* "-change" no need to go further */))
196 input_thread_t * p_input = (input_thread_t *)p_this;
198 var_Get( p_input, "state", &val );
199 if( val.i_int != PLAYING_S )
200 return VLC_SUCCESS; /* Don't send the position while stopped */
202 var_Get( p_input, "position", &val );
205 val.i_time = newval.i_time;
207 libvlc_event_t event;
208 event.type = libvlc_MediaInstancePositionChanged;
209 event.u.media_instance_position_changed.new_position = val.f_float;
211 libvlc_event_send( p_mi->p_event_manager, &event );
216 * input_time_changed (Private) (input var "intf-change" Callback)
219 input_time_changed( vlc_object_t * p_this, char const * psz_cmd,
220 vlc_value_t oldval, vlc_value_t newval,
224 libvlc_media_instance_t * p_mi = p_userdata;
227 if (!strncmp(psz_cmd, "intf", 4 /* "-change" no need to go further */))
229 input_thread_t * p_input = (input_thread_t *)p_this;
231 var_Get( p_input, "state", &val );
232 if( val.i_int != PLAYING_S )
233 return VLC_SUCCESS; /* Don't send the position while stopped */
235 var_Get( p_input, "time", &val );
238 val.i_time = newval.i_time;
240 libvlc_event_t event;
241 event.type = libvlc_MediaInstanceTimeChanged;
242 event.u.media_instance_time_changed.new_time = val.i_time;
243 libvlc_event_send( p_mi->p_event_manager, &event );
247 /**************************************************************************
248 * Create a Media Instance object
249 **************************************************************************/
250 libvlc_media_instance_t *
251 libvlc_media_instance_new( libvlc_instance_t * p_libvlc_instance,
252 libvlc_exception_t * p_e )
254 libvlc_media_instance_t * p_mi;
256 if( !p_libvlc_instance )
258 libvlc_exception_raise( p_e, "invalid libvlc instance" );
262 p_mi = malloc( sizeof(libvlc_media_instance_t) );
265 p_mi->p_libvlc_instance = p_libvlc_instance;
266 p_mi->i_input_id = -1;
267 /* refcount strategy:
268 * - All items created by _new start with a refcount set to 1
269 * - Accessor _release decrease the refcount by 1, if after that
270 * operation the refcount is 0, the object is destroyed.
271 * - Accessor _retain increase the refcount by 1 (XXX: to implement) */
272 p_mi->i_refcount = 1;
273 p_mi->b_own_its_input_thread = VLC_TRUE;
274 /* object_lock strategy:
275 * - No lock held in constructor
276 * - Lock when accessing all variable this lock is held
277 * - Lock when attempting to destroy the object the lock is also held */
278 vlc_mutex_init( p_mi->p_libvlc_instance->p_libvlc_int,
279 &p_mi->object_lock );
280 p_mi->p_event_manager = libvlc_event_manager_new( p_mi,
281 p_libvlc_instance, p_e );
282 if( libvlc_exception_raised( p_e ) )
288 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
289 libvlc_MediaInstanceReachedEnd, p_e );
290 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
291 libvlc_MediaInstanceEncounteredError, p_e );
292 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
293 libvlc_MediaInstancePaused, p_e );
294 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
295 libvlc_MediaInstancePlayed, p_e );
296 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
297 libvlc_MediaInstancePositionChanged, p_e );
298 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
299 libvlc_MediaInstanceTimeChanged, p_e );
304 /**************************************************************************
305 * Create a Media Instance object with a media descriptor
306 **************************************************************************/
307 libvlc_media_instance_t *
308 libvlc_media_instance_new_from_media_descriptor(
309 libvlc_media_descriptor_t * p_md,
310 libvlc_exception_t *p_e )
312 libvlc_media_instance_t * p_mi;
313 p_mi = libvlc_media_instance_new( p_md->p_libvlc_instance, p_e );
318 libvlc_media_descriptor_retain( p_md );
324 /**************************************************************************
325 * Create a new media instance object from an input_thread (Libvlc Internal)
326 **************************************************************************/
327 libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread(
328 struct libvlc_instance_t *p_libvlc_instance,
329 input_thread_t *p_input,
330 libvlc_exception_t *p_e )
332 libvlc_media_instance_t * p_mi;
336 libvlc_exception_raise( p_e, "invalid input thread" );
340 p_mi = libvlc_media_instance_new( p_libvlc_instance, p_e );
345 p_mi->p_md = libvlc_media_descriptor_new_from_input_item(
347 input_GetItem( p_input ), p_e );
351 libvlc_media_instance_destroy( p_mi );
355 p_mi->i_input_id = p_input->i_object_id;
356 p_mi->b_own_its_input_thread = VLC_FALSE;
358 /* will be released in media_instance_release() */
359 vlc_object_yield( p_input );
361 /* XXX: Hack as the playlist doesn't yield the input thread we retain
362 * the input for the playlist. (see corresponding hack in _release) */
363 vlc_object_yield( p_input );
368 /**************************************************************************
369 * Destroy a Media Instance object (libvlc internal)
371 * Warning: No lock held here, but hey, this is internal.
372 **************************************************************************/
373 void libvlc_media_instance_destroy( libvlc_media_instance_t *p_mi )
375 input_thread_t *p_input_thread;
376 libvlc_exception_t p_e;
378 libvlc_exception_init( &p_e );
383 p_input_thread = libvlc_get_input_thread( p_mi, &p_e );
385 if( libvlc_exception_raised( &p_e ) )
387 libvlc_event_manager_release( p_mi->p_event_manager );
388 libvlc_exception_clear( &p_e );
390 return; /* no need to worry about no input thread */
392 vlc_mutex_destroy( &p_mi->object_lock );
394 input_DestroyThread( p_input_thread );
396 libvlc_media_descriptor_release( p_mi->p_md );
401 /**************************************************************************
402 * Release a Media Instance object
403 **************************************************************************/
404 void libvlc_media_instance_release( libvlc_media_instance_t *p_mi )
409 vlc_mutex_lock( &p_mi->object_lock );
413 if( p_mi->i_refcount > 0 )
415 vlc_mutex_unlock( &p_mi->object_lock );
418 vlc_mutex_unlock( &p_mi->object_lock );
419 vlc_mutex_destroy( &p_mi->object_lock );
421 release_input_thread( p_mi );
423 libvlc_event_manager_release( p_mi->p_event_manager );
425 libvlc_media_descriptor_release( p_mi->p_md );
430 /**************************************************************************
431 * Retain a Media Instance object
432 **************************************************************************/
433 void libvlc_media_instance_retain( libvlc_media_instance_t *p_mi )
441 /**************************************************************************
442 * Set the Media descriptor associated with the instance
443 **************************************************************************/
444 void libvlc_media_instance_set_media_descriptor(
445 libvlc_media_instance_t *p_mi,
446 libvlc_media_descriptor_t *p_md,
447 libvlc_exception_t *p_e )
454 vlc_mutex_lock( &p_mi->object_lock );
456 release_input_thread( p_mi );
459 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL );
461 libvlc_media_descriptor_release( p_mi->p_md );
466 vlc_mutex_unlock( &p_mi->object_lock );
467 return; /* It is ok to pass a NULL md */
470 libvlc_media_descriptor_retain( p_md );
473 /* The policy here is to ignore that we were created using a different
474 * libvlc_instance, because we don't really care */
475 p_mi->p_libvlc_instance = p_md->p_libvlc_instance;
477 vlc_mutex_unlock( &p_mi->object_lock );
480 /**************************************************************************
481 * Get the Media descriptor associated with the instance
482 **************************************************************************/
483 libvlc_media_descriptor_t *
484 libvlc_media_instance_get_media_descriptor(
485 libvlc_media_instance_t *p_mi,
486 libvlc_exception_t *p_e )
493 libvlc_media_descriptor_retain( p_mi->p_md );
497 /**************************************************************************
498 * Get the event Manager
499 **************************************************************************/
500 libvlc_event_manager_t *
501 libvlc_media_instance_event_manager(
502 libvlc_media_instance_t *p_mi,
503 libvlc_exception_t *p_e )
507 return p_mi->p_event_manager;
510 /**************************************************************************
512 **************************************************************************/
513 void libvlc_media_instance_play( libvlc_media_instance_t *p_mi,
514 libvlc_exception_t *p_e )
516 input_thread_t * p_input_thread;
518 if( (p_input_thread = libvlc_get_input_thread( p_mi, p_e )) )
520 /* A thread alread exists, send it a play message */
521 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
522 vlc_object_release( p_input_thread );
526 /* Ignore previous exception */
527 libvlc_exception_clear( p_e );
529 vlc_mutex_lock( &p_mi->object_lock );
533 libvlc_exception_raise( p_e, "no associated media descriptor" );
534 vlc_mutex_unlock( &p_mi->object_lock );
538 p_mi->i_input_id = input_Read( p_mi->p_libvlc_instance->p_libvlc_int,
539 p_mi->p_md->p_input_item, VLC_FALSE );
541 /* Released in _release() */
542 p_input_thread = (input_thread_t*)vlc_object_get( p_mi->i_input_id );
544 if( !p_input_thread )
547 vlc_mutex_unlock( &p_mi->object_lock );
553 val.i_int = p_mi->drawable;
554 var_Create( p_input_thread, "drawable", VLC_VAR_DOINHERIT );
555 var_Set( p_input_thread, "drawable", val );
557 var_AddCallback( p_input_thread, "state", input_state_changed, p_mi );
558 var_AddCallback( p_input_thread, "seekable", input_state_changed, p_mi );
559 var_AddCallback( p_input_thread, "pausable", input_state_changed, p_mi );
560 var_AddCallback( p_input_thread, "intf-change", input_position_changed, p_mi );
561 var_AddCallback( p_input_thread, "intf-change", input_time_changed, p_mi );
563 vlc_mutex_unlock( &p_mi->object_lock );
566 /**************************************************************************
568 **************************************************************************/
569 void libvlc_media_instance_pause( libvlc_media_instance_t *p_mi,
570 libvlc_exception_t *p_e )
572 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
574 if( !p_input_thread )
577 int state = var_GetInteger( p_input_thread, "state" );
579 if( state == PLAYING_S )
581 if( libvlc_media_instance_can_pause( p_mi, p_e ) )
582 input_Control( p_input_thread, INPUT_SET_STATE, PAUSE_S );
584 libvlc_media_instance_stop( p_mi, p_e );
587 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
589 vlc_object_release( p_input_thread );
592 /**************************************************************************
594 **************************************************************************/
595 void libvlc_media_instance_stop( libvlc_media_instance_t *p_mi,
596 libvlc_exception_t *p_e )
598 if( p_mi->b_own_its_input_thread )
599 release_input_thread( p_mi ); /* This will stop the input thread */
602 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
604 if( !p_input_thread )
607 input_StopThread( p_input_thread );
608 vlc_object_release( p_input_thread );
612 /**************************************************************************
614 **************************************************************************/
615 void libvlc_media_instance_set_drawable( libvlc_media_instance_t *p_mi,
616 libvlc_drawable_t drawable,
617 libvlc_exception_t *p_e )
619 p_mi->drawable = drawable;
622 /**************************************************************************
624 **************************************************************************/
626 libvlc_media_instance_get_drawable ( libvlc_media_instance_t *p_mi, libvlc_exception_t *p_e )
628 return p_mi->drawable;
631 /**************************************************************************
632 * Getters for stream information
633 **************************************************************************/
634 libvlc_time_t libvlc_media_instance_get_length(
635 libvlc_media_instance_t *p_mi,
636 libvlc_exception_t *p_e )
638 input_thread_t *p_input_thread;
641 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
642 if( !p_input_thread )
645 var_Get( p_input_thread, "length", &val );
646 vlc_object_release( p_input_thread );
648 return (val.i_time+500LL)/1000LL;
651 libvlc_time_t libvlc_media_instance_get_time(
652 libvlc_media_instance_t *p_mi,
653 libvlc_exception_t *p_e )
655 input_thread_t *p_input_thread;
658 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
659 if( !p_input_thread )
662 var_Get( p_input_thread , "time", &val );
663 vlc_object_release( p_input_thread );
664 return (val.i_time+500LL)/1000LL;
667 void libvlc_media_instance_set_time(
668 libvlc_media_instance_t *p_mi,
670 libvlc_exception_t *p_e )
672 input_thread_t *p_input_thread;
675 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
676 if( !p_input_thread )
679 value.i_time = time*1000LL;
680 var_Set( p_input_thread, "time", value );
681 vlc_object_release( p_input_thread );
684 void libvlc_media_instance_set_position(
685 libvlc_media_instance_t *p_mi,
687 libvlc_exception_t *p_e )
689 input_thread_t *p_input_thread;
691 val.f_float = position;
693 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
694 if( !p_input_thread )
697 var_Set( p_input_thread, "position", val );
698 vlc_object_release( p_input_thread );
701 float libvlc_media_instance_get_position(
702 libvlc_media_instance_t *p_mi,
703 libvlc_exception_t *p_e )
705 input_thread_t *p_input_thread;
708 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
709 if( !p_input_thread )
712 var_Get( p_input_thread, "position", &val );
713 vlc_object_release( p_input_thread );
718 void libvlc_media_instance_set_chapter(
719 libvlc_media_instance_t *p_mi,
721 libvlc_exception_t *p_e )
723 input_thread_t *p_input_thread;
727 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
728 if( !p_input_thread )
731 var_Set( p_input_thread, "chapter", val );
732 vlc_object_release( p_input_thread );
735 int libvlc_media_instance_get_chapter(
736 libvlc_media_instance_t *p_mi,
737 libvlc_exception_t *p_e )
739 input_thread_t *p_input_thread;
742 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
743 if( !p_input_thread )
746 var_Get( p_input_thread, "chapter", &val );
747 vlc_object_release( p_input_thread );
752 int libvlc_media_instance_get_chapter_count(
753 libvlc_media_instance_t *p_mi,
754 libvlc_exception_t *p_e )
756 input_thread_t *p_input_thread;
759 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
760 if( !p_input_thread )
763 var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
764 vlc_object_release( p_input_thread );
769 float libvlc_media_instance_get_fps(
770 libvlc_media_instance_t *p_mi,
771 libvlc_exception_t *p_e)
773 input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
778 if( input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps ) )
780 vlc_object_release( p_input_thread );
785 vlc_bool_t libvlc_media_instance_will_play(
786 libvlc_media_instance_t *p_mi,
787 libvlc_exception_t *p_e)
789 input_thread_t *p_input_thread =
790 libvlc_get_input_thread ( p_mi, p_e);
791 if ( !p_input_thread )
794 if ( !p_input_thread->b_die && !p_input_thread->b_dead )
796 vlc_object_release( p_input_thread );
799 vlc_object_release( p_input_thread );
803 void libvlc_media_instance_set_rate(
804 libvlc_media_instance_t *p_mi,
806 libvlc_exception_t *p_e )
808 input_thread_t *p_input_thread;
812 RAISEVOID( "Rate value is invalid" );
814 val.i_int = 1000.0f/rate;
816 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
817 if ( !p_input_thread )
820 var_Set( p_input_thread, "rate", val );
821 vlc_object_release( p_input_thread );
824 float libvlc_media_instance_get_rate(
825 libvlc_media_instance_t *p_mi,
826 libvlc_exception_t *p_e )
828 input_thread_t *p_input_thread;
831 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
832 if ( !p_input_thread )
835 var_Get( p_input_thread, "rate", &val );
836 vlc_object_release( p_input_thread );
838 return (float)1000.0f/val.i_int;
841 libvlc_state_t libvlc_media_instance_get_state(
842 libvlc_media_instance_t *p_mi,
843 libvlc_exception_t *p_e )
845 input_thread_t *p_input_thread;
848 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
849 if ( !p_input_thread )
851 /* We do return the right value, no need to throw an exception */
852 if( libvlc_exception_raised( p_e ) )
853 libvlc_exception_clear( p_e );
854 return libvlc_Stopped;
857 var_Get( p_input_thread, "state", &val );
858 vlc_object_release( p_input_thread );
860 return vlc_to_libvlc_state(val.i_int);
863 vlc_bool_t libvlc_media_instance_is_seekable(
864 libvlc_media_instance_t *p_mi,
865 libvlc_exception_t *p_e )
867 input_thread_t *p_input_thread;
870 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
871 if ( !p_input_thread )
873 /* We do return the right value, no need to throw an exception */
874 if( libvlc_exception_raised( p_e ) )
875 libvlc_exception_clear( p_e );
878 var_Get( p_input_thread, "seekable", &val );
879 vlc_object_release( p_input_thread );
884 vlc_bool_t libvlc_media_instance_can_pause(
885 libvlc_media_instance_t *p_mi,
886 libvlc_exception_t *p_e )
888 input_thread_t *p_input_thread;
891 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
892 if ( !p_input_thread )
894 /* We do return the right value, no need to throw an exception */
895 if( libvlc_exception_raised( p_e ) )
896 libvlc_exception_clear( p_e );
899 var_Get( p_input_thread, "can-pause", &val );
900 vlc_object_release( p_input_thread );