Changeset 8444ce1225006facbe1b6742f8b864c66a64fe0d
- Timestamp:
- 02/15/06 23:31:49 (2 years ago)
- git-parent:
- Files:
-
- include/vlc/libvlc.h (modified) (1 diff)
- src/control/vlm.c (modified) (3 diffs)
- test/native/libvlc.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc/libvlc.h
re0003be r8444ce1 348 348 349 349 /** 350 * Set the output for a media 351 * \param p_instance the instance 352 * \param psz_name the media to work on 353 * \param psz_output the output MRL (the parameter to the "sout" variable) 354 * \param p_exception an initialized exception 355 */ 356 void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*, 357 libvlc_exception_t *); 358 359 /** 360 * Set a media's input MRL. This will delete all existing inputs and 361 * add the specified one. 362 * \param p_instance the instance 363 * \param psz_name the media to work on 364 * \param psz_input the input MRL 365 * \param p_exception an initialized exception 366 */ 367 void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*, 368 libvlc_exception_t *); 369 370 371 372 /** 373 * Set output for a media 374 * \param p_instance the instance 375 * \param psz_name the media to work on 376 * \param b_loop the new status 377 * \param p_exception an initialized exception 378 */ 379 void libvlc_vlm_set_loop( libvlc_instance_t *, char *, int, 380 libvlc_exception_t *); 381 382 383 384 385 /** 350 386 * Edit the parameters of a media. This will delete all existing inputs and 351 387 * add the specified one. src/control/vlm.c
rce98868 r8444ce1 39 39 libvlc_exception_raise( p_exception, \ 40 40 "Unable to create VLM" ); return; } } 41 42 #define GET_MEDIA { p_media = vlm_MediaSearch( p_instance->p_vlm, psz_name );\ 43 if( !p_media ) \ 44 { \ 45 libvlc_exception_raise( p_exception, \ 46 "Media %s does not exist", \ 47 psz_name ); return; } } 41 48 42 49 void libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance, char *psz_name, … … 83 90 vlm_media_t *p_media; 84 91 CHECK_VLM; 85 92 GET_MEDIA; 86 93 if( b_enabled != 0 ) b_enabled = 1; 87 88 p_media = vlm_MediaSearch( p_instance->p_vlm, psz_name );89 if( !p_media )90 {91 libvlc_exception_raise( p_exception, "Media %s does not exist",92 psz_name );93 return;94 }95 94 p_media->b_enabled = b_enabled; 96 95 } 96 97 void libvlc_vlm_set_loop( libvlc_instance_t *p_instance, char *psz_name, 98 int b_loop, libvlc_exception_t *p_exception ) 99 { 100 vlm_media_t *p_media; 101 CHECK_VLM; 102 GET_MEDIA; 103 if( b_loop != 0 ) b_loop = 1; 104 p_media->b_loop = b_loop; 105 } 106 107 void libvlc_vlm_set_output( libvlc_instance_t *p_instance, char *psz_name, 108 char *psz_output, libvlc_exception_t *p_exception ) 109 { 110 vlm_media_t *p_media; 111 int i_ret; 112 CHECK_VLM; 113 GET_MEDIA; 114 115 vlc_mutex_lock( &p_instance->p_vlm->lock ); 116 i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output ); 117 if( i_ret ) 118 { libvlc_exception_raise( p_exception, "Unable to set output" ); return;} 119 vlc_mutex_unlock( &p_instance->p_vlm->lock ); 120 } 121 122 void libvlc_vlm_set_input( libvlc_instance_t *p_instance, char *psz_name, 123 char *psz_input, libvlc_exception_t *p_exception ) 124 { 125 vlm_media_t *p_media; 126 int i_ret; 127 CHECK_VLM; 128 GET_MEDIA; 129 130 vlc_mutex_lock( &p_instance->p_vlm->lock ); 131 132 vlm_MediaSetup( p_instance->p_vlm, p_media, "inputdel", "all" ); 133 if( i_ret ) 134 { libvlc_exception_raise( p_exception, "Unable to change input" ); return;} 135 vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input ); 136 if( i_ret ) 137 { libvlc_exception_raise( p_exception, "Unable to change input" ); return;} 138 139 vlc_mutex_unlock( &p_instance->p_vlm->lock ); 140 } 141 142 void libvlc_vlm_add_input( libvlc_instance_t *p_instance, char *psz_name, 143 char *psz_input, libvlc_exception_t *p_exception ) 144 { 145 vlm_media_t *p_media; 146 int i_ret; 147 CHECK_VLM; 148 GET_MEDIA; 149 150 vlc_mutex_lock( &p_instance->p_vlm->lock ); 151 152 vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input ); 153 if( i_ret ) 154 { libvlc_exception_raise( p_exception, "Unable to change input" ); return;} 155 156 vlc_mutex_unlock( &p_instance->p_vlm->lock ); 157 } 158 159 160 97 161 98 162 void libvlc_vlm_change_media( libvlc_instance_t *p_instance, char *psz_name, … … 102 166 { 103 167 vlm_media_t *p_media; 168 int i_ret; 104 169 CHECK_VLM; 170 GET_MEDIA; 105 171 if( b_enabled != 0 ) b_enabled = 1; 106 172 if( b_loop != 0 ) b_loop = 1; 107 173 108 p_media = vlm_MediaSearch( p_instance->p_vlm, psz_name ); 109 if( !p_media ) 110 { 111 libvlc_exception_raise( p_exception, "Media %s does not exist", 112 psz_name ); 113 return; 114 } 174 vlc_mutex_lock( &p_instance->p_vlm->lock ); 175 i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output ); 176 if( i_ret ) libvlc_exception_raise( p_exception, "Unable to set output" ); 115 177 p_media->b_enabled = b_enabled; 116 178 p_media->b_loop = b_loop; 179 180 i_ret = vlm_MediaSetup( p_instance->p_vlm, p_media, "output", psz_output ); 181 if( i_ret ) 182 { libvlc_exception_raise( p_exception, "Unable to set output" ); return;} 183 vlm_MediaSetup( p_instance->p_vlm, p_media, "inputdel", "all" ); 184 if( i_ret ) 185 { libvlc_exception_raise( p_exception, "Unable to change input" ); return;} 186 vlm_MediaSetup( p_instance->p_vlm, p_media, "input", psz_input ); 187 if( i_ret ) 188 { libvlc_exception_raise( p_exception, "Unable to change input" ); return;} 189 190 vlc_mutex_unlock( &p_instance->p_vlm->lock ); 117 191 } test/native/libvlc.c
ref273c0 r8444ce1 94 94 libvlc_instance_t *p_instance; 95 95 char *argv[] = { "vlc", "--quiet" }; 96 char *ppsz_empty[] = {}; 96 97 libvlc_exception_t exception; 97 98 libvlc_exception_init( &exception ); … … 99 100 p_instance = libvlc_new( 2, argv, &exception ); 100 101 ASSERT_NOEXCEPTION; 101 102 103 /* Test that working on unexisting streams fail */ 102 104 libvlc_vlm_set_enabled( p_instance, "test", 1, &exception ); 103 105 ASSERT_EXCEPTION; 104 106 libvlc_exception_clear( &exception ); 107 libvlc_vlm_set_input( p_instance, "test", "input", &exception ); 108 ASSERT_EXCEPTION; 109 libvlc_exception_clear( &exception ); 110 libvlc_vlm_del_media( p_instance, "test", &exception ); 111 ASSERT_EXCEPTION; 112 libvlc_exception_clear( &exception ); 113 114 /******* Broadcast *******/ 115 /* Now create a media */ 116 libvlc_vlm_add_broadcast( p_instance, "test", "input_test", "output_test", 117 0, ppsz_empty, 1, 1, &exception ); 118 ASSERT_NOEXCEPTION; 119 libvlc_exception_clear( &exception ); 120 121 /* Change its parameters */ 122 libvlc_vlm_set_enabled( p_instance, "test", 0, &exception ); 123 ASSERT_NOEXCEPTION; 124 libvlc_exception_clear( &exception ); 125 libvlc_vlm_set_output( p_instance, "test", "output_test2", &exception ); 126 ASSERT_NOEXCEPTION; 127 libvlc_exception_clear( &exception ); 128 129 /* Check the parameters */ 130 fprintf( stderr, "The code for this is not written yet\n"); 131 132 /* Control it a bit */ 133 fprintf( stderr, "The code for this is not written yet\n"); 134 135 /* Try to delete it */ 136 libvlc_vlm_del_media( p_instance, "test", &exception ); 137 ASSERT_NOEXCEPTION; 138 libvlc_exception_clear( &exception ); 139 140 libvlc_vlm_del_media( p_instance, "test", &exception ); 141 ASSERT_EXCEPTION; 142 libvlc_exception_clear( &exception ); 143 144 /******* VOD *******/ 105 145 106 146 Py_INCREF( Py_None );
