Changeset 44de024820ed206165d81338c36439e786fe2f65
- Timestamp:
- 01/08/06 11:22:35
(2 years ago)
- Author:
- Clément Stenac <zorglub@videolan.org>
- git-committer:
- Clément Stenac <zorglub@videolan.org> 1154424155 +0000
- git-parent:
[5d09f6000a0b589d63e1fc9c6af4e5b055658203]
- git-author:
- Clément Stenac <zorglub@videolan.org> 1154424155 +0000
- Message:
src/control: a bit of cleanup here and there
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r05985a9 |
r44de024 |
|
| 51 | 51 | }; |
|---|
| 52 | 52 | |
|---|
| | 53 | #define RAISENULL( psz ) { libvlc_exception_raise( p_e, psz ); return NULL; } |
|---|
| | 54 | #define RAISEVOID( psz ) { libvlc_exception_raise( p_e, psz ); return; } |
|---|
| | 55 | #define RAISEZERO( psz ) { libvlc_exception_raise( p_e, psz ); return 0; } |
|---|
| 53 | 56 | |
|---|
| 54 | 57 | # ifdef __cplusplus |
|---|
| r8914d39 |
r44de024 |
|
| 115 | 115 | |
|---|
| 116 | 116 | /** |
|---|
| 117 | | * returns a libvlc instance identifier for legacy APIs |
|---|
| 118 | | * \param p_instance the instance to destroy |
|---|
| | 117 | * Returns a libvlc instance identifier for legacy APIs. Use of this |
|---|
| | 118 | * function is discouraged, you should convert your program to use the |
|---|
| | 119 | * new API. |
|---|
| | 120 | * \param p_instance the instance |
|---|
| 119 | 121 | */ |
|---|
| 120 | 122 | int libvlc_get_vlc_id( libvlc_instance_t *p_instance ); |
|---|
| … | … | |
| 202 | 204 | |
|---|
| 203 | 205 | /** |
|---|
| 204 | | * Go to next playlist item |
|---|
| 205 | | * \param p_instance the instance |
|---|
| 206 | | * \param p_exception an initialized exception |
|---|
| 207 | | */ |
|---|
| 208 | | void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * ); |
|---|
| 209 | | |
|---|
| 210 | | /** |
|---|
| 211 | | * Go to Previous playlist item |
|---|
| 212 | | * \param p_instance the instance |
|---|
| 213 | | * \param p_exception an initialized exception |
|---|
| 214 | | */ |
|---|
| 215 | | void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * ); |
|---|
| 216 | | |
|---|
| 217 | | /** |
|---|
| 218 | 206 | * Add an item at the end of the playlist |
|---|
| 219 | 207 | * If you need more advanced options, \see libvlc_playlist_add_extended |
|---|
| … | … | |
| 233 | 221 | * \param i_options the number of options to add |
|---|
| 234 | 222 | * \param ppsz_options strings representing the options to add |
|---|
| | 223 | * \param p_exception an initialized exception |
|---|
| 235 | 224 | * \return the identifier of the new item |
|---|
| 236 | 225 | */ |
|---|
| … | … | |
| 239 | 228 | libvlc_exception_t * ); |
|---|
| 240 | 229 | |
|---|
| 241 | | |
|---|
| | 230 | /** |
|---|
| | 231 | * Delete the playlist item with the given ID. |
|---|
| | 232 | * \param p_instance the instance |
|---|
| | 233 | * \param i_id the id to remove |
|---|
| | 234 | * \param p_exception an initialized exception |
|---|
| | 235 | * \return |
|---|
| | 236 | */ |
|---|
| 242 | 237 | int libvlc_playlist_delete_item( libvlc_instance_t *, int, |
|---|
| 243 | 238 | libvlc_exception_t * ); |
|---|
| … | … | |
| 252 | 247 | libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *, |
|---|
| 253 | 248 | libvlc_exception_t * ); |
|---|
| 254 | | |
|---|
| 255 | | |
|---|
| 256 | 249 | |
|---|
| 257 | 250 | /** @}*/ |
|---|
| … | … | |
| 278 | 271 | void libvlc_input_set_position ( libvlc_input_t *, float, libvlc_exception_t *); |
|---|
| 279 | 272 | vlc_bool_t libvlc_input_will_play ( libvlc_input_t *, libvlc_exception_t *); |
|---|
| | 273 | |
|---|
| | 274 | /** @} */ |
|---|
| | 275 | |
|---|
| | 276 | /** defgroup libvlc_video Video |
|---|
| | 277 | * \ingroup libvlc |
|---|
| | 278 | * LibVLC Video handling |
|---|
| | 279 | * @{ |
|---|
| | 280 | */ |
|---|
| | 281 | |
|---|
| | 282 | /** |
|---|
| | 283 | * Does this input have a video output ? |
|---|
| | 284 | * \param p_input the input |
|---|
| | 285 | * \param p_exception an initialized exception |
|---|
| | 286 | */ |
|---|
| 280 | 287 | vlc_bool_t libvlc_input_has_vout ( libvlc_input_t *, libvlc_exception_t *); |
|---|
| 281 | 288 | float libvlc_input_get_fps ( libvlc_input_t *, libvlc_exception_t *); |
|---|
| 282 | | |
|---|
| 283 | | /** @} */ |
|---|
| 284 | | |
|---|
| 285 | | /** defgroup libvlc_video Video |
|---|
| 286 | | * \ingroup libvlc |
|---|
| 287 | | * LibVLC Video handling |
|---|
| 288 | | * @{ |
|---|
| 289 | | */ |
|---|
| 290 | 289 | |
|---|
| 291 | 290 | /** |
|---|
| … | … | |
| 475 | 474 | libvlc_exception_t *); |
|---|
| 476 | 475 | |
|---|
| 477 | | |
|---|
| 478 | | |
|---|
| 479 | 476 | /** |
|---|
| 480 | 477 | * Set output for a media |
|---|
| r9781b84 |
r44de024 |
|
| 32 | 32 | *****************************************************************************/ |
|---|
| 33 | 33 | void libvlc_audio_toggle_mute( libvlc_instance_t *p_instance, |
|---|
| 34 | | libvlc_exception_t *p_exception ) |
|---|
| | 34 | libvlc_exception_t *p_e ) |
|---|
| 35 | 35 | { |
|---|
| 36 | 36 | aout_VolumeMute( p_instance->p_vlc, NULL ); |
|---|
| … | … | |
| 38 | 38 | |
|---|
| 39 | 39 | vlc_bool_t libvlc_audio_get_mute( libvlc_instance_t *p_instance, |
|---|
| 40 | | libvlc_exception_t *p_exception ) |
|---|
| | 40 | libvlc_exception_t *p_e ) |
|---|
| 41 | 41 | { |
|---|
| 42 | 42 | /* |
|---|
| … | … | |
| 45 | 45 | audio_volume_t i_volume; |
|---|
| 46 | 46 | |
|---|
| 47 | | i_volume = libvlc_audio_get_volume(p_instance, p_exception); |
|---|
| | 47 | i_volume = libvlc_audio_get_volume(p_instance, p_e); |
|---|
| 48 | 48 | if ( i_volume == 0 ) |
|---|
| 49 | 49 | return VLC_TRUE; |
|---|
| 50 | | |
|---|
| 51 | 50 | return VLC_FALSE; |
|---|
| 52 | 51 | } |
|---|
| 53 | 52 | |
|---|
| 54 | 53 | void libvlc_audio_set_mute( libvlc_instance_t *p_instance, vlc_bool_t status, |
|---|
| 55 | | libvlc_exception_t *p_exception ) |
|---|
| | 54 | libvlc_exception_t *p_e ) |
|---|
| 56 | 55 | { |
|---|
| 57 | 56 | if ( status ) |
|---|
| 58 | 57 | { |
|---|
| 59 | | /* |
|---|
| 60 | | * Check if the volume is already muted |
|---|
| 61 | | */ |
|---|
| 62 | | if (! libvlc_audio_get_volume( p_instance, p_exception ) ) |
|---|
| | 58 | /* Check if the volume is already muted */ |
|---|
| | 59 | if (! libvlc_audio_get_volume( p_instance, p_e ) ) |
|---|
| 63 | 60 | { |
|---|
| 64 | 61 | return; |
|---|
| 65 | 62 | } |
|---|
| 66 | | |
|---|
| 67 | 63 | aout_VolumeMute( p_instance->p_vlc, NULL ); |
|---|
| 68 | | return; |
|---|
| 69 | | |
|---|
| 70 | 64 | } |
|---|
| 71 | 65 | else |
|---|
| 72 | 66 | { |
|---|
| 73 | | /* |
|---|
| 74 | | * the aout_VolumeMute is a toggle function, so this is enough. |
|---|
| 75 | | */ |
|---|
| | 67 | /* the aout_VolumeMute is a toggle function, so this is enough. */ |
|---|
| 76 | 68 | aout_VolumeMute( p_instance->p_vlc, NULL ); |
|---|
| 77 | | return; |
|---|
| 78 | 69 | } |
|---|
| 79 | 70 | } |
|---|
| 80 | | |
|---|
| 81 | 71 | |
|---|
| 82 | 72 | /***************************************************************************** |
|---|
| … | … | |
| 84 | 74 | *****************************************************************************/ |
|---|
| 85 | 75 | int libvlc_audio_get_volume( libvlc_instance_t *p_instance, |
|---|
| 86 | | libvlc_exception_t *p_exception ) |
|---|
| | 76 | libvlc_exception_t *p_e ) |
|---|
| 87 | 77 | { |
|---|
| 88 | 78 | audio_volume_t i_volume; |
|---|
| … | … | |
| 98 | 88 | *****************************************************************************/ |
|---|
| 99 | 89 | void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume, |
|---|
| 100 | | libvlc_exception_t *p_exception ) |
|---|
| | 90 | libvlc_exception_t *p_e ) |
|---|
| 101 | 91 | { |
|---|
| 102 | 92 | if( i_volume >= 0 && i_volume <= 200 ) |
|---|
| … | … | |
| 107 | 97 | else |
|---|
| 108 | 98 | { |
|---|
| 109 | | libvlc_exception_raise( p_exception, "Volume out of range" ); |
|---|
| | 99 | libvlc_exception_raise( p_e, "Volume out of range" ); |
|---|
| 110 | 100 | } |
|---|
| 111 | 101 | } |
|---|
| rde277e8 |
r44de024 |
|
| 64 | 64 | |
|---|
| 65 | 65 | /* does caller care about exceptions ? */ |
|---|
| 66 | | if( p_exception == NULL ) |
|---|
| 67 | | return; |
|---|
| | 66 | if( p_exception == NULL ) return; |
|---|
| 68 | 67 | |
|---|
| 69 | 68 | /* remove previous exception if it wasn't cleared */ |
|---|
| 70 | 69 | if( p_exception->b_raised && p_exception->psz_message ) |
|---|
| 71 | 70 | { |
|---|
| 72 | | free(p_exception->psz_message); |
|---|
| 73 | | p_exception->psz_message = NULL; |
|---|
| | 71 | free(p_exception->psz_message); |
|---|
| | 72 | p_exception->psz_message = NULL; |
|---|
| 74 | 73 | } |
|---|
| 75 | 74 | |
|---|
| … | … | |
| 82 | 81 | |
|---|
| 83 | 82 | libvlc_instance_t * libvlc_new( int argc, char **argv, |
|---|
| 84 | | libvlc_exception_t *p_exception ) |
|---|
| | 83 | libvlc_exception_t *p_e ) |
|---|
| 85 | 84 | { |
|---|
| 86 | 85 | int i_vlc_id; |
|---|
| … | … | |
| 91 | 90 | p_vlc = (vlc_t* ) vlc_current_object( i_vlc_id ); |
|---|
| 92 | 91 | |
|---|
| 93 | | if( !p_vlc ) |
|---|
| 94 | | { |
|---|
| 95 | | libvlc_exception_raise( p_exception, "VLC initialization failed" ); |
|---|
| 96 | | return NULL; |
|---|
| 97 | | } |
|---|
| | 92 | if( !p_vlc ) RAISENULL( "VLC initialization failed" ); |
|---|
| | 93 | |
|---|
| 98 | 94 | p_new = (libvlc_instance_t *)malloc( sizeof( libvlc_instance_t ) ); |
|---|
| | 95 | if( !p_new ) RAISENULL( "Out of memory" ); |
|---|
| 99 | 96 | |
|---|
| 100 | 97 | /** \todo Look for interface settings. If we don't have any, add -I dummy */ |
|---|
| 101 | 98 | /* Because we probably don't want a GUI by default */ |
|---|
| 102 | 99 | |
|---|
| 103 | | if( !p_new ) |
|---|
| 104 | | { |
|---|
| 105 | | libvlc_exception_raise( p_exception, "Out of memory" ); |
|---|
| 106 | | return NULL; |
|---|
| 107 | | } |
|---|
| 108 | 100 | |
|---|
| 109 | 101 | VLC_Init( i_vlc_id, argc, argv ); |
|---|
| … | … | |
| 114 | 106 | p_new->p_vlm = NULL; |
|---|
| 115 | 107 | |
|---|
| 116 | | if( !p_new->p_playlist ) |
|---|
| 117 | | { |
|---|
| 118 | | libvlc_exception_raise( p_exception, "Playlist creation failed" ); |
|---|
| 119 | | return NULL; |
|---|
| 120 | | } |
|---|
| | 108 | if( !p_new->p_playlist ) RAISENULL( "Playlist creation failed" ); |
|---|
| | 109 | |
|---|
| 121 | 110 | p_new->i_vlc_id = i_vlc_id; |
|---|
| 122 | | |
|---|
| 123 | 111 | return p_new; |
|---|
| 124 | 112 | } |
|---|
| … | … | |
| 137 | 125 | return p_instance->i_vlc_id; |
|---|
| 138 | 126 | } |
|---|
| 139 | | |
|---|
| r8914d39 |
r44de024 |
|
| 30 | 30 | void libvlc_input_free( libvlc_input_t *p_input ) |
|---|
| 31 | 31 | { |
|---|
| 32 | | if( p_input ) |
|---|
| 33 | | free( p_input ); |
|---|
| | 32 | if( p_input ) free( p_input ); |
|---|
| 34 | 33 | } |
|---|
| 35 | 34 | |
|---|
| … | … | |
| 43 | 42 | input_thread_t *p_input_thread; |
|---|
| 44 | 43 | |
|---|
| 45 | | if( !p_input ) |
|---|
| 46 | | { |
|---|
| 47 | | libvlc_exception_raise( p_e, "Input is NULL" ); |
|---|
| 48 | | return NULL; |
|---|
| 49 | | } |
|---|
| | 44 | if( !p_input ) RAISENULL( "Input is NULL" ); |
|---|
| 50 | 45 | |
|---|
| 51 | 46 | p_input_thread = (input_thread_t*)vlc_object_get( |
|---|
| 52 | | p_input->p_instance->p_vlc, |
|---|
| 53 | | p_input->i_input_id ); |
|---|
| 54 | | if( !p_input_thread ) |
|---|
| 55 | | { |
|---|
| 56 | | libvlc_exception_raise( p_e, "Input does not exist" ); |
|---|
| 57 | | return NULL; |
|---|
| 58 | | } |
|---|
| | 47 | p_input->p_instance->p_vlc, |
|---|
| | 48 | p_input->i_input_id ); |
|---|
| | 49 | if( !p_input_thread ) RAISENULL( "Input does not exist" ); |
|---|
| 59 | 50 | |
|---|
| 60 | 51 | return p_input_thread; |
|---|
| … | … | |
| 67 | 58 | **************************************************************************/ |
|---|
| 68 | 59 | vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input, |
|---|
| 69 | | libvlc_exception_t *p_exception ) |
|---|
| | 60 | libvlc_exception_t *p_e ) |
|---|
| 70 | 61 | { |
|---|
| 71 | 62 | input_thread_t *p_input_thread; |
|---|
| 72 | 63 | vlc_value_t val; |
|---|
| 73 | 64 | |
|---|
| 74 | | p_input_thread = libvlc_get_input_thread ( p_input, p_exception); |
|---|
| 75 | | |
|---|
| 76 | | if ( libvlc_exception_raised( p_exception ) ) |
|---|
| 77 | | return -1.0; |
|---|
| | 65 | p_input_thread = libvlc_get_input_thread ( p_input, p_e); |
|---|
| | 66 | if( libvlc_exception_raised( p_e ) ) return -1.0; |
|---|
| 78 | 67 | |
|---|
| 79 | 68 | var_Get( p_input_thread, "length", &val ); |
|---|
| … | … | |
| 84 | 73 | |
|---|
| 85 | 74 | vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input, |
|---|
| 86 | | libvlc_exception_t *p_exception ) |
|---|
| | 75 | libvlc_exception_t *p_e ) |
|---|
| 87 | 76 | { |
|---|
| 88 | 77 | input_thread_t *p_input_thread; |
|---|
| 89 | 78 | vlc_value_t val; |
|---|
| 90 | 79 | |
|---|
| 91 | | |
|---|
| 92 | | p_input_thread = libvlc_get_input_thread ( p_input, p_exception); |
|---|
| 93 | | |
|---|
| 94 | | if ( libvlc_exception_raised( p_exception ) ) |
|---|
| 95 | | return -1.0; |
|---|
| | 80 | p_input_thread = libvlc_get_input_thread ( p_input, p_e ); |
|---|
| | 81 | if( libvlc_exception_raised( p_e ) ) return -1.0; |
|---|
| 96 | 82 | |
|---|
| 97 | 83 | var_Get( p_input_thread , "time", &val ); |
|---|
| 98 | 84 | vlc_object_release( p_input_thread ); |
|---|
| 99 | | |
|---|
| 100 | 85 | return val.i_time / 1000; |
|---|
| 101 | 86 | } |
|---|
| 102 | 87 | |
|---|
| 103 | | void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time, libvlc_exception_t *p_exception ) |
|---|
| | 88 | void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time, |
|---|
| | 89 | libvlc_exception_t *p_e ) |
|---|
| 104 | 90 | { |
|---|
| 105 | 91 | input_thread_t *p_input_thread; |
|---|
| 106 | 92 | vlc_value_t value; |
|---|
| 107 | 93 | |
|---|
| 108 | | p_input_thread = libvlc_get_input_thread ( p_input, p_exception); |
|---|
| 109 | | |
|---|
| 110 | | if ( libvlc_exception_raised( p_exception ) ) |
|---|
| 111 | | return; |
|---|
| | 94 | p_input_thread = libvlc_get_input_thread ( p_input, p_e ); |
|---|
| | 95 | if( libvlc_exception_raised( p_e ) ) return; |
|---|
| 112 | 96 | |
|---|
| 113 | 97 | value.i_time = time; |
|---|
| 114 | 98 | var_Set( p_input_thread, "time", value ); |
|---|
| 115 | 99 | vlc_object_release( p_input_thread ); |
|---|
| 116 | | |
|---|
| 117 | | return; |
|---|
| 118 | | |
|---|
| 119 | 100 | } |
|---|
| 120 | 101 | |
|---|
| 121 | | void libvlc_input_set_position( libvlc_input_t *p_input, float position, libvlc_exception_t *p_exception ) |
|---|
| | 102 | void libvlc_input_set_position( libvlc_input_t *p_input, float position, |
|---|
| | 103 | libvlc_exception_t *p_e ) |
|---|
| | 104 | { |
|---|
| | 105 | input_thread_t *p_input_thread; |
|---|
| | 106 | vlc_value_t val; |
|---|
| | 107 | val.f_float = position; |
|---|
| | 108 | |
|---|
| | 109 | p_input_thread = libvlc_get_input_thread ( p_input, p_e); |
|---|
| | 110 | if ( libvlc_exception_raised( p_e ) ) return; |
|---|
| | 111 | |
|---|
| | 112 | var_Set( p_input_thread, "position", val ); |
|---|
| | 113 | vlc_object_release( p_input_thread ); |
|---|
| | 114 | } |
|---|
| | 115 | |
|---|
| | 116 | float libvlc_input_get_position( libvlc_input_t *p_input, |
|---|
| | 117 | libvlc_exception_t *p_e ) |
|---|
| 122 | 118 | { |
|---|
| 123 | 119 | input_thread_t *p_input_thread; |
|---|
| 124 | 120 | vlc_value_t val; |
|---|
| 125 | 121 | |
|---|
| 126 | | val.f_float = position; |
|---|
| 127 | | |
|---|
| 128 | | p_input_thread = libvlc_get_input_thread ( p_input, p_exception); |
|---|
| 129 | | |
|---|
| 130 | | if ( libvlc_exception_raised( p_exception ) ) |
|---|
| 131 | | return; |
|---|
| 132 | | |
|---|
| 133 | | var_Set( p_input_thread, "position", val ); |
|---|
| 134 | | vlc_object_release( p_input_thread ); |
|---|
| 135 | | |
|---|
| 136 | | return; |
|---|
| 137 | | |
|---|
| 138 | | } |
|---|
| 139 | | |
|---|
| 140 | | |
|---|
| 141 | | |
|---|
| 142 | | float libvlc_input_get_position( libvlc_input_t *p_input, |
|---|
| 143 | | libvlc_exception_t *p_exception ) |
|---|
| 144 | | { |
|---|
| 145 | | input_thread_t *p_input_thread; |
|---|
| 146 | | vlc_value_t val; |
|---|
| 147 | | |
|---|
| 148 | | p_input_thread = libvlc_get_input_thread ( p_input, p_exception); |
|---|
| 149 | | |
|---|
| 150 | | if ( libvlc_exception_raised( p_exception ) ) |
|---|
| 151 | | return -1.0; |
|---|
| | 122 | p_input_thread = libvlc_get_input_thread ( p_input, p_e); |
|---|
| | 123 | if ( libvlc_exception_raised( p_e ) ) return -1.0; |
|---|
| 152 | 124 | |
|---|
| 153 | 125 | var_Get( p_input_thread, "position", &val ); |
|---|
| … | … | |
| 158 | 130 | |
|---|
| 159 | 131 | float libvlc_input_get_fps( libvlc_input_t *p_input, |
|---|
| 160 | | libvlc_exception_t *p_exception) |
|---|
| | 132 | libvlc_exception_t *p_e) |
|---|
| 161 | 133 | { |
|---|
| 162 | 134 | double f_fps; |
|---|
| 163 | 135 | input_thread_t *p_input_thread; |
|---|
| 164 | 136 | |
|---|
| 165 | | p_input_thread = libvlc_get_input_thread ( p_input, p_exception); |
|---|
| | 137 | p_input_thread = libvlc_get_input_thread ( p_input, p_e ); |
|---|
| | 138 | if ( libvlc_exception_raised( p_e ) ) return 0.0; |
|---|
| 166 | 139 | |
|---|
| 167 | | if( demux2_Control( p_input_thread->input.p_demux, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 ) |
|---|
| | 140 | if( demux2_Control( p_input_thread->input.p_demux, DEMUX_GET_FPS, &f_fps ) |
|---|
| | 141 | || f_fps < 0.1 ) |
|---|
| 168 | 142 | { |
|---|
| 169 | 143 | vlc_object_release( p_input_thread ); |
|---|
| 170 | | return 0; |
|---|
| | 144 | return 0.0; |
|---|
| 171 | 145 | } |
|---|
| 172 | 146 | else |
|---|
| … | … | |
| 178 | 152 | |
|---|
| 179 | 153 | vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input, |
|---|
| 180 | | libvlc_exception_t *p_exception) |
|---|
| | 154 | libvlc_exception_t *p_e) |
|---|
| 181 | 155 | { |
|---|
| 182 | | input_thread_t *p_input_thread; |
|---|
| 183 | | |
|---|
| 184 | | p_input_thread = libvlc_get_input_thread ( p_input, p_exception); |
|---|
| 185 | | |
|---|
| 186 | | if ( libvlc_exception_raised( p_exception ) ) |
|---|
| 187 | | return VLC_FALSE; |
|---|
| | 156 | input_thread_t *p_input_thread = |
|---|
| | 157 | libvlc_get_input_thread ( p_input, p_e); |
|---|
| | 158 | if ( libvlc_exception_raised( p_e ) ) return VLC_FALSE; |
|---|
| 188 | 159 | |
|---|
| 189 | 160 | if ( !p_input_thread->b_die && !p_input_thread->b_dead ) |
|---|
| … | … | |
| 192 | 163 | return VLC_TRUE; |
|---|
| 193 | 164 | } |
|---|
| 194 | | |
|---|
| 195 | 165 | vlc_object_release( p_input_thread ); |
|---|
| 196 | 166 | return VLC_FALSE; |
|---|
| r3398355 |
r44de024 |
|
| 29 | 29 | void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id, |
|---|
| 30 | 30 | int i_options, char **ppsz_options, |
|---|
| 31 | | libvlc_exception_t *p_exception ) |
|---|
| | 31 | libvlc_exception_t *p_e ) |
|---|
| 32 | 32 | { |
|---|
| | 33 | assert( p_instance->p_playlist ); |
|---|
| 33 | 34 | ///\todo Handle additionnal options |
|---|
| 34 | 35 | |
|---|
| 35 | | if( p_instance->p_playlist->i_size == 0 ) |
|---|
| 36 | | { |
|---|
| 37 | | libvlc_exception_raise( p_exception, "Empty playlist" ); |
|---|
| 38 | | return; |
|---|
| 39 | | } |
|---|
| | 36 | if( p_instance->p_playlist->i_size == 0 ) RAISEVOID( "Empty playlist" ); |
|---|
| 40 | 37 | if( i_id > 0 ) |
|---|
| 41 | 38 | { |
|---|
| 42 | | playlist_item_t *p_item = playlist_ItemGetById( p_instance->p_playlist, i_id ); |
|---|
| | 39 | playlist_item_t *p_item = playlist_ItemGetById( p_instance->p_playlist, |
|---|
| | 40 | i_id ); |
|---|
| | 41 | if( !p_item ) RAISEVOID( "Unable to find item" ); |
|---|
| 43 | 42 | |
|---|
| 44 | | if( !p_item ) |
|---|
| 45 | | { |
|---|
| 46 | | libvlc_exception_raise( p_exception, "Unable to find item " ); |
|---|
| 47 | | return; |
|---|
| 48 | | } |
|---|
| 49 | 43 | playlist_LockControl( p_instance->p_playlist, PLAYLIST_VIEWPLAY, |
|---|
| 50 | 44 | p_instance->p_playlist->status.p_node, p_item ); |
|---|
| … | … | |
| 57 | 51 | |
|---|
| 58 | 52 | void libvlc_playlist_pause( libvlc_instance_t *p_instance, |
|---|
| 59 | | libvlc_exception_t *p_exception ) |
|---|
| | 53 | libvlc_exception_t *p_e ) |
|---|
| 60 | 54 | { |
|---|
| | 55 | assert( p_instance->p_playlist ); |
|---|
| 61 | 56 | if( playlist_Pause( p_instance->p_playlist ) != VLC_SUCCESS ) |
|---|
| 62 | | { |
|---|
| 63 | | libvlc_exception_raise( p_exception, "Empty playlist" ); |
|---|
| 64 | | } |
|---|
| | 57 | RAISEVOID( "Empty playlist" ); |
|---|
| 65 | 58 | } |
|---|
| 66 | 59 | |
|---|
| 67 | 60 | |
|---|
| 68 | 61 | void libvlc_playlist_stop( libvlc_instance_t *p_instance, |
|---|
| 69 | | libvlc_exception_t *p_exception ) |
|---|
| | 62 | libvlc_exception_t *p_e ) |
|---|
| 70 | 63 | { |
|---|
| | 64 | assert( p_instance->p_playlist ); |
|---|
| 71 | 65 | if( playlist_Stop( p_instance->p_playlist ) != VLC_SUCCESS ) |
|---|
| 72 | | { |
|---|
| 73 | | libvlc_exception_raise( p_exception, "Empty playlist" ); |
|---|
| 74 | | } |
|---|
| | 66 | RAISEVOID( "Empty playlist" ); |
|---|
| 75 | 67 | } |
|---|
| 76 | 68 | |
|---|
| 77 | 69 | void libvlc_playlist_clear( libvlc_instance_t *p_instance, |
|---|
| 78 | | libvlc_exception_t *p_exception ) |
|---|
| | 70 | libvlc_exception_t *p_e ) |
|---|
| 79 | 71 | { |
|---|
| | 72 | assert( p_instance->p_playlist ); |
|---|
| 80 | 73 | playlist_Clear( p_instance->p_playlist ); |
|---|
| 81 | 74 | } |
|---|
| 82 | 75 | |
|---|
| 83 | 76 | void libvlc_playlist_next( libvlc_instance_t *p_instance, |
|---|
| 84 | | libvlc_exception_t *p_exception ) |
|---|
| | 77 | libvlc_exception_t *p_e ) |
|---|
| 85 | 78 | { |
|---|
| | 79 | assert( p_instance->p_playlist ); |
|---|
| 86 | 80 | if( playlist_Next( p_instance->p_playlist ) != VLC_SUCCESS ) |
|---|
| 87 | | { |
|---|
| 88 | | libvlc_exception_raise( p_exception, "Empty playlist" ); |
|---|
| 89 | | } |
|---|
| | 81 | RAISEVOID( "Empty playlist" ); |
|---|
| 90 | 82 | } |
|---|
| 91 | 83 | |
|---|
| 92 | 84 | void libvlc_playlist_prev( libvlc_instance_t *p_instance, |
|---|
| 93 | | libvlc_exception_t *p_exception ) |
|---|
| | 85 | libvlc_exception_t *p_e ) |
|---|
| 94 | 86 | { |
|---|
| 95 | 87 | if( playlist_Prev( p_instance->p_playlist ) != VLC_SUCCESS ) |
|---|
| 96 | | { |
|---|
| 97 | | libvlc_exception_raise( p_exception, "Empty playlist" ); |
|---|
| 98 | | } |
|---|
| | 88 | RAISEVOID( "Empty playlist" ); |
|---|
| 99 | 89 | } |
|---|
| 100 | 90 | |
|---|
| 101 | 91 | int libvlc_playlist_add( libvlc_instance_t *p_instance, const char *psz_uri, |
|---|
| 102 | | const char *psz_name, libvlc_exception_t *p_exception ) |
|---|
| | 92 | const char *psz_name, libvlc_exception_t *p_e ) |
|---|
| 103 | 93 | { |
|---|
| 104 | 94 | return libvlc_playlist_add_extended( p_instance, psz_uri, psz_name, |
|---|
| 105 | | 0, NULL, p_exception ); |
|---|
| | 95 | 0, NULL, p_e ); |
|---|
| 106 | 96 | } |
|---|
| 107 | 97 | |
|---|
| … | … | |
| 109 | 99 | const char *psz_uri, const char *psz_name, |
|---|
| 110 | 100 | int i_options, const char **ppsz_options, |
|---|
| 111 | | libvlc_exception_t *p_exception ) |
|---|
| | 101 | libvlc_exception_t *p_e ) |
|---|
| 112 | 102 | { |
|---|
| | 103 | assert( p_instance->p_playlist ); |
|---|
| 113 | 104 | return playlist_PlaylistAddExt( p_instance->p_playlist, psz_uri, psz_name, |
|---|
| 114 | 105 | PLAYLIST_INSERT, PLAYLIST_END, -1, ppsz_options, |
|---|
| … | … | |
| 117 | 108 | |
|---|
| 118 | 109 | int libvlc_playlist_delete_item( libvlc_instance_t *p_instance, int i_id, |
|---|
| 119 | | libvlc_exception_t *p_exception ) |
|---|
| | 110 | libvlc_exception_t *p_e ) |
|---|
| 120 | 111 | { |
|---|
| | 112 | assert( p_instance->p_playlist ); |
|---|
| 121 | 113 | return playlist_DeleteFromItemId( p_instance->p_playlist, i_id ); |
|---|
| 122 | 114 | } |
|---|
| … | … | |
| 124 | 116 | |
|---|
| 125 | 117 | int libvlc_playlist_isplaying( libvlc_instance_t *p_instance, |
|---|
| 126 | | libvlc_exception_t *p_exception ) |
|---|
| | 118 | libvlc_exception_t *p_e ) |
|---|
| 127 | 119 | { |
|---|
| 128 | | if( !p_instance->p_playlist ) |
|---|
| 129 | | { |
|---|
| 130 | | libvlc_exception_raise( p_exception, "No playlist" ); |
|---|
| 131 | | return 0; |
|---|
| 132 | | } |
|---|
| | 120 | assert( p_instance->p_playlist ); |
|---|
| 133 | 121 | return playlist_IsPlaying( p_instance->p_playlist ); |
|---|
| 134 | 122 | } |
|---|
| 135 | 123 | |
|---|
| 136 | 124 | int libvlc_playlist_items_count( libvlc_instance_t *p_instance, |
|---|
| 137 | | libvlc_exception_t *p_exception ) |
|---|
| | 125 | libvlc_exception_t *p_e ) |
|---|
| 138 | 126 | { |
|---|
| 139 | | if( !p_instance->p_playlist ) |
|---|
| 140 | | { |
|---|
| 141 | | libvlc_exception_raise( p_exception, "No playlist" ); |
|---|
| 142 | | return 0; |
|---|
| 143 | | } |
|---|
| | 127 | assert( p_instance->p_playlist ); |
|---|
| 144 | 128 | return p_instance->p_playlist->i_size; |
|---|
| 145 | 129 | } |
|---|
| 146 | 130 | |
|---|
| 147 | 131 | libvlc_input_t * libvlc_playlist_get_input( libvlc_instance_t *p_instance, |
|---|
| 148 | | libvlc_exception_t *p_exception ) |
|---|
| | 132 | libvlc_exception_t *p_e ) |
|---|
| 149 | 133 | { |
|---|
| 150 | 134 | libvlc_input_t *p_input; |
|---|
| | 135 | assert( p_instance->p_playlist ); |
|---|
| 151 | 136 | |
|---|
| 152 | 137 | vlc_mutex_lock( &p_instance->p_playlist->object_lock ); |
|---|
| 153 | 138 | if( p_instance->p_playlist->p_input == NULL ) |
|---|
| 154 | 139 | { |
|---|
| 155 | | libvlc_exception_raise( p_exception, "No active input" ); |
|---|
| | 140 | libvlc_exception_raise( p_e, "No active input" ); |
|---|
| 156 | 141 | vlc_mutex_unlock( &p_instance->p_playlist->object_lock ); |
|---|
| 157 | 142 | return NULL; |
|---|