Changeset 34f81612d956bfc7ad53fb7937b7d38d9cdec730
- Timestamp:
- 17/06/07 22:54:32 (1 year ago)
- git-parent:
- Files:
-
- include/vlc/libvlc.h (modified) (20 diffs)
- include/vlc/libvlc_structures.h (modified) (1 diff)
- src/control/audio.c (modified) (3 diffs)
- src/control/event.c (modified) (1 diff)
- src/control/input.c (modified) (16 diffs)
- src/control/libvlc_internal.h (modified) (3 diffs)
- src/control/media_descriptor.c (modified) (2 diffs)
- src/control/mediacontrol_audio_video.c (modified) (6 diffs)
- src/control/mediacontrol_core.c (modified) (7 diffs)
- src/control/playlist.c (modified) (1 diff)
- src/control/video.c (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc/libvlc.h
r39793dd r34f8161 287 287 libvlc_exception_t * ); 288 288 289 typedef struct libvlc_input_t libvlc_input_t;290 291 289 /* Get the input that is currently being played by the playlist 292 290 * \param p_instance the instance to use … … 294 292 * \return an input object 295 293 */ 296 VLC_PUBLIC_API libvlc_ input_t *libvlc_playlist_get_input( libvlc_instance_t *,297 libvlc_exception_t * );294 VLC_PUBLIC_API libvlc_media_instance_t * libvlc_playlist_get_media_instance( 295 libvlc_instance_t *, libvlc_exception_t * ); 298 296 299 297 /** @}*/ 300 298 301 299 /***************************************************************************** 302 * Input300 * Media Instance 303 301 *****************************************************************************/ 304 /** defgroup libvlc_input Input 305 * \ingroup libvlc 306 * LibVLC Input handling 307 * @{ 308 */ 309 310 /** Free an input object 311 * \param p_input the input to free 312 */ 313 VLC_PUBLIC_API void libvlc_input_free( libvlc_input_t * ); 302 /** defgroup libvlc_media_instance Media Instance 303 * \ingroup libvlc 304 * LibVLC Media Instance 305 * @{ 306 */ 307 308 /** Create a Media Instance object from a Media Descriptor 309 * \param p_md the Media Descriptor from which the Media Instance should be 310 * created. The p_md can then be destroyed if needed. 311 */ 312 VLC_PUBLIC_API libvlc_media_instance_t * libvlc_media_instance_new( libvlc_media_descriptor_t * ); 313 314 /** Destroy a Media Instance object 315 * \param p_mi the Media Instance to free 316 */ 317 VLC_PUBLIC_API void libvlc_media_instance_destroy( libvlc_media_instance_t * ); 318 319 VLC_PUBLIC_API void libvlc_media_instance_play ( libvlc_media_instance_t *, libvlc_exception_t * ); 320 VLC_PUBLIC_API void libvlc_media_instance_pause ( libvlc_media_instance_t *, libvlc_exception_t * ); 314 321 315 322 /// \bug This might go away ... to be replaced by a broader system 316 VLC_PUBLIC_API vlc_int64_t libvlc_input_get_length ( libvlc_input_t *, libvlc_exception_t *); 317 VLC_PUBLIC_API vlc_int64_t libvlc_input_get_time ( libvlc_input_t *, libvlc_exception_t *); 318 VLC_PUBLIC_API void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_exception_t *); 319 VLC_PUBLIC_API float libvlc_input_get_position ( libvlc_input_t *, libvlc_exception_t *); 320 VLC_PUBLIC_API void libvlc_input_set_position ( libvlc_input_t *, float, libvlc_exception_t *); 321 VLC_PUBLIC_API vlc_bool_t libvlc_input_will_play ( libvlc_input_t *, libvlc_exception_t *); 322 VLC_PUBLIC_API float libvlc_input_get_rate ( libvlc_input_t *, libvlc_exception_t *); 323 VLC_PUBLIC_API void libvlc_input_set_rate ( libvlc_input_t *, float, libvlc_exception_t *); 324 VLC_PUBLIC_API int libvlc_input_get_state ( libvlc_input_t *, libvlc_exception_t *); 323 VLC_PUBLIC_API vlc_int64_t libvlc_media_instance_get_length ( libvlc_media_instance_t *, libvlc_exception_t *); 324 VLC_PUBLIC_API vlc_int64_t libvlc_media_instance_get_time ( libvlc_media_instance_t *, libvlc_exception_t *); 325 VLC_PUBLIC_API void libvlc_media_instance_set_time ( libvlc_media_instance_t *, vlc_int64_t, libvlc_exception_t *); 326 VLC_PUBLIC_API float libvlc_media_instance_get_position ( libvlc_media_instance_t *, libvlc_exception_t *); 327 VLC_PUBLIC_API void libvlc_media_instance_set_position ( libvlc_media_instance_t *, float, libvlc_exception_t *); 328 VLC_PUBLIC_API vlc_bool_t libvlc_media_instance_will_play ( libvlc_media_instance_t *, libvlc_exception_t *); 329 VLC_PUBLIC_API float libvlc_media_instance_get_rate ( libvlc_media_instance_t *, libvlc_exception_t *); 330 VLC_PUBLIC_API void libvlc_media_instance_set_rate ( libvlc_media_instance_t *, float, libvlc_exception_t *); 331 VLC_PUBLIC_API int libvlc_media_instance_get_state ( libvlc_media_instance_t *, libvlc_exception_t *); 332 333 /** 334 * Does this input have a video output ? 335 * \param p_input the input 336 * \param p_exception an initialized exception 337 */ 338 VLC_PUBLIC_API vlc_bool_t libvlc_media_instance_has_vout( libvlc_media_instance_t *, libvlc_exception_t *); 339 VLC_PUBLIC_API float libvlc_media_instance_get_fps( libvlc_media_instance_t *, libvlc_exception_t *); 340 325 341 326 342 /** @} */ … … 337 353 * \param p_exception an initialized exception 338 354 */ 339 VLC_PUBLIC_API vlc_bool_t libvlc_input_has_vout( libvlc_ input_t *, libvlc_exception_t *);340 VLC_PUBLIC_API float libvlc_input_get_fps( libvlc_ input_t *, libvlc_exception_t *);355 VLC_PUBLIC_API vlc_bool_t libvlc_input_has_vout( libvlc_media_instance_t *, libvlc_exception_t *); 356 VLC_PUBLIC_API float libvlc_input_get_fps( libvlc_media_instance_t *, libvlc_exception_t *); 341 357 342 358 /** … … 345 361 * \param p_exception an initialized exception 346 362 */ 347 VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_ input_t *, libvlc_exception_t * );363 VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_media_instance_t *, libvlc_exception_t * ); 348 364 349 365 /** … … 353 369 * \param p_exception an initialized exception 354 370 */ 355 VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_ input_t *, int, libvlc_exception_t * );371 VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_media_instance_t *, int, libvlc_exception_t * ); 356 372 357 373 /** … … 361 377 * \return the fullscreen status (boolean) 362 378 */ 363 VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_ input_t *, libvlc_exception_t * );379 VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_media_instance_t *, libvlc_exception_t * ); 364 380 365 381 /** … … 369 385 * \return the video height 370 386 */ 371 VLC_PUBLIC_API int libvlc_video_get_height( libvlc_ input_t *, libvlc_exception_t * );387 VLC_PUBLIC_API int libvlc_video_get_height( libvlc_media_instance_t *, libvlc_exception_t * ); 372 388 373 389 /** … … 377 393 * \return the video width 378 394 */ 379 VLC_PUBLIC_API int libvlc_video_get_width( libvlc_ input_t *, libvlc_exception_t * );395 VLC_PUBLIC_API int libvlc_video_get_width( libvlc_media_instance_t *, libvlc_exception_t * ); 380 396 381 397 /** … … 385 401 * \return the video aspect ratio 386 402 */ 387 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_ input_t *, libvlc_exception_t * );403 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_media_instance_t *, libvlc_exception_t * ); 388 404 389 405 /** … … 393 409 * \param p_exception an initialized exception 394 410 */ 395 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_ input_t *, char *, libvlc_exception_t * );411 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_media_instance_t *, char *, libvlc_exception_t * ); 396 412 397 413 /** … … 401 417 * \return the video subtitle selected 402 418 */ 403 VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_ input_t *, libvlc_exception_t * );419 VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_media_instance_t *, libvlc_exception_t * ); 404 420 405 421 /** … … 409 425 * \param p_exception an initialized exception 410 426 */ 411 VLC_PUBLIC_API void libvlc_video_set_spu( libvlc_ input_t *, int , libvlc_exception_t * );427 VLC_PUBLIC_API void libvlc_video_set_spu( libvlc_media_instance_t *, int , libvlc_exception_t * ); 412 428 413 429 /** … … 417 433 * \return the crop filter geometry 418 434 */ 419 VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_ input_t *, libvlc_exception_t * );435 VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_instance_t *, libvlc_exception_t * ); 420 436 421 437 /** … … 425 441 * \param p_exception an initialized exception 426 442 */ 427 VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_ input_t *, char *, libvlc_exception_t * );443 VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_media_instance_t *, char *, libvlc_exception_t * ); 428 444 429 445 /** … … 433 449 * \param p_exception an initialized exception 434 450 */ 435 VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_ input_t *, char *, libvlc_exception_t * );436 437 VLC_PUBLIC_API int libvlc_video_destroy( libvlc_ input_t *, libvlc_exception_t *);451 VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_media_instance_t *, char *, libvlc_exception_t * ); 452 453 VLC_PUBLIC_API int libvlc_video_destroy( libvlc_media_instance_t *, libvlc_exception_t *); 438 454 439 455 /** … … 445 461 * \return the success status (boolean) 446 462 */ 447 VLC_PUBLIC_API void libvlc_video_resize( libvlc_ input_t *, int, int, libvlc_exception_t *);463 VLC_PUBLIC_API void libvlc_video_resize( libvlc_media_instance_t *, int, int, libvlc_exception_t *); 448 464 449 465 /** … … 454 470 * \return the success status (boolean) 455 471 */ 456 VLC_PUBLIC_API int libvlc_video_reparent( libvlc_ input_t *, libvlc_drawable_t, libvlc_exception_t * );472 VLC_PUBLIC_API int libvlc_video_reparent( libvlc_media_instance_t *, libvlc_drawable_t, libvlc_exception_t * ); 457 473 458 474 /** … … 462 478 * \param p_exception an initialized exception 463 479 */ 464 VLC_PUBLIC_API void libvlc_video_redraw_rectangle( libvlc_ input_t *, const libvlc_rectangle_t *, libvlc_exception_t * );480 VLC_PUBLIC_API void libvlc_video_redraw_rectangle( libvlc_media_instance_t *, const libvlc_rectangle_t *, libvlc_exception_t * ); 465 481 466 482 /** … … 564 580 + * \return the audio track (int) 565 581 + */ 566 VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_ input_t *, libvlc_exception_t * );582 VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_instance_t *, libvlc_exception_t * ); 567 583 568 584 /** … … 572 588 * \param p_exception an initialized exception 573 589 */ 574 VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_ input_t *, int, libvlc_exception_t * );590 VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_media_instance_t *, int, libvlc_exception_t * ); 575 591 576 592 /** include/vlc/libvlc_structures.h
rd1a3355 r34f8161 77 77 78 78 typedef struct libvlc_media_descriptor_t libvlc_media_descriptor_t; 79 80 /**@} */ 81 82 /***************************************************************************** 83 * Media Instance 84 *****************************************************************************/ 85 /** defgroup libvlc_media_instance MediaInstance 86 * \ingroup libvlc 87 * LibVLC Media Instance handling 88 * @{ 89 */ 90 91 typedef struct libvlc_media_instance_t libvlc_media_instance_t; 79 92 80 93 /**@} */ src/control/audio.c
rf3968d6 r34f8161 28 28 #include <vlc_input.h> 29 29 #include <vlc_aout.h> 30 31 /*32 * Remember to release the returned input_thread_t since it is locked at33 * the end of this function.34 */35 static input_thread_t *GetInput( libvlc_input_t *p_input,36 libvlc_exception_t *p_exception )37 {38 input_thread_t *p_input_thread = NULL;39 40 if( !p_input )41 {42 libvlc_exception_raise( p_exception, "Input is NULL" );43 return NULL;44 }45 46 p_input_thread = (input_thread_t*)vlc_object_get(47 p_input->p_instance->p_libvlc_int,48 p_input->i_input_id );49 if( !p_input_thread )50 {51 libvlc_exception_raise( p_exception, "Input does not exist" );52 return NULL;53 }54 55 return p_input_thread;56 }57 30 58 31 /* … … 143 116 * libvlc_audio_get_track : Get the current audio track 144 117 *****************************************************************************/ 145 int libvlc_audio_get_track( libvlc_ input_t *p_input,118 int libvlc_audio_get_track( libvlc_media_instance_t *p_mi, 146 119 libvlc_exception_t *p_e ) 147 120 { 148 input_thread_t *p_input_thread = GetInput( p_input, p_e );121 input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 149 122 vlc_value_t val_list; 150 123 vlc_value_t val; … … 181 154 * libvlc_audio_set_track : Set the current audio track 182 155 *****************************************************************************/ 183 void libvlc_audio_set_track( libvlc_ input_t *p_input, int i_track,156 void libvlc_audio_set_track( libvlc_media_instance_t *p_mi, int i_track, 184 157 libvlc_exception_t *p_e ) 185 158 { 186 input_thread_t *p_input_thread = GetInput( p_input, p_e );159 input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 187 160 vlc_value_t val_list; 188 161 int i_ret = -1; src/control/event.c
r4c401bd r34f8161 91 91 { 92 92 libvlc_exception_t p_e_unused; /* FIXME: error checking here */ 93 libvlc_ input_t * p_libvlc_input = libvlc_playlist_get_input( p_instance, &p_e_unused );93 libvlc_media_instance_t * p_mi; 94 94 input_thread_t * p_input; 95 95 96 if( !p_libvlc_input ) 96 p_mi = libvlc_playlist_get_media_instance( p_instance, &p_e_unused ); 97 98 if( !p_mi ) 97 99 return NULL; 98 99 p_input = libvlc_get_input_thread( p_ libvlc_input, &p_e_unused );100 101 libvlc_ input_free(p_libvlc_input);100 101 p_input = libvlc_get_input_thread( p_mi, &p_e_unused ); 102 103 libvlc_media_instance_destroy( p_mi ); 102 104 103 105 return p_input; src/control/input.c
rff8e2f8 r34f8161 1 1 /***************************************************************************** 2 * input.c: Libvlc new API inputmanagement functions2 * media_instance.c: Libvlc API Media Instance management functions 3 3 ***************************************************************************** 4 4 * Copyright (C) 2005 the VideoLAN team … … 28 28 #include "input/input_internal.h" 29 29 30 void libvlc_input_free( libvlc_input_t *p_input )31 {32 if( p_input ) free( p_input );33 }34 35 30 /* 36 31 * Retrieve the input thread. Be sure to release the object 37 32 * once you are done with it. (libvlc Internal) 38 33 */ 39 input_thread_t *libvlc_get_input_thread( libvlc_ input_t *p_input,34 input_thread_t *libvlc_get_input_thread( libvlc_media_instance_t *p_mi, 40 35 libvlc_exception_t *p_e ) 41 36 { 42 37 input_thread_t *p_input_thread; 43 38 44 if( !p_ input)39 if( !p_mi || p_mi->i_input_id == -1 ) 45 40 RAISENULL( "Input is NULL" ); 46 41 47 42 p_input_thread = (input_thread_t*)vlc_object_get( 48 p_ input->p_instance->p_libvlc_int,49 p_ input->i_input_id );43 p_mi->p_libvlc_instance->p_libvlc_int, 44 p_mi->i_input_id ); 50 45 if( !p_input_thread ) 51 46 RAISENULL( "Input does not exist" ); … … 54 49 } 55 50 51 /************************************************************************** 52 * Create a Media Instance object 53 **************************************************************************/ 54 libvlc_media_instance_t * 55 libvlc_media_instance_new( libvlc_media_descriptor_t *p_md ) 56 { 57 libvlc_media_instance_t * p_mi; 58 59 if( !p_md ) 60 return NULL; 61 62 p_mi = malloc( sizeof(libvlc_media_instance_t) ); 63 p_mi->p_md = libvlc_media_descriptor_duplicate( p_md ); 64 p_mi->p_libvlc_instance = p_mi->p_md->p_libvlc_instance; 65 p_mi->i_input_id = -1; 66 67 return p_mi; 68 } 69 70 /************************************************************************** 71 * Create a new media instance object from an input_thread (Libvlc Internal) 72 **************************************************************************/ 73 libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread( 74 struct libvlc_instance_t *p_libvlc_instance, 75 input_thread_t *p_input ) 76 { 77 libvlc_media_instance_t * p_mi; 78 79 p_mi = malloc( sizeof(libvlc_media_instance_t) ); 80 p_mi->p_md = libvlc_media_descriptor_new_from_input_item( 81 p_libvlc_instance, 82 p_input->p->input.p_item ); 83 p_mi->p_libvlc_instance = p_libvlc_instance; 84 p_mi->i_input_id = p_input->i_object_id; 85 86 return p_mi; 87 } 88 89 /************************************************************************** 90 * Destroy a Media Instance object 91 **************************************************************************/ 92 void libvlc_media_instance_destroy( libvlc_media_instance_t *p_mi ) 93 { 94 input_thread_t *p_input_thread; 95 libvlc_exception_t p_e; 96 97 /* XXX: locking */ 98 libvlc_exception_init( &p_e ); 99 100 if( !p_mi ) 101 return; 102 103 p_input_thread = libvlc_get_input_thread( p_mi, &p_e ); 104 105 if( libvlc_exception_raised( &p_e ) ) 106 return; /* no need to worry about no input thread */ 107 108 input_DestroyThread( p_input_thread ); 109 110 libvlc_media_descriptor_destroy( p_mi->p_md ); 111 112 free( p_mi ); 113 } 114 115 /************************************************************************** 116 * Free a Media Instance object (libvlc internal) 117 **************************************************************************/ 118 void libvlc_media_instance_destroy_and_detach( libvlc_media_instance_t *p_mi ) 119 { 120 if( !p_mi ) 121 return; 122 123 libvlc_media_descriptor_destroy( p_mi->p_md ); 124 125 free( p_mi ); 126 } 127 128 /************************************************************************** 129 * Play 130 **************************************************************************/ 131 void libvlc_media_instance_play( libvlc_media_instance_t *p_mi, 132 libvlc_exception_t *p_e ) 133 { 134 input_thread_t * p_input_thread; 135 136 if( p_mi->i_input_id != -1) 137 { 138 vlc_value_t val; 139 val.i_int = PLAYING_S; 140 141 /* A thread alread exists, send it a play message */ 142 p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 143 144 if( libvlc_exception_raised( p_e ) ) 145 return; 146 147 input_Control( p_input_thread, INPUT_CONTROL_SET_STATE, PLAYING_S ); 148 return; 149 } 150 151 p_input_thread = input_CreateThread( p_mi->p_libvlc_instance->p_libvlc_int, 152 p_mi->p_md->p_input_item ); 153 p_mi->i_input_id = p_input_thread->i_object_id; 154 } 155 156 /************************************************************************** 157 * Pause 158 **************************************************************************/ 159 void libvlc_media_instance_pause( libvlc_media_instance_t *p_mi, 160 libvlc_exception_t *p_e ) 161 { 162 input_thread_t * p_input_thread; 163 vlc_value_t val; 164 val.i_int = PAUSE_S; 165 166 p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 167 168 if( libvlc_exception_raised( p_e ) ) 169 return; 170 171 input_Control( p_input_thread, INPUT_CONTROL_SET_STATE, val ); 172 } 56 173 57 174 /************************************************************************** 58 175 * Getters for stream information 59 176 **************************************************************************/ 60 vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input, 177 vlc_int64_t libvlc_media_instance_get_length( 178 libvlc_media_instance_t *p_mi, 61 179 libvlc_exception_t *p_e ) 62 180 { … … 64 182 vlc_value_t val; 65 183 66 p_input_thread = libvlc_get_input_thread ( p_ input, p_e);184 p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 67 185 if( !p_input_thread ) 68 186 return -1; … … 74 192 } 75 193 76 vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input, 194 vlc_int64_t libvlc_media_instance_get_time( 195 libvlc_media_instance_t *p_mi, 77 196 libvlc_exception_t *p_e ) 78 197 { … … 80 199 vlc_value_t val; 81 200 82 p_input_thread = libvlc_get_input_thread ( p_ input, p_e );201 p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 83 202 if( !p_input_thread ) 84 203 return -1; … … 89 208 } 90 209 91 void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time, 92 libvlc_exception_t *p_e ) 210 void libvlc_media_instance_set_time( 211 libvlc_media_instance_t *p_mi, 212 vlc_int64_t time, 213 libvlc_exception_t *p_e ) 93 214 { 94 215 input_thread_t *p_input_thread; 95 216 vlc_value_t value; 96 217 97 p_input_thread = libvlc_get_input_thread ( p_ input, p_e );218 p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 98 219 if( !p_input_thread ) 99 220 return; … … 104 225 } 105 226 106 void libvlc_input_set_position( libvlc_input_t *p_input, float position, 227 void libvlc_media_instance_set_position( 228 libvlc_media_instance_t *p_mi, 229 float position, 107 230 libvlc_exception_t *p_e ) 108 231 { … … 111 234 val.f_float = position; 112 235 113 p_input_thread = libvlc_get_input_thread ( p_ input, p_e);236 p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 114 237 if( !p_input_thread ) 115 238 return; … … 119 242 } 120 243 121 float libvlc_input_get_position( libvlc_input_t *p_input, 122 libvlc_exception_t *p_e ) 123 { 124 input_thread_t *p_input_thread; 125 vlc_value_t val; 126 127 p_input_thread = libvlc_get_input_thread ( p_input, p_e); 244 float libvlc_media_instance_get_position( 245 libvlc_media_instance_t *p_mi, 246 libvlc_exception_t *p_e ) 247 { 248 input_thread_t *p_input_thread; 249 vlc_value_t val; 250 251 p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 128 252 if( !p_input_thread ) 129 253 return -1.0; … … 135 259 } 136 260 137 float libvlc_input_get_fps( libvlc_input_t *p_input, 138 libvlc_exception_t *p_e) 261 float libvlc_media_instance_get_fps( 262 libvlc_media_instance_t *p_mi, 263 libvlc_exception_t *p_e) 139 264 { 140 265 double f_fps = 0.0; 141 266 input_thread_t *p_input_thread; 142 267 143 p_input_thread = libvlc_get_input_thread ( p_ input, p_e );268 p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 144 269 if( !p_input_thread ) 145 270 return 0.0; … … 159 284 } 160 285 161 vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input, 162 libvlc_exception_t *p_e) 286 vlc_bool_t libvlc_media_instance_will_play( 287 libvlc_media_instance_t *p_mi, 288 libvlc_exception_t *p_e) 163 289 { 164 290 input_thread_t *p_input_thread = 165 libvlc_get_input_thread ( p_ input, p_e);291 libvlc_get_input_thread ( p_mi, p_e); 166 292 if ( !p_input_thread ) 167 293 return VLC_FALSE; … … 176 302 } 177 303 178 void libvlc_input_set_rate( libvlc_input_t *p_input, float rate, 179 libvlc_exception_t *p_e ) 304 void libvlc_media_instance_set_rate( 305 libvlc_media_instance_t *p_mi, 306 float rate, 307 libvlc_exception_t *p_e ) 180 308 { 181 309 input_thread_t *p_input_thread; … … 187 315 val.i_int = 1000.0f/rate; 188 316 189 p_input_thread = libvlc_get_input_thread ( p_ input, p_e);317 p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 190 318 if ( !p_input_thread ) 191 319 return; … … 195 323 } 196 324 197 float libvlc_input_get_rate( libvlc_input_t *p_input, 198 libvlc_exception_t *p_e ) 199 { 200 input_thread_t *p_input_thread; 201 vlc_value_t val; 202 203 p_input_thread = libvlc_get_input_thread ( p_input, p_e); 325 float libvlc_media_instance_get_rate( 326 libvlc_media_instance_t *p_mi, 327 libvlc_exception_t *p_e ) 328 { 329 input_thread_t *p_input_thread; 330 vlc_value_t val; 331 332 p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 204 333 if ( !p_input_thread ) 205 334 return -1.0; … … 211 340 } 212 341 213 int libvlc_input_get_state( libvlc_input_t *p_input, 214 libvlc_exception_t *p_e ) 215 { 216 input_thread_t *p_input_thread; 217 vlc_value_t val; 218 219 p_input_thread = libvlc_get_input_thread ( p_input, p_e ); 342 int libvlc_media_instance_get_state( 343 libvlc_media_instance_t *p_mi, 344 libvlc_exception_t *p_e ) 345 { 346 input_thread_t *p_input_thread; 347 vlc_value_t val; 348 349 p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 220 350 if ( !p_input_thread ) 221 351 return 0; src/control/libvlc_internal.h
rd6346a3 r34f8161 32 32 #include <vlc/vlc.h> 33 33 #include <vlc/libvlc_structures.h> 34 35 #include <vlc_input.h> 34 36 35 37 /*************************************************************************** … … 83 85 }; 84 86 85 struct libvlc_ input_t87 struct libvlc_media_instance_t 86 88 { 87 int i_input_id; ///< Input object id. We don't use a pointer to 88 /// avoid any crash 89 struct libvlc_instance_t *p_instance; ///< Parent instance 89 int i_input_id; /* Input object id. We don't use a pointer to 90 avoid any crash */ 91 struct libvlc_instance_t *p_libvlc_instance; /* Parent instance */ 92 libvlc_media_descriptor_t *p_md; /* current media descriptor */ 90 93 }; 91 94 … … 94 97 ***************************************************************************/ 95 98 VLC_EXPORT (input_thread_t *, libvlc_get_input_thread, 96 ( struct libvlc_input_t *, libvlc_exception_t * ) ); 99 ( struct libvlc_media_instance_t *, libvlc_exception_t * ) ); 100 101 VLC_EXPORT (libvlc_media_instance_t *, libvlc_media_instance_new_from_input_thread, 102 ( struct libvlc_instance_t *, input_thread_t * ) ); 103 104 VLC_EXPORT (void, libvlc_media_instance_destroy_and_detach, 105 ( libvlc_media_instance_t * ) ); 106 107 VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_new_from_input_item, 108 ( struct libvlc_instance_t *, input_item_t * ) ); 109 110 VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_duplicate, 111 ( libvlc_media_descriptor_t * ) ); 97 112 98 113 #define RAISENULL( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \ src/control/media_descriptor.c
r0dabfb1 r34f8161 59 59 return NULL; /* XXX: throw an exception */ 60 60 61 p_media_desc = malloc( sizeof(libvlc_ input_t) );61 p_media_desc = malloc( sizeof(libvlc_media_descriptor_t) ); 62 62 p_media_desc->p_libvlc_instance = p_instance; 63 63 p_media_desc->p_input_item = p_input_item; … … 68 68 69 69 /************************************************************************** 70 * Create a new media descriptor object from an input_item 71 * (libvlc internal) 72 **************************************************************************/ 73 libvlc_media_descriptor_t * libvlc_media_descriptor_new_from_input_item( 74 libvlc_instance_t *p_instance, 75 input_item_t *p_input_item ) 76 { 77 libvlc_media_descriptor_t * p_media_desc; 78 79 if (!p_input_item) 80 return NULL; /* XXX: throw an exception */ 81 82 p_media_desc = malloc( sizeof(libvlc_media_descriptor_t) ); 83 p_media_desc->p_libvlc_instance = p_instance; 84 p_media_desc->p_input_item = p_input_item; 85 p_media_desc->b_preparsed = VLC_TRUE; 86 87 return p_media_desc; 88 } 89 90 /************************************************************************** 70 91 * Delete a media descriptor object 71 92 **************************************************************************/ 72 void libvlc_media_descriptor_destroy( libvlc_media_descriptor_t *p_m eta_desc)93 void libvlc_media_descriptor_destroy( libvlc_media_descriptor_t *p_md ) 73 94 { 74 if (!p_m eta_desc)95 if (!p_md) 75 96 return; 76 97 77 98 /* XXX: locking */ 78 input_ItemClean( p_m eta_desc->p_input_item );99 input_ItemClean( p_md->p_input_item ); 79 100 80 free( p_m eta_desc);101 free( p_md ); 81 102 } 82 103 83 104 /************************************************************************** 84 * Getters for meta information 105 * Delete a media descriptor object 106 **************************************************************************/ 107 libvlc_media_descriptor_t * 108 libvlc_media_descriptor_duplicate( libvlc_media_descriptor_t *p_md_orig ) 109 { 110 libvlc_media_descriptor_t * p_md; 111 112 p_md = malloc( sizeof(libvlc_media_descriptor_t) ); 113 bcopy( p_md_orig, p_md, sizeof(libvlc_media_descriptor_t) ); 114 115 return p_md; 116 } 117 118 /************************************************************************** 119 * Getter for meta information 85 120 **************************************************************************/ 86 121 static const int meta_conversion[] = src/control/mediacontrol_audio_video.c
ra79c62a r34f8161 284 284 { 285 285 libvlc_exception_t ex; 286 libvlc_ input_t* p_input;286 libvlc_media_instance_t* p_mi; 287 287 int i_ret; 288 288 … … 290 290 libvlc_exception_init( &ex ); 291 291 292 p_ input = libvlc_playlist_get_input( self->p_instance, &ex );293 HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 294 295 i_ret = libvlc_ input_get_rate( p_input, &ex );296 libvlc_ input_free( p_input);292 p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 293 HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 294 295 i_ret = libvlc_media_instance_get_rate( p_mi, &ex ); 296 libvlc_media_instance_destroy_and_detach( p_mi ); 297 297 HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 298 298 … … 306 306 { 307 307 libvlc_exception_t ex; 308 libvlc_ input_t* p_input;309 310 mediacontrol_exception_init( exception ); 311 libvlc_exception_init( &ex ); 312 313 p_ input = libvlc_playlist_get_input( self->p_instance, &ex );314 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 315 316 libvlc_ input_set_rate( p_input, rate * 10, &ex );317 libvlc_ input_free( p_input);308 libvlc_media_instance_t* p_mi; 309 310 mediacontrol_exception_init( exception ); 311 libvlc_exception_init( &ex ); 312 313 p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 314 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 315 316 libvlc_media_instance_set_rate( p_mi, rate * 10, &ex ); 317 libvlc_media_instance_destroy_and_detach( p_mi ); 318 318 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 319 319 } … … 324 324 { 325 325 libvlc_exception_t ex; 326 libvlc_ input_t* p_input;326 libvlc_media_instance_t* p_mi; 327 327 int i_ret; 328 328 … … 330 330 libvlc_exception_init( &ex ); 331 331 332 p_ input = libvlc_playlist_get_input( self->p_instance, &ex );333 HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 334 335 i_ret = libvlc_get_fullscreen( p_ input, &ex );336 libvlc_ input_free( p_input);332 p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 333 HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 334 335 i_ret = libvlc_get_fullscreen( p_mi, &ex ); 336 libvlc_media_instance_destroy_and_detach( p_mi ); 337 337 HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 338 338 … … 346 346 { 347 347 libvlc_exception_t ex; 348 libvlc_ input_t* p_input;349 350 mediacontrol_exception_init( exception ); 351 libvlc_exception_init( &ex ); 352 353 p_ input = libvlc_playlist_get_input( self->p_instance, &ex );354 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 355 356 libvlc_set_fullscreen( p_ input, b_fullscreen, &ex );357 libvlc_ input_free( p_input);358 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 359 } 348 libvlc_media_instance_t* p_mi; 349 350 mediacontrol_exception_init( exception ); 351 libvlc_exception_init( &ex ); 352 353 p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 354 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 355 356 libvlc_set_fullscreen( p_mi, b_fullscreen, &ex ); 357 libvlc_media_instance_destroy_and_detach( p_mi ); 358 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 359 } src/control/mediacontrol_core.c
ra79c62a r34f8161 125 125 libvlc_exception_t ex; 126 126 vlc_int64_t pos; 127 libvlc_ input_t * p_input;127 libvlc_media_instance_t * p_mi; 128 128 129 129 mediacontrol_exception_init( exception ); … … 134 134 retval->key = a_key; 135 135 136 p_ input = libvlc_playlist_get_input( self->p_instance, &ex);136 p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex); 137 137 HANDLE_LIBVLC_EXCEPTION_NULL( &ex ); 138 138 139 139 if( an_origin != mediacontrol_AbsolutePosition ) 140 140 { 141 libvlc_ input_free( p_input);141 libvlc_media_instance_destroy_and_detach( p_mi ); 142 142 /* Relative or ModuloPosition make no sense */ 143 143 RAISE_NULL( mediacontrol_PositionOriginNotSupported, … … 146 146 147 147 /* We are asked for an AbsolutePosition. */ 148 pos = libvlc_ input_get_time( p_input, &ex );148 pos = libvlc_media_instance_get_time( p_mi, &ex ); 149 149 150 150 if( a_key == mediacontrol_MediaTime ) … … 156 156 if( ! self->p_playlist->p_input ) 157 157 { 158 libvlc_ input_free( p_input);158 libvlc_media_instance_destroy_and_detach( p_mi ); 159 159 RAISE_NULL( mediacontrol_InternalException, 160 160 "No input" ); … … 165 165 pos ); 166 166 } 167 libvlc_ input_free( p_input);167 libvlc_media_instance_destroy_and_detach( p_mi ); 168 168 return retval; 169 169 } … … 175 175 mediacontrol_Exception *exception ) 176 176 { 177 libvlc_ input_t * p_input;177 libvlc_media_instance_t * p_mi; 178 178 libvlc_exception_t ex; 179 179 vlc_int64_t i_pos; … … 182 182 mediacontrol_exception_init( exception ); 183 183 184 p_ input = libvlc_playlist_get_input( self->p_instance, &ex);184 p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex); 185 185 HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 186 186 187 187 i_pos = mediacontrol_position2microsecond( self->p_playlist->p_input, a_position ); 188 libvlc_ input_set_time( p_input, i_pos / 1000, &ex );189 libvlc_ input_free( p_input);188 libvlc_media_instance_set_time( p_mi, i_pos / 1000, &ex );
