1 /*****************************************************************************
2 * media_player.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_seekable_changed( vlc_object_t * p_this, char const * psz_cmd,
37 vlc_value_t oldval, vlc_value_t newval,
40 input_pausable_changed( vlc_object_t * p_this, char const * psz_cmd,
41 vlc_value_t oldval, vlc_value_t newval,
44 input_position_changed( vlc_object_t * p_this, char const * psz_cmd,
45 vlc_value_t oldval, vlc_value_t newval,
48 input_time_changed( vlc_object_t * p_this, char const * psz_cmd,
49 vlc_value_t oldval, vlc_value_t newval,
52 static const libvlc_state_t vlc_to_libvlc_state_array[] =
54 [INIT_S] = libvlc_Opening,
55 [OPENING_S] = libvlc_Opening,
56 [BUFFERING_S] = libvlc_Buffering,
57 [PLAYING_S] = libvlc_Playing,
58 [PAUSE_S] = libvlc_Paused,
59 [END_S] = libvlc_Ended,
60 [ERROR_S] = libvlc_Error,
62 static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
64 if( vlc_state < 0 || vlc_state > 6 )
65 return libvlc_Stopped;
67 return vlc_to_libvlc_state_array[vlc_state];
71 * Release the associated input thread
73 * Object lock is NOT held.
75 static void release_input_thread( libvlc_media_player_t *p_mi )
77 input_thread_t * p_input_thread;
79 if( !p_mi || !p_mi->p_input_thread )
82 p_input_thread = p_mi->p_input_thread;
84 /* No one is tracking this input_thread appart us. Destroy it */
85 if( p_mi->b_own_its_input_thread )
87 var_DelCallback( p_input_thread, "state", input_state_changed, p_mi );
88 var_DelCallback( p_input_thread, "seekable", input_seekable_changed, p_mi );
89 var_DelCallback( p_input_thread, "pausable", input_pausable_changed, p_mi );
90 var_DelCallback( p_input_thread, "intf-change", input_position_changed, p_mi );
91 var_DelCallback( p_input_thread, "intf-change", input_time_changed, p_mi );
93 /* We owned this one */
94 input_StopThread( p_input_thread );
96 var_Destroy( p_input_thread, "drawable" );
99 vlc_object_release( p_input_thread );
101 p_mi->p_input_thread = NULL;
105 * Retrieve the input thread. Be sure to release the object
106 * once you are done with it. (libvlc Internal)
108 * Object lock is held.
110 input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
111 libvlc_exception_t *p_e )
113 input_thread_t *p_input_thread;
115 if( !p_mi ) RAISENULL( "Media Instance is NULL" );
117 vlc_mutex_lock( &p_mi->object_lock );
119 if( !p_mi->p_input_thread )
121 vlc_mutex_unlock( &p_mi->object_lock );
122 RAISENULL( "Input is NULL" );
125 p_input_thread = p_mi->p_input_thread;
126 vlc_object_yield( p_input_thread );
128 vlc_mutex_unlock( &p_mi->object_lock );
130 return p_input_thread;
134 * input_state_changed (Private) (input var "state" Callback)
137 input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
138 vlc_value_t oldval, vlc_value_t newval,
144 libvlc_media_player_t * p_mi = p_userdata;
145 libvlc_event_t event;
146 libvlc_event_type_t type = newval.i_int;
151 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
152 event.type = libvlc_MediaPlayerEndReached;
155 libvlc_media_set_state( p_mi->p_md, libvlc_Playing, NULL);
156 event.type = libvlc_MediaPlayerPaused;
159 libvlc_media_set_state( p_mi->p_md, libvlc_Playing, NULL);
160 event.type = libvlc_MediaPlayerPlayed;
163 libvlc_media_set_state( p_mi->p_md, libvlc_Error, NULL);
164 event.type = libvlc_MediaPlayerEncounteredError;
170 libvlc_event_send( p_mi->p_event_manager, &event );
175 input_seekable_changed( vlc_object_t * p_this, char const * psz_cmd,
176 vlc_value_t oldval, vlc_value_t newval,
182 libvlc_media_player_t * p_mi = p_userdata;
183 libvlc_event_t event;
185 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
186 event.type = libvlc_MediaPlayerSeekableChanged;
187 event.u.media_player_seekable_changed.new_seekable = newval.b_bool;
189 libvlc_event_send( p_mi->p_event_manager, &event );
194 input_pausable_changed( vlc_object_t * p_this, char const * psz_cmd,
195 vlc_value_t oldval, vlc_value_t newval,
201 libvlc_media_player_t * p_mi = p_userdata;
202 libvlc_event_t event;
204 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
205 event.type = libvlc_MediaPlayerPausableChanged;
206 event.u.media_player_pausable_changed.new_pausable = newval.b_bool;
208 libvlc_event_send( p_mi->p_event_manager, &event );
213 * input_position_changed (Private) (input var "intf-change" Callback)
216 input_position_changed( vlc_object_t * p_this, char const * psz_cmd,
217 vlc_value_t oldval, vlc_value_t newval,
221 libvlc_media_player_t * p_mi = p_userdata;
224 if (!strncmp(psz_cmd, "intf", 4 /* "-change" no need to go further */))
226 input_thread_t * p_input = (input_thread_t *)p_this;
228 var_Get( p_input, "state", &val );
229 if( val.i_int != PLAYING_S )
230 return VLC_SUCCESS; /* Don't send the position while stopped */
232 var_Get( p_input, "position", &val );
235 val.i_time = newval.i_time;
237 libvlc_event_t event;
238 event.type = libvlc_MediaPlayerPositionChanged;
239 event.u.media_player_position_changed.new_position = val.f_float;
241 libvlc_event_send( p_mi->p_event_manager, &event );
246 * input_time_changed (Private) (input var "intf-change" Callback)
249 input_time_changed( vlc_object_t * p_this, char const * psz_cmd,
250 vlc_value_t oldval, vlc_value_t newval,
254 libvlc_media_player_t * p_mi = p_userdata;
257 if (!strncmp(psz_cmd, "intf", 4 /* "-change" no need to go further */))
259 input_thread_t * p_input = (input_thread_t *)p_this;
261 var_Get( p_input, "state", &val );
262 if( val.i_int != PLAYING_S )
263 return VLC_SUCCESS; /* Don't send the position while stopped */
265 var_Get( p_input, "time", &val );
268 val.i_time = newval.i_time;
270 libvlc_event_t event;
271 event.type = libvlc_MediaPlayerTimeChanged;
272 event.u.media_player_time_changed.new_time = val.i_time;
273 libvlc_event_send( p_mi->p_event_manager, &event );
277 /**************************************************************************
278 * Create a Media Instance object
279 **************************************************************************/
280 libvlc_media_player_t *
281 libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
282 libvlc_exception_t * p_e )
284 libvlc_media_player_t * p_mi;
286 if( !p_libvlc_instance )
288 libvlc_exception_raise( p_e, "invalid libvlc instance" );
292 p_mi = malloc( sizeof(libvlc_media_player_t) );
295 p_mi->p_libvlc_instance = p_libvlc_instance;
296 p_mi->p_input_thread = NULL;
297 /* refcount strategy:
298 * - All items created by _new start with a refcount set to 1
299 * - Accessor _release decrease the refcount by 1, if after that
300 * operation the refcount is 0, the object is destroyed.
301 * - Accessor _retain increase the refcount by 1 (XXX: to implement) */
302 p_mi->i_refcount = 1;
303 p_mi->b_own_its_input_thread = true;
304 /* object_lock strategy:
305 * - No lock held in constructor
306 * - Lock when accessing all variable this lock is held
307 * - Lock when attempting to destroy the object the lock is also held */
308 vlc_mutex_init( &p_mi->object_lock );
309 p_mi->p_event_manager = libvlc_event_manager_new( p_mi,
310 p_libvlc_instance, p_e );
311 if( libvlc_exception_raised( p_e ) )
317 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
318 libvlc_MediaPlayerEndReached, p_e );
319 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
320 libvlc_MediaPlayerStopped, p_e );
321 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
322 libvlc_MediaPlayerEncounteredError, p_e );
323 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
324 libvlc_MediaPlayerPaused, p_e );
325 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
326 libvlc_MediaPlayerPlayed, p_e );
327 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
328 libvlc_MediaPlayerPositionChanged, p_e );
329 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
330 libvlc_MediaPlayerTimeChanged, p_e );
331 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
332 libvlc_MediaPlayerSeekableChanged, p_e );
333 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
334 libvlc_MediaPlayerPausableChanged, p_e );
339 /**************************************************************************
340 * Create a Media Instance object with a media descriptor
341 **************************************************************************/
342 libvlc_media_player_t *
343 libvlc_media_player_new_from_media(
344 libvlc_media_t * p_md,
345 libvlc_exception_t *p_e )
347 libvlc_media_player_t * p_mi;
348 p_mi = libvlc_media_player_new( p_md->p_libvlc_instance, p_e );
353 libvlc_media_retain( p_md );
359 /**************************************************************************
360 * Create a new media instance object from an input_thread (Libvlc Internal)
361 **************************************************************************/
362 libvlc_media_player_t * libvlc_media_player_new_from_input_thread(
363 struct libvlc_instance_t *p_libvlc_instance,
364 input_thread_t *p_input,
365 libvlc_exception_t *p_e )
367 libvlc_media_player_t * p_mi;
371 libvlc_exception_raise( p_e, "invalid input thread" );
375 p_mi = libvlc_media_player_new( p_libvlc_instance, p_e );
380 p_mi->p_md = libvlc_media_new_from_input_item(
382 input_GetItem( p_input ), p_e );
386 libvlc_media_player_destroy( p_mi );
390 /* will be released in media_player_release() */
391 vlc_object_yield( p_input );
393 p_mi->p_input_thread = p_input;
394 p_mi->b_own_its_input_thread = false;
399 /**************************************************************************
400 * Destroy a Media Instance object (libvlc internal)
402 * Warning: No lock held here, but hey, this is internal.
403 **************************************************************************/
404 void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
406 input_thread_t *p_input_thread;
407 libvlc_exception_t p_e;
409 libvlc_exception_init( &p_e );
414 p_input_thread = libvlc_get_input_thread( p_mi, &p_e );
416 if( libvlc_exception_raised( &p_e ) )
418 libvlc_event_manager_release( p_mi->p_event_manager );
419 libvlc_exception_clear( &p_e );
421 return; /* no need to worry about no input thread */
423 vlc_mutex_destroy( &p_mi->object_lock );
425 vlc_object_release( p_input_thread );
427 libvlc_media_release( p_mi->p_md );
432 /**************************************************************************
433 * Release a Media Instance object
434 **************************************************************************/
435 void libvlc_media_player_release( libvlc_media_player_t *p_mi )
440 vlc_mutex_lock( &p_mi->object_lock );
444 if( p_mi->i_refcount > 0 )
446 vlc_mutex_unlock( &p_mi->object_lock );
449 vlc_mutex_unlock( &p_mi->object_lock );
450 vlc_mutex_destroy( &p_mi->object_lock );
452 release_input_thread( p_mi );
454 libvlc_event_manager_release( p_mi->p_event_manager );
456 libvlc_media_release( p_mi->p_md );
461 /**************************************************************************
462 * Retain a Media Instance object
463 **************************************************************************/
464 void libvlc_media_player_retain( libvlc_media_player_t *p_mi )
472 /**************************************************************************
473 * Set the Media descriptor associated with the instance
474 **************************************************************************/
475 void libvlc_media_player_set_media(
476 libvlc_media_player_t *p_mi,
477 libvlc_media_t *p_md,
478 libvlc_exception_t *p_e )
485 vlc_mutex_lock( &p_mi->object_lock );
487 release_input_thread( p_mi );
490 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL );
492 libvlc_media_release( p_mi->p_md );
497 vlc_mutex_unlock( &p_mi->object_lock );
498 return; /* It is ok to pass a NULL md */
501 libvlc_media_retain( p_md );
504 /* The policy here is to ignore that we were created using a different
505 * libvlc_instance, because we don't really care */
506 p_mi->p_libvlc_instance = p_md->p_libvlc_instance;
508 vlc_mutex_unlock( &p_mi->object_lock );
511 /**************************************************************************
512 * Get the Media descriptor associated with the instance
513 **************************************************************************/
515 libvlc_media_player_get_media(
516 libvlc_media_player_t *p_mi,
517 libvlc_exception_t *p_e )
524 libvlc_media_retain( p_mi->p_md );
528 /**************************************************************************
529 * Get the event Manager
530 **************************************************************************/
531 libvlc_event_manager_t *
532 libvlc_media_player_event_manager(
533 libvlc_media_player_t *p_mi,
534 libvlc_exception_t *p_e )
538 return p_mi->p_event_manager;
541 /**************************************************************************
543 **************************************************************************/
544 void libvlc_media_player_play( libvlc_media_player_t *p_mi,
545 libvlc_exception_t *p_e )
547 input_thread_t * p_input_thread;
549 if( (p_input_thread = libvlc_get_input_thread( p_mi, p_e )) )
551 /* A thread already exists, send it a play message */
552 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
553 vlc_object_release( p_input_thread );
557 /* Ignore previous exception */
558 libvlc_exception_clear( p_e );
560 vlc_mutex_lock( &p_mi->object_lock );
564 libvlc_exception_raise( p_e, "no associated media descriptor" );
565 vlc_mutex_unlock( &p_mi->object_lock );
569 p_mi->p_input_thread = input_CreateThread( p_mi->p_libvlc_instance->p_libvlc_int,
570 p_mi->p_md->p_input_item );
573 if( !p_mi->p_input_thread )
575 vlc_mutex_unlock( &p_mi->object_lock );
579 p_input_thread = p_mi->p_input_thread;
584 val.i_int = p_mi->drawable;
585 var_Create( p_input_thread, "drawable", VLC_VAR_DOINHERIT );
586 var_Set( p_input_thread, "drawable", val );
588 var_AddCallback( p_input_thread, "state", input_state_changed, p_mi );
589 var_AddCallback( p_input_thread, "seekable", input_seekable_changed, p_mi );
590 var_AddCallback( p_input_thread, "pausable", input_pausable_changed, p_mi );
591 var_AddCallback( p_input_thread, "intf-change", input_position_changed, p_mi );
592 var_AddCallback( p_input_thread, "intf-change", input_time_changed, p_mi );
594 vlc_mutex_unlock( &p_mi->object_lock );
597 /**************************************************************************
599 **************************************************************************/
600 void libvlc_media_player_pause( libvlc_media_player_t *p_mi,
601 libvlc_exception_t *p_e )
603 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
605 if( !p_input_thread )
608 int state = var_GetInteger( p_input_thread, "state" );
610 if( state == PLAYING_S )
612 if( libvlc_media_player_can_pause( p_mi, p_e ) )
613 input_Control( p_input_thread, INPUT_SET_STATE, PAUSE_S );
615 libvlc_media_player_stop( p_mi, p_e );
618 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
620 vlc_object_release( p_input_thread );
623 /**************************************************************************
625 **************************************************************************/
626 void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
627 libvlc_exception_t *p_e )
629 if( p_mi->b_own_its_input_thread )
631 vlc_mutex_lock( &p_mi->object_lock );
632 release_input_thread( p_mi ); /* This will stop the input thread */
633 vlc_mutex_unlock( &p_mi->object_lock );
637 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
639 if( !p_input_thread )
642 input_StopThread( p_input_thread );
643 vlc_object_release( p_input_thread );
646 /* Send a stop notification event */
647 libvlc_event_t event;
648 libvlc_media_set_state( p_mi->p_md, libvlc_Stopped, NULL);
649 event.type = libvlc_MediaPlayerStopped;
650 libvlc_event_send( p_mi->p_event_manager, &event );
653 /**************************************************************************
655 **************************************************************************/
656 void libvlc_media_player_set_drawable( libvlc_media_player_t *p_mi,
657 libvlc_drawable_t drawable,
658 libvlc_exception_t *p_e )
661 p_mi->drawable = drawable;
664 /**************************************************************************
666 **************************************************************************/
668 libvlc_media_player_get_drawable ( libvlc_media_player_t *p_mi, libvlc_exception_t *p_e )
671 return p_mi->drawable;
674 /**************************************************************************
675 * Getters for stream information
676 **************************************************************************/
677 libvlc_time_t libvlc_media_player_get_length(
678 libvlc_media_player_t *p_mi,
679 libvlc_exception_t *p_e )
681 input_thread_t *p_input_thread;
684 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
685 if( !p_input_thread )
688 var_Get( p_input_thread, "length", &val );
689 vlc_object_release( p_input_thread );
691 return (val.i_time+500LL)/1000LL;
694 libvlc_time_t libvlc_media_player_get_time(
695 libvlc_media_player_t *p_mi,
696 libvlc_exception_t *p_e )
698 input_thread_t *p_input_thread;
701 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
702 if( !p_input_thread )
705 var_Get( p_input_thread , "time", &val );
706 vlc_object_release( p_input_thread );
707 return (val.i_time+500LL)/1000LL;
710 void libvlc_media_player_set_time(
711 libvlc_media_player_t *p_mi,
713 libvlc_exception_t *p_e )
715 input_thread_t *p_input_thread;
718 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
719 if( !p_input_thread )
722 value.i_time = time*1000LL;
723 var_Set( p_input_thread, "time", value );
724 vlc_object_release( p_input_thread );
727 void libvlc_media_player_set_position(
728 libvlc_media_player_t *p_mi,
730 libvlc_exception_t *p_e )
732 input_thread_t *p_input_thread;
734 val.f_float = position;
736 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
737 if( !p_input_thread )
740 var_Set( p_input_thread, "position", val );
741 vlc_object_release( p_input_thread );
744 float libvlc_media_player_get_position(
745 libvlc_media_player_t *p_mi,
746 libvlc_exception_t *p_e )
748 input_thread_t *p_input_thread;
751 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
752 if( !p_input_thread )
755 var_Get( p_input_thread, "position", &val );
756 vlc_object_release( p_input_thread );
761 void libvlc_media_player_set_chapter(
762 libvlc_media_player_t *p_mi,
764 libvlc_exception_t *p_e )
766 input_thread_t *p_input_thread;
770 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
771 if( !p_input_thread )
774 var_Set( p_input_thread, "chapter", val );
775 vlc_object_release( p_input_thread );
778 int libvlc_media_player_get_chapter(
779 libvlc_media_player_t *p_mi,
780 libvlc_exception_t *p_e )
782 input_thread_t *p_input_thread;
785 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
786 if( !p_input_thread )
789 var_Get( p_input_thread, "chapter", &val );
790 vlc_object_release( p_input_thread );
795 int libvlc_media_player_get_chapter_count(
796 libvlc_media_player_t *p_mi,
797 libvlc_exception_t *p_e )
799 input_thread_t *p_input_thread;
802 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
803 if( !p_input_thread )
806 var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
807 vlc_object_release( p_input_thread );
812 float libvlc_media_player_get_fps(
813 libvlc_media_player_t *p_mi,
814 libvlc_exception_t *p_e)
816 input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
821 if( input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps ) )
823 vlc_object_release( p_input_thread );
828 int libvlc_media_player_will_play( libvlc_media_player_t *p_mi,
829 libvlc_exception_t *p_e)
831 input_thread_t *p_input_thread =
832 libvlc_get_input_thread ( p_mi, p_e);
833 if ( !p_input_thread )
836 if ( !p_input_thread->b_die && !p_input_thread->b_dead )
838 vlc_object_release( p_input_thread );
841 vlc_object_release( p_input_thread );
845 void libvlc_media_player_set_rate(
846 libvlc_media_player_t *p_mi,
848 libvlc_exception_t *p_e )
850 input_thread_t *p_input_thread;
854 RAISEVOID( "Rate value is invalid" );
856 val.i_int = 1000.0f/rate;
858 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
859 if ( !p_input_thread )
862 var_Set( p_input_thread, "rate", val );
863 vlc_object_release( p_input_thread );
866 float libvlc_media_player_get_rate(
867 libvlc_media_player_t *p_mi,
868 libvlc_exception_t *p_e )
870 input_thread_t *p_input_thread;
873 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
874 if ( !p_input_thread )
877 var_Get( p_input_thread, "rate", &val );
878 vlc_object_release( p_input_thread );
880 return (float)1000.0f/val.i_int;
883 libvlc_state_t libvlc_media_player_get_state(
884 libvlc_media_player_t *p_mi,
885 libvlc_exception_t *p_e )
887 input_thread_t *p_input_thread;
890 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
891 if ( !p_input_thread )
893 /* We do return the right value, no need to throw an exception */
894 if( libvlc_exception_raised( p_e ) )
895 libvlc_exception_clear( p_e );
896 return libvlc_Stopped;
899 var_Get( p_input_thread, "state", &val );
900 vlc_object_release( p_input_thread );
902 return vlc_to_libvlc_state(val.i_int);
905 int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi,
906 libvlc_exception_t *p_e )
908 input_thread_t *p_input_thread;
911 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
912 if ( !p_input_thread )
914 /* We do return the right value, no need to throw an exception */
915 if( libvlc_exception_raised( p_e ) )
916 libvlc_exception_clear( p_e );
919 var_Get( p_input_thread, "seekable", &val );
920 vlc_object_release( p_input_thread );
925 int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi,
926 libvlc_exception_t *p_e )
928 input_thread_t *p_input_thread;
931 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
932 if ( !p_input_thread )
934 /* We do return the right value, no need to throw an exception */
935 if( libvlc_exception_raised( p_e ) )
936 libvlc_exception_clear( p_e );
939 var_Get( p_input_thread, "can-pause", &val );
940 vlc_object_release( p_input_thread );