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,
63 static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
65 if( vlc_state < 0 || vlc_state > 6 )
66 return libvlc_Stopped;
68 return vlc_to_libvlc_state_array[vlc_state];
72 * Release the associated input thread
74 * Object lock is NOT held.
76 static void release_input_thread( libvlc_media_player_t *p_mi )
78 input_thread_t * p_input_thread;
80 if( !p_mi || !p_mi->p_input_thread )
83 p_input_thread = p_mi->p_input_thread;
85 /* No one is tracking this input_thread appart us. Destroy it */
86 if( p_mi->b_own_its_input_thread )
88 var_DelCallback( p_input_thread, "state", input_state_changed, p_mi );
89 var_DelCallback( p_input_thread, "seekable", input_seekable_changed, p_mi );
90 var_DelCallback( p_input_thread, "pausable", input_pausable_changed, p_mi );
91 var_DelCallback( p_input_thread, "intf-change", input_position_changed, p_mi );
92 var_DelCallback( p_input_thread, "intf-change", input_time_changed, p_mi );
94 /* We owned this one */
95 input_StopThread( p_input_thread );
97 var_Destroy( p_input_thread, "drawable" );
100 vlc_object_release( p_input_thread );
102 p_mi->p_input_thread = NULL;
106 * Retrieve the input thread. Be sure to release the object
107 * once you are done with it. (libvlc Internal)
109 * Object lock is held.
111 input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
112 libvlc_exception_t *p_e )
114 input_thread_t *p_input_thread;
116 if( !p_mi ) RAISENULL( "Media Instance is NULL" );
118 vlc_mutex_lock( &p_mi->object_lock );
120 if( !p_mi->p_input_thread )
122 vlc_mutex_unlock( &p_mi->object_lock );
123 RAISENULL( "Input is NULL" );
126 p_input_thread = p_mi->p_input_thread;
127 vlc_object_yield( p_input_thread );
129 vlc_mutex_unlock( &p_mi->object_lock );
131 return p_input_thread;
135 * input_state_changed (Private) (input var "state" Callback)
138 input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
139 vlc_value_t oldval, vlc_value_t newval,
145 libvlc_media_player_t * p_mi = p_userdata;
146 libvlc_event_t event;
147 libvlc_event_type_t type = newval.i_int;
152 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
153 event.type = libvlc_MediaPlayerEndReached;
156 libvlc_media_set_state( p_mi->p_md, libvlc_Playing, NULL);
157 event.type = libvlc_MediaPlayerPaused;
160 libvlc_media_set_state( p_mi->p_md, libvlc_Playing, NULL);
161 event.type = libvlc_MediaPlayerPlayed;
164 libvlc_media_set_state( p_mi->p_md, libvlc_Error, NULL);
165 event.type = libvlc_MediaPlayerEncounteredError;
171 libvlc_event_send( p_mi->p_event_manager, &event );
176 input_seekable_changed( vlc_object_t * p_this, char const * psz_cmd,
177 vlc_value_t oldval, vlc_value_t newval,
183 libvlc_media_player_t * p_mi = p_userdata;
184 libvlc_event_t event;
186 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
187 event.type = libvlc_MediaPlayerSeekableChanged;
188 event.u.media_player_seekable_changed.new_seekable = newval.b_bool;
190 libvlc_event_send( p_mi->p_event_manager, &event );
195 input_pausable_changed( vlc_object_t * p_this, char const * psz_cmd,
196 vlc_value_t oldval, vlc_value_t newval,
202 libvlc_media_player_t * p_mi = p_userdata;
203 libvlc_event_t event;
205 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
206 event.type = libvlc_MediaPlayerPausableChanged;
207 event.u.media_player_pausable_changed.new_pausable = newval.b_bool;
209 libvlc_event_send( p_mi->p_event_manager, &event );
214 * input_position_changed (Private) (input var "intf-change" Callback)
217 input_position_changed( vlc_object_t * p_this, char const * psz_cmd,
218 vlc_value_t oldval, vlc_value_t newval,
222 libvlc_media_player_t * p_mi = p_userdata;
225 if (!strncmp(psz_cmd, "intf", 4 /* "-change" no need to go further */))
227 input_thread_t * p_input = (input_thread_t *)p_this;
229 var_Get( p_input, "state", &val );
230 if( val.i_int != PLAYING_S )
231 return VLC_SUCCESS; /* Don't send the position while stopped */
233 var_Get( p_input, "position", &val );
236 val.i_time = newval.i_time;
238 libvlc_event_t event;
239 event.type = libvlc_MediaPlayerPositionChanged;
240 event.u.media_player_position_changed.new_position = val.f_float;
242 libvlc_event_send( p_mi->p_event_manager, &event );
247 * input_time_changed (Private) (input var "intf-change" Callback)
250 input_time_changed( vlc_object_t * p_this, char const * psz_cmd,
251 vlc_value_t oldval, vlc_value_t newval,
255 libvlc_media_player_t * p_mi = p_userdata;
258 if (!strncmp(psz_cmd, "intf", 4 /* "-change" no need to go further */))
260 input_thread_t * p_input = (input_thread_t *)p_this;
262 var_Get( p_input, "state", &val );
263 if( val.i_int != PLAYING_S )
264 return VLC_SUCCESS; /* Don't send the position while stopped */
266 var_Get( p_input, "time", &val );
269 val.i_time = newval.i_time;
271 libvlc_event_t event;
272 event.type = libvlc_MediaPlayerTimeChanged;
273 event.u.media_player_time_changed.new_time = val.i_time;
274 libvlc_event_send( p_mi->p_event_manager, &event );
278 /**************************************************************************
279 * Create a Media Instance object
280 **************************************************************************/
281 libvlc_media_player_t *
282 libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
283 libvlc_exception_t * p_e )
285 libvlc_media_player_t * p_mi;
287 if( !p_libvlc_instance )
289 libvlc_exception_raise( p_e, "invalid libvlc instance" );
293 p_mi = malloc( sizeof(libvlc_media_player_t) );
296 libvlc_exception_raise( p_e, "Not enough memory" );
301 p_mi->p_libvlc_instance = p_libvlc_instance;
302 p_mi->p_input_thread = NULL;
303 /* refcount strategy:
304 * - All items created by _new start with a refcount set to 1
305 * - Accessor _release decrease the refcount by 1, if after that
306 * operation the refcount is 0, the object is destroyed.
307 * - Accessor _retain increase the refcount by 1 (XXX: to implement) */
308 p_mi->i_refcount = 1;
309 p_mi->b_own_its_input_thread = true;
310 /* object_lock strategy:
311 * - No lock held in constructor
312 * - Lock when accessing all variable this lock is held
313 * - Lock when attempting to destroy the object the lock is also held */
314 vlc_mutex_init( &p_mi->object_lock );
315 p_mi->p_event_manager = libvlc_event_manager_new( p_mi,
316 p_libvlc_instance, p_e );
317 if( libvlc_exception_raised( p_e ) )
323 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
324 libvlc_MediaPlayerEndReached, p_e );
325 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
326 libvlc_MediaPlayerStopped, p_e );
327 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
328 libvlc_MediaPlayerEncounteredError, p_e );
329 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
330 libvlc_MediaPlayerPaused, p_e );
331 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
332 libvlc_MediaPlayerPlayed, p_e );
333 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
334 libvlc_MediaPlayerPositionChanged, p_e );
335 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
336 libvlc_MediaPlayerTimeChanged, p_e );
337 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
338 libvlc_MediaPlayerSeekableChanged, p_e );
339 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
340 libvlc_MediaPlayerPausableChanged, p_e );
345 /**************************************************************************
346 * Create a Media Instance object with a media descriptor
347 **************************************************************************/
348 libvlc_media_player_t *
349 libvlc_media_player_new_from_media(
350 libvlc_media_t * p_md,
351 libvlc_exception_t *p_e )
353 libvlc_media_player_t * p_mi;
354 p_mi = libvlc_media_player_new( p_md->p_libvlc_instance, p_e );
359 libvlc_media_retain( p_md );
365 /**************************************************************************
366 * Create a new media instance object from an input_thread (Libvlc Internal)
367 **************************************************************************/
368 libvlc_media_player_t * libvlc_media_player_new_from_input_thread(
369 struct libvlc_instance_t *p_libvlc_instance,
370 input_thread_t *p_input,
371 libvlc_exception_t *p_e )
373 libvlc_media_player_t * p_mi;
377 libvlc_exception_raise( p_e, "invalid input thread" );
381 p_mi = libvlc_media_player_new( p_libvlc_instance, p_e );
386 p_mi->p_md = libvlc_media_new_from_input_item(
388 input_GetItem( p_input ), p_e );
392 libvlc_media_player_destroy( p_mi );
396 /* will be released in media_player_release() */
397 vlc_object_yield( p_input );
399 p_mi->p_input_thread = p_input;
400 p_mi->b_own_its_input_thread = false;
405 /**************************************************************************
406 * Destroy a Media Instance object (libvlc internal)
408 * Warning: No lock held here, but hey, this is internal.
409 **************************************************************************/
410 void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
412 input_thread_t *p_input_thread;
413 libvlc_exception_t p_e;
415 libvlc_exception_init( &p_e );
420 p_input_thread = libvlc_get_input_thread( p_mi, &p_e );
422 if( libvlc_exception_raised( &p_e ) )
424 libvlc_event_manager_release( p_mi->p_event_manager );
425 libvlc_exception_clear( &p_e );
427 return; /* no need to worry about no input thread */
429 vlc_mutex_destroy( &p_mi->object_lock );
431 vlc_object_release( p_input_thread );
433 libvlc_media_release( p_mi->p_md );
438 /**************************************************************************
439 * Release a Media Instance object
440 **************************************************************************/
441 void libvlc_media_player_release( libvlc_media_player_t *p_mi )
446 vlc_mutex_lock( &p_mi->object_lock );
450 if( p_mi->i_refcount > 0 )
452 vlc_mutex_unlock( &p_mi->object_lock );
455 vlc_mutex_unlock( &p_mi->object_lock );
456 vlc_mutex_destroy( &p_mi->object_lock );
458 release_input_thread( p_mi );
460 libvlc_event_manager_release( p_mi->p_event_manager );
462 libvlc_media_release( p_mi->p_md );
467 /**************************************************************************
468 * Retain a Media Instance object
469 **************************************************************************/
470 void libvlc_media_player_retain( libvlc_media_player_t *p_mi )
478 /**************************************************************************
479 * Set the Media descriptor associated with the instance
480 **************************************************************************/
481 void libvlc_media_player_set_media(
482 libvlc_media_player_t *p_mi,
483 libvlc_media_t *p_md,
484 libvlc_exception_t *p_e )
491 vlc_mutex_lock( &p_mi->object_lock );
493 release_input_thread( p_mi );
496 libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, p_e );
498 libvlc_media_release( p_mi->p_md );
503 vlc_mutex_unlock( &p_mi->object_lock );
504 return; /* It is ok to pass a NULL md */
507 libvlc_media_retain( p_md );
510 /* The policy here is to ignore that we were created using a different
511 * libvlc_instance, because we don't really care */
512 p_mi->p_libvlc_instance = p_md->p_libvlc_instance;
514 vlc_mutex_unlock( &p_mi->object_lock );
517 /**************************************************************************
518 * Get the Media descriptor associated with the instance
519 **************************************************************************/
521 libvlc_media_player_get_media(
522 libvlc_media_player_t *p_mi,
523 libvlc_exception_t *p_e )
530 libvlc_media_retain( p_mi->p_md );
534 /**************************************************************************
535 * Get the event Manager
536 **************************************************************************/
537 libvlc_event_manager_t *
538 libvlc_media_player_event_manager(
539 libvlc_media_player_t *p_mi,
540 libvlc_exception_t *p_e )
544 return p_mi->p_event_manager;
547 /**************************************************************************
549 **************************************************************************/
550 void libvlc_media_player_play( libvlc_media_player_t *p_mi,
551 libvlc_exception_t *p_e )
553 input_thread_t * p_input_thread;
555 if( (p_input_thread = libvlc_get_input_thread( p_mi, p_e )) )
557 /* A thread already exists, send it a play message */
558 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
559 vlc_object_release( p_input_thread );
563 /* Ignore previous exception */
564 libvlc_exception_clear( p_e );
566 vlc_mutex_lock( &p_mi->object_lock );
570 libvlc_exception_raise( p_e, "no associated media descriptor" );
571 vlc_mutex_unlock( &p_mi->object_lock );
575 p_mi->p_input_thread = input_CreateThread( p_mi->p_libvlc_instance->p_libvlc_int,
576 p_mi->p_md->p_input_item );
579 if( !p_mi->p_input_thread )
581 vlc_mutex_unlock( &p_mi->object_lock );
585 p_input_thread = p_mi->p_input_thread;
590 val.i_int = p_mi->drawable;
591 var_Create( p_input_thread, "drawable", VLC_VAR_DOINHERIT );
592 var_Set( p_input_thread, "drawable", val );
594 var_AddCallback( p_input_thread, "state", input_state_changed, p_mi );
595 var_AddCallback( p_input_thread, "seekable", input_seekable_changed, p_mi );
596 var_AddCallback( p_input_thread, "pausable", input_pausable_changed, p_mi );
597 var_AddCallback( p_input_thread, "intf-change", input_position_changed, p_mi );
598 var_AddCallback( p_input_thread, "intf-change", input_time_changed, p_mi );
600 vlc_mutex_unlock( &p_mi->object_lock );
603 /**************************************************************************
605 **************************************************************************/
606 void libvlc_media_player_pause( libvlc_media_player_t *p_mi,
607 libvlc_exception_t *p_e )
609 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
611 if( !p_input_thread )
614 libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
616 if( state == libvlc_Playing )
618 if( libvlc_media_player_can_pause( p_mi, p_e ) )
619 input_Control( p_input_thread, INPUT_SET_STATE, PAUSE_S );
621 libvlc_media_player_stop( p_mi, p_e );
624 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
626 vlc_object_release( p_input_thread );
629 /**************************************************************************
631 **************************************************************************/
632 void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
633 libvlc_exception_t *p_e )
635 libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
637 if( state == libvlc_Playing || state == libvlc_Paused )
639 /* Send a stop notification event only of we are in playing or paused states */
641 libvlc_media_set_state( p_mi->p_md, libvlc_Stopped, p_e );
643 /* Construct and send the event */
644 libvlc_event_t event;
645 event.type = libvlc_MediaPlayerStopped;
646 libvlc_event_send( p_mi->p_event_manager, &event );
649 if( p_mi->b_own_its_input_thread )
651 vlc_mutex_lock( &p_mi->object_lock );
652 release_input_thread( p_mi ); /* This will stop the input thread */
653 vlc_mutex_unlock( &p_mi->object_lock );
657 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
659 if( !p_input_thread )
662 input_StopThread( p_input_thread );
663 vlc_object_release( p_input_thread );
667 /**************************************************************************
669 **************************************************************************/
670 void libvlc_media_player_set_drawable( libvlc_media_player_t *p_mi,
671 libvlc_drawable_t drawable,
672 libvlc_exception_t *p_e )
675 p_mi->drawable = drawable;
678 /**************************************************************************
680 **************************************************************************/
682 libvlc_media_player_get_drawable ( libvlc_media_player_t *p_mi, libvlc_exception_t *p_e )
685 return p_mi->drawable;
688 /**************************************************************************
689 * Getters for stream information
690 **************************************************************************/
691 libvlc_time_t libvlc_media_player_get_length(
692 libvlc_media_player_t *p_mi,
693 libvlc_exception_t *p_e )
695 input_thread_t *p_input_thread;
698 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
699 if( !p_input_thread )
702 var_Get( p_input_thread, "length", &val );
703 vlc_object_release( p_input_thread );
705 return (val.i_time+500LL)/1000LL;
708 libvlc_time_t libvlc_media_player_get_time(
709 libvlc_media_player_t *p_mi,
710 libvlc_exception_t *p_e )
712 input_thread_t *p_input_thread;
715 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
716 if( !p_input_thread )
719 var_Get( p_input_thread , "time", &val );
720 vlc_object_release( p_input_thread );
721 return (val.i_time+500LL)/1000LL;
724 void libvlc_media_player_set_time(
725 libvlc_media_player_t *p_mi,
727 libvlc_exception_t *p_e )
729 input_thread_t *p_input_thread;
732 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
733 if( !p_input_thread )
736 value.i_time = time*1000LL;
737 var_Set( p_input_thread, "time", value );
738 vlc_object_release( p_input_thread );
741 void libvlc_media_player_set_position(
742 libvlc_media_player_t *p_mi,
744 libvlc_exception_t *p_e )
746 input_thread_t *p_input_thread;
748 val.f_float = position;
750 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
751 if( !p_input_thread )
754 var_Set( p_input_thread, "position", val );
755 vlc_object_release( p_input_thread );
758 float libvlc_media_player_get_position(
759 libvlc_media_player_t *p_mi,
760 libvlc_exception_t *p_e )
762 input_thread_t *p_input_thread;
765 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
766 if( !p_input_thread )
769 var_Get( p_input_thread, "position", &val );
770 vlc_object_release( p_input_thread );
775 void libvlc_media_player_set_chapter(
776 libvlc_media_player_t *p_mi,
778 libvlc_exception_t *p_e )
780 input_thread_t *p_input_thread;
784 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
785 if( !p_input_thread )
788 var_Set( p_input_thread, "chapter", val );
789 vlc_object_release( p_input_thread );
792 int libvlc_media_player_get_chapter(
793 libvlc_media_player_t *p_mi,
794 libvlc_exception_t *p_e )
796 input_thread_t *p_input_thread;
799 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
800 if( !p_input_thread )
803 var_Get( p_input_thread, "chapter", &val );
804 vlc_object_release( p_input_thread );
809 int libvlc_media_player_get_chapter_count(
810 libvlc_media_player_t *p_mi,
811 libvlc_exception_t *p_e )
813 input_thread_t *p_input_thread;
816 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
817 if( !p_input_thread )
820 var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
821 vlc_object_release( p_input_thread );
826 float libvlc_media_player_get_fps(
827 libvlc_media_player_t *p_mi,
828 libvlc_exception_t *p_e)
830 input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
835 if( input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps ) )
837 vlc_object_release( p_input_thread );
842 int libvlc_media_player_will_play( libvlc_media_player_t *p_mi,
843 libvlc_exception_t *p_e)
845 input_thread_t *p_input_thread =
846 libvlc_get_input_thread ( p_mi, p_e);
847 if ( !p_input_thread )
850 if ( !p_input_thread->b_die && !p_input_thread->b_dead )
852 vlc_object_release( p_input_thread );
855 vlc_object_release( p_input_thread );
859 void libvlc_media_player_set_rate(
860 libvlc_media_player_t *p_mi,
862 libvlc_exception_t *p_e )
864 input_thread_t *p_input_thread;
868 RAISEVOID( "Rate value is invalid" );
870 val.i_int = 1000.0f/rate;
872 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
873 if ( !p_input_thread )
876 var_Set( p_input_thread, "rate", val );
877 vlc_object_release( p_input_thread );
880 float libvlc_media_player_get_rate(
881 libvlc_media_player_t *p_mi,
882 libvlc_exception_t *p_e )
884 input_thread_t *p_input_thread;
887 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
888 if ( !p_input_thread )
891 var_Get( p_input_thread, "rate", &val );
892 vlc_object_release( p_input_thread );
894 return (float)1000.0f/val.i_int;
897 libvlc_state_t libvlc_media_player_get_state(
898 libvlc_media_player_t *p_mi,
899 libvlc_exception_t *p_e )
901 input_thread_t *p_input_thread;
904 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
905 if ( !p_input_thread )
907 /* We do return the right value, no need to throw an exception */
908 if( libvlc_exception_raised( p_e ) )
909 libvlc_exception_clear( p_e );
910 return libvlc_Stopped;
913 var_Get( p_input_thread, "state", &val );
914 vlc_object_release( p_input_thread );
916 return vlc_to_libvlc_state(val.i_int);
919 int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi,
920 libvlc_exception_t *p_e )
922 input_thread_t *p_input_thread;
925 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
926 if ( !p_input_thread )
928 /* We do return the right value, no need to throw an exception */
929 if( libvlc_exception_raised( p_e ) )
930 libvlc_exception_clear( p_e );
933 var_Get( p_input_thread, "seekable", &val );
934 vlc_object_release( p_input_thread );
939 int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi,
940 libvlc_exception_t *p_e )
942 input_thread_t *p_input_thread;
945 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
946 if ( !p_input_thread )
948 /* We do return the right value, no need to throw an exception */
949 if( libvlc_exception_raised( p_e ) )
950 libvlc_exception_clear( p_e );
953 var_Get( p_input_thread, "can-pause", &val );
954 vlc_object_release( p_input_thread );