Changeset acfc0a55ff1669dbb02dd3d796fe4727b7f6844b
- Timestamp:
- 07/01/07 14:22:37 (2 years ago)
- git-parent:
- Files:
-
- activex/axvlc.idl (modified) (1 diff)
- activex/vlccontrol2.cpp (modified) (2 diffs)
- activex/vlccontrol2.h (modified) (1 diff)
- include/vlc/libvlc.h (modified) (1 diff)
- mozilla/control/npolibvlc.cpp (modified) (2 diffs)
- src/control/audio.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
activex/axvlc.idl
r2dfa55b racfc0a5 207 207 208 208 [propget, helpstring("Returns audio channel: reverse stereo, stereo, left, right, dolby.")] 209 HRESULT channel([out, retval] BSTR* channel);209 HRESULT channel([out, retval] long* channel); 210 210 [propput, helpstring("Sets audio channel to: reverse stereo, stereo, left, right, dolby.")] 211 HRESULT channel([in] BSTRchannel);211 HRESULT channel([in] long channel); 212 212 }; 213 213 activex/vlccontrol2.cpp
r600555d racfc0a5 249 249 }; 250 250 251 STDMETHODIMP VLCAudio::get_channel( BSTR*channel)251 STDMETHODIMP VLCAudio::get_channel(long *channel) 252 252 { 253 253 if( NULL == channel ) … … 258 258 if( SUCCEEDED(hr) ) 259 259 { 260 char *psz_channel = NULL; 261 libvlc_exception_t ex; 262 libvlc_exception_init(&ex); 263 264 psz_channel = libvlc_audio_get_channel(p_libvlc, &ex); 265 if( ! libvlc_exception_raised(&ex) ) 266 { 267 if( NULL == psz_channel ) 268 return E_OUTOFMEMORY; 269 270 *channel = BSTRFromCStr(CP_UTF8, psz_channel); 271 free( psz_channel ); 272 psz_channel = NULL; 273 return (NULL == channel) ? E_OUTOFMEMORY : NOERROR; 274 } 275 if( psz_channel ) free( psz_channel ); 276 psz_channel = NULL; 277 _p_instance->setErrorInfo(IID_IVLCAudio, 278 libvlc_exception_get_message(&ex)); 279 libvlc_exception_clear(&ex); 280 return E_FAIL; 281 } 282 return hr; 283 }; 284 285 STDMETHODIMP VLCAudio::put_channel(BSTR channel) 286 { 287 if( NULL == channel ) 288 return E_POINTER; 289 290 if( 0 == SysStringLen(channel) ) 291 return E_INVALIDARG; 292 293 libvlc_instance_t* p_libvlc; 294 HRESULT hr = _p_instance->getVLC(&p_libvlc); 295 if( SUCCEEDED(hr) ) 296 { 297 char *psz_channel = NULL; 298 libvlc_exception_t ex; 299 libvlc_exception_init(&ex); 300 301 psz_channel = CStrFromBSTR(CP_UTF8, channel); 302 if( NULL == psz_channel ) 303 return E_OUTOFMEMORY; 304 305 libvlc_audio_set_channel(p_libvlc, psz_channel, &ex); 306 CoTaskMemFree(psz_channel); 260 libvlc_exception_t ex; 261 libvlc_exception_init(&ex); 262 263 *channel = libvlc_audio_get_channel(p_libvlc, &ex); 264 if( libvlc_exception_raised(&ex) ) 265 { 266 _p_instance->setErrorInfo(IID_IVLCAudio, 267 libvlc_exception_get_message(&ex)); 268 libvlc_exception_clear(&ex); 269 return E_FAIL; 270 } 271 return NOERROR; 272 } 273 return hr; 274 }; 275 276 STDMETHODIMP VLCAudio::put_channel(long channel) 277 { 278 libvlc_instance_t* p_libvlc; 279 HRESULT hr = _p_instance->getVLC(&p_libvlc); 280 if( SUCCEEDED(hr) ) 281 { 282 libvlc_exception_t ex; 283 libvlc_exception_init(&ex); 284 285 libvlc_audio_set_channel(p_libvlc, channel, &ex); 307 286 if( libvlc_exception_raised(&ex) ) 308 287 { activex/vlccontrol2.h
r0459ac1 racfc0a5 69 69 STDMETHODIMP get_track(long*); 70 70 STDMETHODIMP put_track(long); 71 STDMETHODIMP get_channel( BSTR*);72 STDMETHODIMP put_channel( BSTR);71 STDMETHODIMP get_channel(long*); 72 STDMETHODIMP put_channel(long); 73 73 STDMETHODIMP toggleMute(); 74 74 include/vlc/libvlc.h
ra77fdc2 racfc0a5 511 511 * \param p_instance input instance 512 512 * \param p_exception an initialized exception 513 * \return the audio channel ( char *)514 */ 515 char *libvlc_audio_get_channel( libvlc_instance_t *, libvlc_exception_t * );513 * \return the audio channel (int) 514 */ 515 int libvlc_audio_get_channel( libvlc_instance_t *, libvlc_exception_t * ); 516 516 517 517 /** 518 518 * Set current audio channel 519 519 * \param p_instance input instance 520 * \param psz_channel the audio channel (char *)521 * \param p_exception an initialized exception 522 */ 523 void libvlc_audio_set_channel( libvlc_instance_t *, char *, libvlc_exception_t * );520 * \param i_channel the audio channel (int) 521 * \param p_exception an initialized exception 522 */ 523 void libvlc_audio_set_channel( libvlc_instance_t *, int, libvlc_exception_t * ); 524 524 525 525 /** @} */ mozilla/control/npolibvlc.cpp
r2dfa55b racfc0a5 251 251 case ID_audio_channel: 252 252 { 253 NPUTF8 *psz_channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex); 254 libvlc_input_free(p_input); 255 if( libvlc_exception_raised(&ex) ) 256 { 257 NPN_SetException(this, libvlc_exception_get_message(&ex)); 258 libvlc_exception_clear(&ex); 259 return INVOKERESULT_GENERIC_ERROR; 260 } 261 if( !psz_channel ) 262 return INVOKERESULT_GENERIC_ERROR; 263 264 STRINGZ_TO_NPVARIANT(psz_channel, result); 253 int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex); 254 libvlc_input_free(p_input); 255 if( libvlc_exception_raised(&ex) ) 256 { 257 NPN_SetException(this, libvlc_exception_get_message(&ex)); 258 libvlc_exception_clear(&ex); 259 return INVOKERESULT_GENERIC_ERROR; 260 } 261 INT32_TO_NPVARIANT(channel, result); 265 262 return INVOKERESULT_NO_ERROR; 266 263 } … … 339 336 case ID_audio_channel: 340 337 { 341 char *psz_channel = NULL; 342 343 libvlc_input_free(p_input); 344 if( ! NPVARIANT_IS_STRING(value) ) 345 return INVOKERESULT_INVALID_VALUE; 346 347 psz_channel = stringValue(NPVARIANT_TO_STRING(value)); 348 if( !psz_channel ) 349 return INVOKERESULT_GENERIC_ERROR; 350 351 libvlc_audio_set_channel(p_plugin->getVLC(), psz_channel, &ex); 352 if( psz_channel ) 353 free( psz_channel ); 354 355 if( libvlc_exception_raised(&ex) ) 356 { 357 NPN_SetException(this, libvlc_exception_get_message(&ex)); 358 libvlc_exception_clear(&ex); 359 return INVOKERESULT_GENERIC_ERROR; 360 } 361 return INVOKERESULT_NO_ERROR; 338 libvlc_input_free(p_input); 339 if( isNumberValue(value) ) 340 { 341 libvlc_audio_set_channel(p_plugin->getVLC(), 342 numberValue(value), &ex); 343 if( libvlc_exception_raised(&ex) ) 344 { 345 NPN_SetException(this, libvlc_exception_get_message(&ex)); 346 libvlc_exception_clear(&ex); 347 return INVOKERESULT_GENERIC_ERROR; 348 } 349 return INVOKERESULT_NO_ERROR; 350 } 351 return INVOKERESULT_INVALID_VALUE; 362 352 } 363 353 default: src/control/audio.c
r6e16579 racfc0a5 188 188 * libvlc_audio_get_channel : Get the current audio channel 189 189 *****************************************************************************/ 190 char *libvlc_audio_get_channel( libvlc_instance_t *p_instance,190 int libvlc_audio_get_channel( libvlc_instance_t *p_instance, 191 191 libvlc_exception_t *p_e ) 192 192 { 193 193 aout_instance_t *p_aout = GetAOut( p_instance, p_e ); 194 char *psz_channel = NULL;195 194 vlc_value_t val; 196 195 197 196 var_Get( p_aout, "audio-channels", &val ); 198 switch( val.i_int ) 197 vlc_object_release( p_aout ); 198 return val.i_int; 199 } 200 201 /***************************************************************************** 202 * libvlc_audio_set_channel : Set the current audio channel 203 *****************************************************************************/ 204 void libvlc_audio_set_channel( libvlc_instance_t *p_instance, int i_channel, 205 libvlc_exception_t *p_e ) 206 { 207 aout_instance_t *p_aout = GetAOut( p_instance, p_e ); 208 vlc_value_t val; 209 int i_ret = -1; 210 211 val.i_int = i_channel; 212 switch( i_channel ) 199 213 { 200 214 case AOUT_VAR_CHAN_RSTEREO: 201 psz_channel = strdup("reverse stereo");202 break;203 215 case AOUT_VAR_CHAN_STEREO: 204 psz_channel = strdup("stereo");205 break;206 216 case AOUT_VAR_CHAN_LEFT: 207 psz_channel = strdup("left");208 break;209 217 case AOUT_VAR_CHAN_RIGHT: 210 psz_channel = strdup("right");211 break;212 218 case AOUT_VAR_CHAN_DOLBYS: 213 psz_channel = strdup("dolby");214 break;215 default:216 psz_channel = strdup("disabled");217 break;218 }219 vlc_object_release( p_aout );220 return psz_channel;221 }222 223 /*****************************************************************************224 * libvlc_audio_set_channel : Set the current audio channel225 *****************************************************************************/226 void libvlc_audio_set_channel( libvlc_instance_t *p_instance, char *psz_channel,227 libvlc_exception_t *p_e )228 {229 aout_instance_t *p_aout = GetAOut( p_instance, p_e );230 vlc_value_t val_list, text_list;231 int i_ret = -1, i;232 233 i_ret = var_Change( p_aout, "audio-channels", VLC_VAR_GETCHOICES, &val_list, &text_list );234 if( (i_ret < 0) || !psz_channel )235 {236 libvlc_exception_raise( p_e, "Audio channel out of range" );237 vlc_object_release( p_aout );238 return;239 }240 241 for( i = 0; i < val_list.p_list->i_count; i++ )242 {243 vlc_value_t val = val_list.p_list->p_values[i];244 vlc_value_t text = text_list.p_list->p_values[i];245 246 if( strncasecmp( psz_channel, text.psz_string, strlen(text.psz_string) ) == 0 )247 {248 219 i_ret = var_Set( p_aout, "audio-channels", val ); 249 220 if( i_ret < 0 ) 250 221 { 251 libvlc_exception_raise( p_e, " failed setting audio range" );222 libvlc_exception_raise( p_e, "Failed setting audio channel" ); 252 223 vlc_object_release( p_aout ); 253 224 return; … … 255 226 vlc_object_release( p_aout ); 256 227 return; /* Found */ 257 } 258 } 259 libvlc_exception_raise( p_e, "Audio channel out of range" ); 228 default: 229 libvlc_exception_raise( p_e, "Audio channel out of range" ); 230 break; 231 } 260 232 vlc_object_release( p_aout ); 261 233 } 262
