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_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_instance_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_instance_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_instance_t * p_mi = p_userdata;
145 libvlc_event_t event;
146 libvlc_event_type_t type = newval.i_int;
151 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
152 event.type = libvlc_MediaInstanceReachedEnd;
155 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_Playing, NULL);
156 event.type = libvlc_MediaInstancePaused;
159 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_Playing, NULL);
160 event.type = libvlc_MediaInstancePlayed;
163 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_Error, NULL);
164 event.type = libvlc_MediaInstanceEncounteredError;
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_instance_t * p_mi = p_userdata;
183 libvlc_event_t event;
185 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
186 event.type = libvlc_MediaInstanceSeekableChanged;
187 event.u.media_instance_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_instance_t * p_mi = p_userdata;
202 libvlc_event_t event;
204 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
205 event.type = libvlc_MediaInstancePausableChanged;
206 event.u.media_instance_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_instance_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_MediaInstancePositionChanged;
239 event.u.media_instance_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_instance_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_MediaInstanceTimeChanged;
272 event.u.media_instance_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_instance_t *
281 libvlc_media_instance_new( libvlc_instance_t * p_libvlc_instance,
282 libvlc_exception_t * p_e )
284 libvlc_media_instance_t * p_mi;
286 if( !p_libvlc_instance )
288 libvlc_exception_raise( p_e, "invalid libvlc instance" );
292 p_mi = malloc( sizeof(libvlc_media_instance_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 = VLC_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->p_libvlc_instance->p_libvlc_int,
309 &p_mi->object_lock );
310 p_mi->p_event_manager = libvlc_event_manager_new( p_mi,
311 p_libvlc_instance, p_e );
312 if( libvlc_exception_raised( p_e ) )
318 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
319 libvlc_MediaInstanceReachedEnd, p_e );
320 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
321 libvlc_MediaInstanceEncounteredError, p_e );
322 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
323 libvlc_MediaInstancePaused, p_e );
324 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
325 libvlc_MediaInstancePlayed, p_e );
326 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
327 libvlc_MediaInstancePositionChanged, p_e );
328 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
329 libvlc_MediaInstanceTimeChanged, p_e );
330 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
331 libvlc_MediaInstanceSeekableChanged, p_e );
332 libvlc_event_manager_register_event_type( p_mi->p_event_manager,
333 libvlc_MediaInstancePausableChanged, p_e );
338 /**************************************************************************
339 * Create a Media Instance object with a media descriptor
340 **************************************************************************/
341 libvlc_media_instance_t *
342 libvlc_media_instance_new_from_media_descriptor(
343 libvlc_media_descriptor_t * p_md,
344 libvlc_exception_t *p_e )
346 libvlc_media_instance_t * p_mi;
347 p_mi = libvlc_media_instance_new( p_md->p_libvlc_instance, p_e );
352 libvlc_media_descriptor_retain( p_md );
358 /**************************************************************************
359 * Create a new media instance object from an input_thread (Libvlc Internal)
360 **************************************************************************/
361 libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread(
362 struct libvlc_instance_t *p_libvlc_instance,
363 input_thread_t *p_input,
364 libvlc_exception_t *p_e )
366 libvlc_media_instance_t * p_mi;
370 libvlc_exception_raise( p_e, "invalid input thread" );
374 p_mi = libvlc_media_instance_new( p_libvlc_instance, p_e );
379 p_mi->p_md = libvlc_media_descriptor_new_from_input_item(
381 input_GetItem( p_input ), p_e );
385 libvlc_media_instance_destroy( p_mi );
389 /* will be released in media_instance_release() */
390 vlc_object_yield( p_input );
392 p_mi->p_input_thread = p_input;
393 p_mi->b_own_its_input_thread = VLC_FALSE;
398 /**************************************************************************
399 * Destroy a Media Instance object (libvlc internal)
401 * Warning: No lock held here, but hey, this is internal.
402 **************************************************************************/
403 void libvlc_media_instance_destroy( libvlc_media_instance_t *p_mi )
405 input_thread_t *p_input_thread;
406 libvlc_exception_t p_e;
408 libvlc_exception_init( &p_e );
413 p_input_thread = libvlc_get_input_thread( p_mi, &p_e );
415 if( libvlc_exception_raised( &p_e ) )
417 libvlc_event_manager_release( p_mi->p_event_manager );
418 libvlc_exception_clear( &p_e );
420 return; /* no need to worry about no input thread */
422 vlc_mutex_destroy( &p_mi->object_lock );
424 vlc_object_release( p_input_thread );
426 libvlc_media_descriptor_release( p_mi->p_md );
431 /**************************************************************************
432 * Release a Media Instance object
433 **************************************************************************/
434 void libvlc_media_instance_release( libvlc_media_instance_t *p_mi )
439 vlc_mutex_lock( &p_mi->object_lock );
443 if( p_mi->i_refcount > 0 )
445 vlc_mutex_unlock( &p_mi->object_lock );
448 vlc_mutex_unlock( &p_mi->object_lock );
449 vlc_mutex_destroy( &p_mi->object_lock );
451 release_input_thread( p_mi );
453 libvlc_event_manager_release( p_mi->p_event_manager );
455 libvlc_media_descriptor_release( p_mi->p_md );
460 /**************************************************************************
461 * Retain a Media Instance object
462 **************************************************************************/
463 void libvlc_media_instance_retain( libvlc_media_instance_t *p_mi )
471 /**************************************************************************
472 * Set the Media descriptor associated with the instance
473 **************************************************************************/
474 void libvlc_media_instance_set_media_descriptor(
475 libvlc_media_instance_t *p_mi,
476 libvlc_media_descriptor_t *p_md,
477 libvlc_exception_t *p_e )
484 vlc_mutex_lock( &p_mi->object_lock );
486 release_input_thread( p_mi );
489 libvlc_media_descriptor_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL );
491 libvlc_media_descriptor_release( p_mi->p_md );
496 vlc_mutex_unlock( &p_mi->object_lock );
497 return; /* It is ok to pass a NULL md */
500 libvlc_media_descriptor_retain( p_md );
503 /* The policy here is to ignore that we were created using a different
504 * libvlc_instance, because we don't really care */
505 p_mi->p_libvlc_instance = p_md->p_libvlc_instance;
507 vlc_mutex_unlock( &p_mi->object_lock );
510 /**************************************************************************
511 * Get the Media descriptor associated with the instance
512 **************************************************************************/
513 libvlc_media_descriptor_t *
514 libvlc_media_instance_get_media_descriptor(
515 libvlc_media_instance_t *p_mi,
516 libvlc_exception_t *p_e )
523 libvlc_media_descriptor_retain( p_mi->p_md );
527 /**************************************************************************
528 * Get the event Manager
529 **************************************************************************/
530 libvlc_event_manager_t *
531 libvlc_media_instance_event_manager(
532 libvlc_media_instance_t *p_mi,
533 libvlc_exception_t *p_e )
537 return p_mi->p_event_manager;
540 /**************************************************************************
542 **************************************************************************/
543 void libvlc_media_instance_play( libvlc_media_instance_t *p_mi,
544 libvlc_exception_t *p_e )
546 input_thread_t * p_input_thread;
548 if( (p_input_thread = libvlc_get_input_thread( p_mi, p_e )) )
550 /* A thread already exists, send it a play message */
551 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
552 vlc_object_release( p_input_thread );
556 /* Ignore previous exception */
557 libvlc_exception_clear( p_e );
559 vlc_mutex_lock( &p_mi->object_lock );
563 libvlc_exception_raise( p_e, "no associated media descriptor" );
564 vlc_mutex_unlock( &p_mi->object_lock );
568 int i_input_id = input_Read( p_mi->p_libvlc_instance->p_libvlc_int,
569 p_mi->p_md->p_input_item, VLC_FALSE );
571 /* Released in input_release */
572 p_mi->p_input_thread = (input_thread_t*)vlc_object_get( i_input_id );
574 if( !p_mi->p_input_thread )
577 vlc_mutex_unlock( &p_mi->object_lock );
580 p_input_thread = p_mi->p_input_thread;
585 val.i_int = p_mi->drawable;
586 var_Create( p_input_thread, "drawable", VLC_VAR_DOINHERIT );
587 var_Set( p_input_thread, "drawable", val );
589 var_AddCallback( p_input_thread, "state", input_state_changed, p_mi );
590 var_AddCallback( p_input_thread, "seekable", input_seekable_changed, p_mi );
591 var_AddCallback( p_input_thread, "pausable", input_pausable_changed, p_mi );
592 var_AddCallback( p_input_thread, "intf-change", input_position_changed, p_mi );
593 var_AddCallback( p_input_thread, "intf-change", input_time_changed, p_mi );
595 vlc_mutex_unlock( &p_mi->object_lock );
598 /**************************************************************************
600 **************************************************************************/
601 void libvlc_media_instance_pause( libvlc_media_instance_t *p_mi,
602 libvlc_exception_t *p_e )
604 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
606 if( !p_input_thread )
609 int state = var_GetInteger( p_input_thread, "state" );
611 if( state == PLAYING_S )
613 if( libvlc_media_instance_can_pause( p_mi, p_e ) )
614 input_Control( p_input_thread, INPUT_SET_STATE, PAUSE_S );
616 libvlc_media_instance_stop( p_mi, p_e );
619 input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
621 vlc_object_release( p_input_thread );
624 /**************************************************************************
626 **************************************************************************/
627 void libvlc_media_instance_stop( libvlc_media_instance_t *p_mi,
628 libvlc_exception_t *p_e )
630 if( p_mi->b_own_its_input_thread )
631 release_input_thread( p_mi ); /* This will stop the input thread */
634 input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
636 if( !p_input_thread )
639 input_StopThread( p_input_thread );
640 vlc_object_release( p_input_thread );
644 /**************************************************************************
646 **************************************************************************/
647 void libvlc_media_instance_set_drawable( libvlc_media_instance_t *p_mi,
648 libvlc_drawable_t drawable,
649 libvlc_exception_t *p_e )
652 p_mi->drawable = drawable;
655 /**************************************************************************
657 **************************************************************************/
659 libvlc_media_instance_get_drawable ( libvlc_media_instance_t *p_mi, libvlc_exception_t *p_e )
662 return p_mi->drawable;
665 /**************************************************************************
666 * Getters for stream information
667 **************************************************************************/
668 libvlc_time_t libvlc_media_instance_get_length(
669 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 var_Get( p_input_thread, "length", &val );
680 vlc_object_release( p_input_thread );
682 return (val.i_time+500LL)/1000LL;
685 libvlc_time_t libvlc_media_instance_get_time(
686 libvlc_media_instance_t *p_mi,
687 libvlc_exception_t *p_e )
689 input_thread_t *p_input_thread;
692 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
693 if( !p_input_thread )
696 var_Get( p_input_thread , "time", &val );
697 vlc_object_release( p_input_thread );
698 return (val.i_time+500LL)/1000LL;
701 void libvlc_media_instance_set_time(
702 libvlc_media_instance_t *p_mi,
704 libvlc_exception_t *p_e )
706 input_thread_t *p_input_thread;
709 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
710 if( !p_input_thread )
713 value.i_time = time*1000LL;
714 var_Set( p_input_thread, "time", value );
715 vlc_object_release( p_input_thread );
718 void libvlc_media_instance_set_position(
719 libvlc_media_instance_t *p_mi,
721 libvlc_exception_t *p_e )
723 input_thread_t *p_input_thread;
725 val.f_float = position;
727 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
728 if( !p_input_thread )
731 var_Set( p_input_thread, "position", val );
732 vlc_object_release( p_input_thread );
735 float libvlc_media_instance_get_position(
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, "position", &val );
747 vlc_object_release( p_input_thread );
752 void libvlc_media_instance_set_chapter(
753 libvlc_media_instance_t *p_mi,
755 libvlc_exception_t *p_e )
757 input_thread_t *p_input_thread;
761 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
762 if( !p_input_thread )
765 var_Set( p_input_thread, "chapter", val );
766 vlc_object_release( p_input_thread );
769 int libvlc_media_instance_get_chapter(
770 libvlc_media_instance_t *p_mi,
771 libvlc_exception_t *p_e )
773 input_thread_t *p_input_thread;
776 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
777 if( !p_input_thread )
780 var_Get( p_input_thread, "chapter", &val );
781 vlc_object_release( p_input_thread );
786 int libvlc_media_instance_get_chapter_count(
787 libvlc_media_instance_t *p_mi,
788 libvlc_exception_t *p_e )
790 input_thread_t *p_input_thread;
793 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
794 if( !p_input_thread )
797 var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
798 vlc_object_release( p_input_thread );
803 float libvlc_media_instance_get_fps(
804 libvlc_media_instance_t *p_mi,
805 libvlc_exception_t *p_e)
807 input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
812 if( input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps ) )
814 vlc_object_release( p_input_thread );
819 int libvlc_media_instance_will_play( libvlc_media_instance_t *p_mi,
820 libvlc_exception_t *p_e)
822 input_thread_t *p_input_thread =
823 libvlc_get_input_thread ( p_mi, p_e);
824 if ( !p_input_thread )
827 if ( !p_input_thread->b_die && !p_input_thread->b_dead )
829 vlc_object_release( p_input_thread );
832 vlc_object_release( p_input_thread );
836 void libvlc_media_instance_set_rate(
837 libvlc_media_instance_t *p_mi,
839 libvlc_exception_t *p_e )
841 input_thread_t *p_input_thread;
845 RAISEVOID( "Rate value is invalid" );
847 val.i_int = 1000.0f/rate;
849 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
850 if ( !p_input_thread )
853 var_Set( p_input_thread, "rate", val );
854 vlc_object_release( p_input_thread );
857 float libvlc_media_instance_get_rate(
858 libvlc_media_instance_t *p_mi,
859 libvlc_exception_t *p_e )
861 input_thread_t *p_input_thread;
864 p_input_thread = libvlc_get_input_thread ( p_mi, p_e);
865 if ( !p_input_thread )
868 var_Get( p_input_thread, "rate", &val );
869 vlc_object_release( p_input_thread );
871 return (float)1000.0f/val.i_int;
874 libvlc_state_t libvlc_media_instance_get_state(
875 libvlc_media_instance_t *p_mi,
876 libvlc_exception_t *p_e )
878 input_thread_t *p_input_thread;
881 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
882 if ( !p_input_thread )
884 /* We do return the right value, no need to throw an exception */
885 if( libvlc_exception_raised( p_e ) )
886 libvlc_exception_clear( p_e );
887 return libvlc_Stopped;
890 var_Get( p_input_thread, "state", &val );
891 vlc_object_release( p_input_thread );
893 return vlc_to_libvlc_state(val.i_int);
896 int libvlc_media_instance_is_seekable( libvlc_media_instance_t *p_mi,
897 libvlc_exception_t *p_e )
899 input_thread_t *p_input_thread;
902 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
903 if ( !p_input_thread )
905 /* We do return the right value, no need to throw an exception */
906 if( libvlc_exception_raised( p_e ) )
907 libvlc_exception_clear( p_e );
910 var_Get( p_input_thread, "seekable", &val );
911 vlc_object_release( p_input_thread );
916 int libvlc_media_instance_can_pause( libvlc_media_instance_t *p_mi,
917 libvlc_exception_t *p_e )
919 input_thread_t *p_input_thread;
922 p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
923 if ( !p_input_thread )
925 /* We do return the right value, no need to throw an exception */
926 if( libvlc_exception_raised( p_e ) )
927 libvlc_exception_clear( p_e );
930 var_Get( p_input_thread, "can-pause", &val );
931 vlc_object_release( p_input_thread );