Changeset ced125da0699eb348462270926a6802288800433
- Timestamp:
- 03/02/08 17:07:53 (4 months ago)
- git-parent:
- Files:
-
- modules/audio_output/waveout.c (modified) (36 diffs, 1 prop)
- po/ca.po (modified) (639 diffs)
- share/vlc_win32_rc.rc (modified) (1 diff, 1 prop)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/audio_output/waveout.c
- Property mode changed from 100755 to 100644
r9438646 rced125d 32 32 #include <vlc/vlc.h> 33 33 #include <vlc_aout.h> 34 #include <vlc_charset.h>35 34 36 35 #include <windows.h> … … 122 121 /* local functions */ 123 122 static void Probe ( aout_instance_t * ); 124 static int OpenWaveOut ( aout_instance_t *, uint32_t, 125 int, int, int, int, vlc_bool_t ); 126 static int OpenWaveOutPCM( aout_instance_t *, uint32_t, 127 int*, int, int, int, vlc_bool_t ); 123 static int OpenWaveOut ( aout_instance_t *, int, int, int, int, vlc_bool_t ); 124 static int OpenWaveOutPCM( aout_instance_t *, int*, int, int, int, vlc_bool_t ); 128 125 static int PlayWaveOut ( aout_instance_t *, HWAVEOUT, WAVEHDR *, 129 aout_buffer_t * , vlc_bool_t);126 aout_buffer_t * ); 130 127 131 128 static void CALLBACK WaveOutCallback ( HWAVEOUT, UINT, DWORD, DWORD, DWORD ); … … 135 132 static int VolumeGet( aout_instance_t *, audio_volume_t * ); 136 133 static int VolumeSet( aout_instance_t *, audio_volume_t ); 137 138 static int WaveOutClearDoneBuffers(aout_sys_t *p_sys);139 140 static int ReloadWaveoutDevices( vlc_object_t *, char const *,141 vlc_value_t, vlc_value_t, void * );142 static uint32_t findDeviceID(char *);143 144 static const char psz_device_name_fmt[] = "%s ($%x,$%x)";145 146 static const char *ppsz_adev[] = { "wavemapper", };147 static const char *ppsz_adev_text[] = { N_("Microsoft Soundmapper") };148 149 150 134 151 135 /***************************************************************************** … … 156 140 "The option allows you to enable or disable the high-quality float32 " \ 157 141 "audio output mode (which is not well supported by some soundcards)." ) 158 #define DEVICE_TEXT N_("Select Audio Device")159 #define DEVICE_LONG N_("Select special Audio device, or let windows "\160 "decide (default), change needs VLC restart "\161 "to apply.")162 #define DEFAULT_AUDIO_DEVICE N_("Default Audio Device")163 142 164 143 vlc_module_begin(); … … 169 148 set_subcategory( SUBCAT_AUDIO_AOUT ); 170 149 add_bool( "waveout-float32", 1, 0, FLOAT_TEXT, FLOAT_LONGTEXT, VLC_TRUE ); 171 172 add_string( "waveout-dev", "wavemapper", NULL,173 DEVICE_TEXT, DEVICE_LONG, VLC_FALSE );174 change_string_list( ppsz_adev, ppsz_adev_text, ReloadWaveoutDevices );175 change_need_restart();176 change_action_add( ReloadWaveoutDevices, N_("Refresh list") );177 178 179 150 set_callbacks( Open, Close ); 180 151 vlc_module_end(); … … 188 159 struct aout_sys_t 189 160 { 190 uint32_t i_wave_device_id; /* ID of selected output device */191 192 161 HWAVEOUT h_waveout; /* handle to waveout instance */ 193 162 … … 198 167 notification_thread_t *p_notif; /* WaveOutThread id */ 199 168 HANDLE event; 200 HANDLE new_buffer_event;201 202 // rental from alsa.c to synchronize startup of audiothread203 int b_playing; /* playing status */204 mtime_t start_date;205 206 int i_repeat_counter;207 169 208 170 int i_buffer_size; … … 253 215 p_aout->b_die = VLC_FALSE; 254 216 255 256 /*257 initialize/update Device selection List258 */259 ReloadWaveoutDevices( p_this, "waveout-dev", val, val, NULL);260 261 262 /*263 check for configured audio device!264 */265 char *psz_waveout_dev = var_CreateGetString( p_aout, "waveout-dev");266 267 p_aout->output.p_sys->i_wave_device_id =268 findDeviceID( psz_waveout_dev );269 270 if(p_aout->output.p_sys->i_wave_device_id == WAVE_MAPPER)271 {272 if(psz_waveout_dev &&273 stricmp(psz_waveout_dev,"wavemapper"))274 {275 msg_Warn( p_aout, "configured audio device '%s' not available, "\276 "use default instead", psz_waveout_dev );277 }278 }279 if(psz_waveout_dev) free( psz_waveout_dev );280 281 282 WAVEOUTCAPS waveoutcaps;283 if(waveOutGetDevCaps( p_aout->output.p_sys->i_wave_device_id,284 &waveoutcaps,285 sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR)286 {287 /* log debug some infos about driver, to know who to blame288 if it doesn't work */289 msg_Dbg( p_aout, "Drivername: %s", waveoutcaps.szPname);290 msg_Dbg( p_aout, "Driver Version: %d.%d",291 (waveoutcaps.vDriverVersion>>8)&255,292 waveoutcaps.vDriverVersion & 255);293 msg_Dbg( p_aout, "Manufacturer identifier: 0x%x", waveoutcaps.wMid );294 msg_Dbg( p_aout, "Product identifier: 0x%x", waveoutcaps.wPid );295 }296 297 298 299 217 if( var_Type( p_aout, "audio-device" ) == 0 ) 300 218 { … … 305 223 { 306 224 /* Probe() has failed. */ 307 var_Destroy( p_aout, "waveout-device");308 225 free( p_aout->output.p_sys ); 309 226 return VLC_EGENERIC; 310 227 } 311 228 229 var_Create( p_aout, "waveout-float32", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 312 230 313 231 /* Open the device */ … … 316 234 p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i'); 317 235 318 if( OpenWaveOut( p_aout, 319 p_aout->output.p_sys->i_wave_device_id, 320 VLC_FOURCC('s','p','d','i'), 236 if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'), 321 237 p_aout->output.output.i_physical_channels, 322 238 aout_FormatNbChannels( &p_aout->output.output ), … … 365 281 } 366 282 367 if( OpenWaveOutPCM( p_aout, 368 p_aout->output.p_sys->i_wave_device_id, 369 &p_aout->output.output.i_format, 283 if( OpenWaveOutPCM( p_aout, &p_aout->output.output.i_format, 370 284 p_aout->output.output.i_physical_channels, 371 285 aout_FormatNbChannels( &p_aout->output.output ), … … 414 328 return 1; 415 329 } 416 p_aout->output.p_sys->i_repeat_counter = 0;417 418 330 419 331 /* Zero the buffer. WinCE doesn't have calloc(). */ … … 426 338 p_aout->output.p_sys->p_notif->p_aout = p_aout; 427 339 p_aout->output.p_sys->event = CreateEvent( NULL, FALSE, FALSE, NULL ); 428 p_aout->output.p_sys->new_buffer_event = CreateEvent( NULL, FALSE, FALSE, NULL );429 430 /* define startpoint of playback on first call to play()431 like alsa does (instead of playing a blank sample) */432 p_aout->output.p_sys->b_playing = 0;433 p_aout->output.p_sys->start_date = 0;434 435 340 436 341 /* Then launch the notification thread */ 437 342 if( vlc_thread_create( p_aout->output.p_sys->p_notif, 438 343 "waveOut Notification Thread", WaveOutThread, 439 VLC_THREAD_PRIORITY_ OUTPUT, VLC_FALSE ) )344 VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) ) 440 345 { 441 346 msg_Err( p_aout, "cannot create WaveOutThread" ); … … 449 354 p_aout->output.p_sys->waveheader[i].dwUser = 0; 450 355 } 356 PlayWaveOut( p_aout, p_aout->output.p_sys->h_waveout, 357 &p_aout->output.p_sys->waveheader[0], NULL ); 451 358 452 359 return 0; … … 472 379 if( p_aout->output.output.i_physical_channels == i_physical_channels ) 473 380 { 474 if( OpenWaveOutPCM( p_aout, 475 p_aout->output.p_sys->i_wave_device_id, 476 &i_format, 381 if( OpenWaveOutPCM( p_aout, &i_format, 477 382 i_physical_channels, 6, 478 383 p_aout->output.output.i_rate, VLC_TRUE ) … … 480 385 { 481 386 val.i_int = AOUT_VAR_5_1; 482 text.psz_string = (char *)N_("5.1");387 text.psz_string = N_("5.1"); 483 388 var_Change( p_aout, "audio-device", 484 389 VLC_VAR_ADDCHOICE, &val, &text ); … … 493 398 == i_physical_channels ) 494 399 { 495 if( OpenWaveOutPCM( p_aout, 496 p_aout->output.p_sys->i_wave_device_id, 497 &i_format, 400 if( OpenWaveOutPCM( p_aout, &i_format, 498 401 i_physical_channels, 4, 499 402 p_aout->output.output.i_rate, VLC_TRUE ) … … 501 404 { 502 405 val.i_int = AOUT_VAR_2F2R; 503 text.psz_string = (char *)N_("2 Front 2 Rear");406 text.psz_string = N_("2 Front 2 Rear"); 504 407 var_Change( p_aout, "audio-device", 505 408 VLC_VAR_ADDCHOICE, &val, &text ); … … 510 413 /* Test for stereo support */ 511 414 i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; 512 if( OpenWaveOutPCM( p_aout, 513 p_aout->output.p_sys->i_wave_device_id, 514 &i_format, 415 if( OpenWaveOutPCM( p_aout, &i_format, 515 416 i_physical_channels, 2, 516 417 p_aout->output.output.i_rate, VLC_TRUE ) … … 518 419 { 519 420 val.i_int = AOUT_VAR_STEREO; 520 text.psz_string = (char *)N_("Stereo");421 text.psz_string = N_("Stereo"); 521 422 var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); 522 423 msg_Dbg( p_aout, "device supports 2 channels" ); … … 525 426 /* Test for mono support */ 526 427 i_physical_channels = AOUT_CHAN_CENTER; 527 if( OpenWaveOutPCM( p_aout, 528 p_aout->output.p_sys->i_wave_device_id, 529 &i_format, 428 if( OpenWaveOutPCM( p_aout, &i_format, 530 429 i_physical_channels, 1, 531 430 p_aout->output.output.i_rate, VLC_TRUE ) … … 533 432 { 534 433 val.i_int = AOUT_VAR_MONO; 535 text.psz_string = (char *)N_("Mono");434 text.psz_string = N_("Mono"); 536 435 var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); 537 436 msg_Dbg( p_aout, "device supports 1 channel" ); … … 541 440 if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) 542 441 { 543 if( OpenWaveOut( p_aout, 544 p_aout->output.p_sys->i_wave_device_id, 545 VLC_FOURCC('s','p','d','i'), 442 if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'), 546 443 p_aout->output.output.i_physical_channels, 547 444 aout_FormatNbChannels( &p_aout->output.output ), … … 551 448 msg_Dbg( p_aout, "device supports A/52 over S/PDIF" ); 552 449 val.i_int = AOUT_VAR_SPDIF; 553 text.psz_string = (char *)N_("A/52 over S/PDIF");450 text.psz_string = N_("A/52 over S/PDIF"); 554 451 var_Change( p_aout, "audio-device", 555 452 VLC_VAR_ADDCHOICE, &val, &text ); … … 581 478 static void Play( aout_instance_t *_p_aout ) 582 479 { 583 if( !_p_aout->output.p_sys->b_playing )584 {585 _p_aout->output.p_sys->b_playing = 1;586 587 /* get the playing date of the first aout buffer */588 _p_aout->output.p_sys->start_date =589 aout_FifoFirstDate( _p_aout, &_p_aout->output.fifo );590 591 msg_Dbg( _p_aout, "Wakeup sleeping output thread.");592 593 /* wake up the audio output thread */594 SetEvent( _p_aout->output.p_sys->event );595 } else {596 SetEvent( _p_aout->output.p_sys->new_buffer_event );597 }598 480 } 599 481 … … 609 491 vlc_object_kill( p_aout ); 610 492 611 /* wake up the audio thread, to recognize that p_aout died */ 493 waveOutReset( p_sys->h_waveout ); 494 495 /* wake up the audio thread */ 612 496 SetEvent( p_sys->event ); 613 SetEvent( p_sys->new_buffer_event );614 615 497 vlc_thread_join( p_sys->p_notif ); 616 498 vlc_object_release( p_sys->p_notif ); 617 618 /* 619 kill the real output then - when the feed thread 620 is surely terminated! 621 old code could be too early in case that "feeding" 622 was running on termination 623 624 at this point now its sure, that there will be no new 625 data send to the driver, and we can cancel the last 626 running playbuffers 627 */ 628 MMRESULT result = waveOutReset( p_sys->h_waveout ); 629 if(result != MMSYSERR_NOERROR) 630 { 631 msg_Err( p_aout, "waveOutReset failed 0x%x", result ); 632 /* 633 now we must wait, that all buffers are played 634 because cancel doesn't work in this case... 635 */ 636 if(result == MMSYSERR_NOTSUPPORTED) 637 { 638 /* 639 clear currently played (done) buffers, 640 if returnvalue > 0 (means some buffer still playing) 641 wait for the driver event callback that one buffer 642 is finished with playing, and check again 643 the timeout of 5000ms is just, an emergency exit 644 of this loop, to avoid deadlock in case of other 645 (currently not known bugs, problems, errors cases?) 646 */ 647 while( 648 (WaveOutClearDoneBuffers( p_sys ) > 0) 649 && 650 (WaitForSingleObject( p_sys->event, 5000) == WAIT_OBJECT_0) 651 ) 652 { 653 msg_Dbg( p_aout, "Wait for waveout device..."); 654 } 655 } 656 } else { 657 WaveOutClearDoneBuffers( p_sys ); 658 } 659 660 /* now we can Close the device */ 499 CloseHandle( p_sys->event ); 500 501 /* Close the device */ 661 502 if( waveOutClose( p_sys->h_waveout ) != MMSYSERR_NOERROR ) 662 503 { 663 504 msg_Err( p_aout, "waveOutClose failed" ); 664 505 } 665 666 /*667 because so long, the waveout device is playing, the callback668 could occur and need the events669 */670 CloseHandle( p_sys->event );671 CloseHandle( p_sys->new_buffer_event);672 506 673 507 free( p_sys->p_silence_buffer ); … … 678 512 * OpenWaveOut: open the waveout sound device 679 513 ****************************************************************************/ 680 static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id,int i_format,514 static int OpenWaveOut( aout_instance_t *p_aout, int i_format, 681 515 int i_channels, int i_nb_channels, int i_rate, 682 516 vlc_bool_t b_probe ) … … 745 579 } 746 580 747 if(!b_probe) {748 msg_Dbg( p_aout, "OpenWaveDevice-ID: %u", i_device_id);749 msg_Dbg( p_aout,"waveformat.Format.cbSize = %d",750 waveformat.Format.cbSize);751 msg_Dbg( p_aout,"waveformat.Format.wFormatTag = %u",752 waveformat.Format.wFormatTag);753 msg_Dbg( p_aout,"waveformat.Format.nChannels = %u",754 waveformat.Format.nChannels);755 msg_Dbg( p_aout,"waveformat.Format.nSamplesPerSec = %d",756 (int)waveformat.Format.nSamplesPerSec);757 msg_Dbg( p_aout,"waveformat.Format.nAvgBytesPerSec = %u",758 (int)waveformat.Format.nAvgBytesPerSec);759 msg_Dbg( p_aout,"waveformat.Format.nBlockAlign = %d",760 waveformat.Format.nBlockAlign);761 msg_Dbg( p_aout,"waveformat.Format.wBitsPerSample = %d",762 waveformat.Format.wBitsPerSample);763 msg_Dbg( p_aout,"waveformat.Samples.wValidBitsPerSample = %d",764 waveformat.Samples.wValidBitsPerSample);765 msg_Dbg( p_aout,"waveformat.Samples.wSamplesPerBlock = %d",766 waveformat.Samples.wSamplesPerBlock);767 msg_Dbg( p_aout,"waveformat.dwChannelMask = %lu",768 waveformat.dwChannelMask);769 }770 771 581 /* Open the device */ 772 result = waveOutOpen( &p_aout->output.p_sys->h_waveout, i_device_id,582 result = waveOutOpen( &p_aout->output.p_sys->h_waveout, WAVE_MAPPER, 773 583 (WAVEFORMATEX *)&waveformat, 774 584 (DWORD_PTR)WaveOutCallback, (DWORD_PTR)p_aout, … … 809 619 * OpenWaveOutPCM: open a PCM waveout sound device 810 620 ****************************************************************************/ 811 static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id,int *i_format,621 static int OpenWaveOutPCM( aout_instance_t *p_aout, int *i_format, 812 622 int i_channels, int i_nb_channels, int i_rate, 813 623 vlc_bool_t b_probe ) 814 624 { 815 vlc_bool_t b_use_float32 = var_CreateGetBool( p_aout, "waveout-float32"); 816 817 if( !b_use_float32 || OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('f','l','3','2'), 625 vlc_value_t val; 626 627 var_Get( p_aout, "waveout-float32", &val ); 628 629 if( !val.b_bool || OpenWaveOut( p_aout, VLC_FOURCC('f','l','3','2'), 818 630 i_channels, i_nb_channels, i_rate, b_probe ) 819 631 != VLC_SUCCESS ) 820 632 { 821 if ( OpenWaveOut( p_aout, i_device_id,VLC_FOURCC('s','1','6','l'),633 if ( OpenWaveOut( p_aout, VLC_FOURCC('s','1','6','l'), 822 634 i_channels, i_nb_channels, i_rate, b_probe ) 823 635 != VLC_SUCCESS ) … … 842 654 *****************************************************************************/ 843 655 static int PlayWaveOut( aout_instance_t *p_aout, HWAVEOUT h_waveout, 844 WAVEHDR *p_waveheader, aout_buffer_t *p_buffer, 845 vlc_bool_t b_spdif) 656 WAVEHDR *p_waveheader, aout_buffer_t *p_buffer ) 846 657 { 847 658 MMRESULT result; 848 659 849 660 /* Prepare the buffer */ 850 if( p_buffer != NULL ) 851 { 661 if( p_buffer != NULL ) 852 662 p_waveheader->lpData = p_buffer->p_buffer; 853 /* 854 copy the buffer to the silence buffer :) so in case we don't 855 get the next buffer fast enough (I will repeat this one a time 856 for AC3 / DTS and SPDIF this will sound better instead of 857 a hickup) 858 */ 859 if(b_spdif) 860 { 861 p_aout->p_libvlc->pf_memcpy( p_aout->output.p_sys->p_silence_buffer, 862 p_buffer->p_buffer, 863 p_aout->output.p_sys->i_buffer_size ); 864 p_aout->output.p_sys->i_repeat_counter = 2; 865 } 866 } else { 663 else 867 664 /* Use silence buffer instead */ 868 if(p_aout->output.p_sys->i_repeat_counter)869 {870 p_aout->output.p_sys->i_repeat_counter--;871 if(!p_aout->output.p_sys->i_repeat_counter)872 {873 p_aout->p_libvlc->pf_memset( p_aout->output.p_sys->p_silence_buffer,874 0x00,875 p_aout->output.p_sys->i_buffer_size876 );877 }878 }879 665 p_waveheader->lpData = p_aout->output.p_sys->p_silence_buffer; 880 }881 666 882 667 p_waveheader->dwUser = p_buffer ? (DWORD_PTR)p_buffer : (DWORD_PTR)1; … … 927 712 928 713 /* Don't wake up the thread too much */ 929 if( i_queued_frames < = FRAMES_NUM/2 )714 if( i_queued_frames < FRAMES_NUM / 2 ) 930 715 SetEvent( p_aout->output.p_sys->event ); 931 }932 933 934 /****************************************************************************935 * WaveOutClearDoneBuffers: Clear all done marked buffers, and free aout_bufer936 ****************************************************************************937 * return value is the number of still playing buffers in the queue938 ****************************************************************************/939 static int WaveOutClearDoneBuffers(aout_sys_t *p_sys)940 {941 WAVEHDR *p_waveheader = p_sys->waveheader;942 int i_queued_frames = 0;943 944 for( int i = 0; i < FRAMES_NUM; i++ )945 {946 if( (p_waveheader[i].dwFlags & WHDR_DONE) &&947 p_waveheader[i].dwUser )948 {949 aout_buffer_t *p_buffer =950 (aout_buffer_t *)(p_waveheader[i].dwUser);951 /* Unprepare and free the buffers which has just been played */952 waveOutUnprepareHeader( p_sys->h_waveout, &p_waveheader[i],953 sizeof(WAVEHDR) );954 955 if( p_waveheader[i].dwUser != 1 )956 aout_BufferFree( p_buffer );957 958 p_waveheader[i].dwUser = 0;959 }960 961 /* Check if frame buf is available */962 if( !(p_waveheader[i].dwFlags & WHDR_DONE) )963 {964 i_queued_frames++;965 }966 }967 return i_queued_frames;968 716 } 969 717 … … 983 731 int i, i_queued_frames; 984 732 vlc_bool_t b_sleek; 985 mtime_t next_date;986 uint32_t i_buffer_length = 64;987 733 988 734 /* We don't want any resampling when using S/PDIF */ 989 735 b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i'); 990 736 991 // wait for first call to "play()" 992 while( !p_sys->start_date && !p_aout->b_die ) 993 WaitForSingleObject( p_sys->event, INFINITE ); 994 if( p_aout->b_die ) 995 return; 996 997 msg_Dbg( p_aout, "will start to play in "I64Fd" us", 998 (p_sys->start_date - AOUT_PTS_TOLERANCE/4)-mdate()); 999 1000 // than wait a short time... before grabbing first frames 1001 mwait( p_sys->start_date - AOUT_PTS_TOLERANCE/4 ); 1002 1003 #define waveout_warn(msg) msg_Warn( p_aout, "aout_OutputNextBuffer no buffer "\ 1004 "got next_date=%d ms, "\ 1005 "%d frames to play, "\ 1006 "starving? %d, %s",(int)(next_date/(mtime_t)1000), \ 1007 i_queued_frames, \ 1008 p_aout->output.b_starving, msg); 1009 next_date = mdate(); 1010 1011 while( !p_aout->b_die ) 1012 { 737 while( 1 ) 738 { 739 WaitForSingleObject( p_sys->event, INFINITE ); 740 1013 741 /* Cleanup and find out the current latency */ 1014 i_queued_frames = WaveOutClearDoneBuffers( p_sys ); 742 i_queued_frames = 0; 743 for( i = 0; i < FRAMES_NUM; i++ ) 744 { 745 if( (p_waveheader[i].dwFlags & WHDR_DONE) && 746 p_waveheader[i].dwUser ) 747 { 748 aout_buffer_t *p_buffer = 749 (aout_buffer_t *)(p_waveheader[i].dwUser); 750 /* Unprepare and free the buffers which has just been played */ 751 waveOutUnprepareHeader( p_sys->h_waveout, &p_waveheader[i], 752 sizeof(WAVEHDR) ); 753 754 if( p_waveheader[i].dwUser != 1 ) 755 aout_BufferFree( p_buffer ); 756 757 p_waveheader[i].dwUser = 0; 758 } 759 760 /* Check if frame buf is available */ 761 if( !(p_waveheader[i].dwFlags & WHDR_DONE) ) 762 { 763 i_queued_frames++; 764 } 765 } 1015 766 1016 767 if( p_aout->b_die ) return; … … 1022 773 if( p_waveheader[i].dwFlags & WHDR_DONE ) 1023 774 { 1024 // next_date = mdate() + 1000000 * i_queued_frames /1025 // p_aout->output.output.i_rate * p_aout->output.i_nb_samples;1026 1027 // the realtime has got our back-site:) to come in sync1028 if(next_date < mdate())1029 next_date = mdate();1030 1031 1032 775 /* Take into account the latency */ 1033 776 p_buffer = aout_OutputNextBuffer( p_aout, 1034 next_date, 777 mdate() + 1000000 * i_queued_frames / 778 p_aout->output.output.i_rate * p_aout->output.i_nb_samples, 1035 779 b_sleek ); 1036 1037 if(!p_buffer)1038 {1039 #if 01040 msg_Dbg( p_aout, "aout_OutputNextBuffer no buffer "\1041 "got next_date=%d ms, "\1042 "%d frames to play, "\1043 "starving? %d",(int)(next_date/(mtime_t)1000),1044 i_queued_frames,1045 p_aout->output.b_starving);1046 #endif1047 if(p_aout->output.b_starving)1048 {1049 // means we are too early to request a new buffer?1050 waveout_warn("waiting...")1051 next_date = aout_FifoFirstDate( p_aout, &p_aout->output.fifo );1052 mwait( next_date - AOUT_PTS_TOLERANCE/4 );1053 next_date = mdate();1054 p_buffer = aout_OutputNextBuffer( p_aout,1055 next_date,1056 b_sleek1057 );1058 }1059 }1060 780 1061 781 if( !p_buffer && i_queued_frames ) … … 1063 783 /* We aren't late so no need to play a blank sample */ 1064 784 break; 1065 }1066 1067 if( p_buffer )1068 {1069 mtime_t buffer_length = (p_buffer->end_date1070 - p_buffer->start_date);1071 next_date = next_date + buffer_length;1072 i_buffer_length = buffer_length/1000;1073 785 } 1074 786 … … 1084 796 1085 797 PlayWaveOut( p_aout, p_sys->h_waveout, 1086 &p_waveheader[i], p_buffer , b_sleek);798 &p_waveheader[i], p_buffer ); 1087 799 1088 800 i_queued_frames++; 1089 801 } 1090 802 } 1091 1092 if( p_aout->b_die ) return; 1093 1094 /* 1095 deal with the case that the loop didn't fillup the buffer to the 1096 max - instead of waiting that half the buffer is played before 1097 fillup the waveout buffers, wait only for the next sample buffer 1098 to arrive at the play method... 1099 1100 this will also avoid, that the last buffer is play until the 1101 end, and then trying to get more data, so it will also 1102 work - if the next buffer will arrive some ms before the 1103 last buffer is finished. 1104 */ 1105 if(i_queued_frames < FRAMES_NUM) 1106 WaitForSingleObject( p_sys->new_buffer_event, INFINITE ); 1107 else 1108 WaitForSingleObject( p_sys->event, INFINITE ); 1109 1110 } 1111 1112 #undef waveout_warn 803 } 1113 804 } 1114 805 … … 1149 840 return 0; 1150 841 } 1151 1152 1153 /*1154 reload the configuration drop down list, of the Audio Devices1155 */1156 static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,1157 vlc_value_t newval, vlc_value_t oldval, void *data )1158 {1159 int i;1160 1161 module_config_t *p_item = config_FindConfig( p_this, psz_name );1162 if( !p_item ) return VLC_SUCCESS;1163 1164 /* Clear-up the current list */1165 if( p_item->i_list )1166 {1167 /* Keep the first entry */1168 for( i = 1; i < p_item->i_list; i++ )1169 {1170 free((char *)(p_item->ppsz_list[i]) );1171 free((char *)(p_item->ppsz_list_text[i]) );1172 }1173 /* TODO: Remove when no more needed */1174 p_item->ppsz_list[i] = NULL;1175 p_item->ppsz_list_text[i] = NULL;1176 }1177 p_item->i_list = 1;1178 1179 int wave_devices = waveOutGetNumDevs();1180 1181 p_item->ppsz_list =1182 (char **)realloc( p_item->ppsz_list,1183 (wave_devices+2) * sizeof(char *) );1184 p_item->ppsz_list_text =1185 (char **)realloc( p_item->ppsz_list_text,1186 (wave_devices+2) * sizeof(char *) );1187 1188 WAVEOUTCAPS caps;1189 char sz_dev_name[MAXPNAMELEN+32];1190 int j=1;1191 for(int i=0; i<wave_devices; i++)1192 {1193 if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))1194 == MMSYSERR_NOERROR)1195 {1196 sprintf(sz_dev_name,psz_device_name_fmt,caps.szPname,1197 caps.wMid,1198 caps.wPid1199 );1200 p_item->ppsz_list[j] = strdup( sz_dev_name );1201 p_item->ppsz_list_text[j] = FromLocaleDup( sz_dev_name );1202 p_item->i_list++;1203 j++;1204 }1205 1206 }1207 p_item->ppsz_list[j] = NULL;1208 p_item->ppsz_list_text[j] = NULL;1209 1210 /* Signal change to the interface */1211 p_item->b_dirty = VLC_TRUE;1212 1213 return VLC_SUCCESS;1214 }1215 1216 /*1217 convert devicename to device ID for output1218 if device not found return WAVE_MAPPER, so let1219 windows decide which prefered audio device1220 should be used.1221 */1222 static uint32_t findDeviceID(char *psz_device_name)1223 {1224 if(!psz_device_name)1225 return WAVE_MAPPER;1226 1227 uint32_t wave_devices = waveOutGetNumDevs();1228 WAVEOUTCAPS caps;1229 char sz_dev_name[MAXPNAMELEN+32];1230 for(uint32_t i=0; i<wave_devices; i++)1231 {1232 if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))1233 == MMSYSERR_NOERROR)1234 {1235 sprintf(sz_dev_name,psz_device_name_fmt,caps.szPname,1236 caps.wMid,1237 caps.wPid1238 );1239 if(!stricmp(sz_dev_name,psz_device_name))1240 return i;1241 }1242 }1243 1244 return WAVE_MAPPER;1245 }po/ca.po
r9438646 rced125d 10 10 "Project-Id-Version: vlc 0.8.2-svn\n" 11 11 "Report-Msgid-Bugs-To: vlc-devel@videolan.org\n" 12 "POT-Creation-Date: 2008-0 2-26 19:44+0000\n"12 "POT-Creation-Date: 2008-01-07 21:06+0100\n" 13 13 "PO-Revision-Date: 2005-04-28 19:16+0100\n" 14 14 "Last-Translator: Lorena Gomes i Xènia Albà\n" … … 27 27 28 28 #: include/vlc_config_cat.h:40 include/vlc_config_cat.h:131 29 #: modules/gui/macosx/playlistinfo.m:62 modules/gui/wince/playlist.cpp:67 529 #: modules/gui/macosx/playlistinfo.m:62 modules/gui/wince/playlist.cpp:671 30 30 #: modules/gui/wxwidgets/dialogs/fileinfo.cpp:82 31 #: modules/visualization/visual/visual.c:11 531 #: modules/visualization/visual/visual.c:111 32 32 msgid "General" 33 33 msgstr "General" 34 34 35 #: include/vlc_config_cat.h:43 modules/gui/macosx/simple_prefs.m:8736 #: modules/gui/qt4/components/simple_preferences.cpp: 7337 #: modules/misc/dummy/dummy.c:6 735 #: include/vlc_config_cat.h:43 36 #: modules/gui/qt4/components/simple_preferences.cpp:68 37 #: modules/misc/dummy/dummy.c:63 38 38 msgid "Interface" 39 39 msgstr "Interfície" … … 56 56 msgstr "Paràmetres per a les interfícies del VLC" 57 57 58 #: include/vlc_config_cat.h:51 src/libvlc-module.c:1 5158 #: include/vlc_config_cat.h:51 src/libvlc-module.c:147 59 59 msgid "Control interfaces" 60 60 msgstr "Interfícies de control" … … 68 68 msgstr "Configuració de les tecles ràpides" 69 69 70 #: include/vlc_config_cat.h:58 src/input/es_out.c:204 971 #: src/libvlc-module.c:140 8 modules/gui/beos/InterfaceWindow.cpp:28472 #: modules/gui/macosx/extended.m: 69 modules/gui/macosx/intf.m:70370 #: include/vlc_config_cat.h:58 src/input/es_out.c:2045 71 #: src/libvlc-module.c:1400 modules/gui/beos/InterfaceWindow.cpp:280 72 #: modules/gui/macosx/extended.m:70 modules/gui/macosx/intf.m:673 73 73 #: modules/gui/macosx/output.m:170 modules/gui/macosx/playlistinfo.m:97 74 #: modules/gui/macosx/ simple_prefs.m:103 modules/gui/macosx/wizard.m:37875 #: modules/gui/qt4/components/info_panels.cpp:5 1976 #: modules/gui/qt4/components/simple_preferences.cpp:7 574 #: modules/gui/macosx/wizard.m:378 75 #: modules/gui/qt4/components/info_panels.cpp:507 76 #: modules/gui/qt4/components/simple_preferences.cpp:70 77 77 #: modules/gui/qt4/ui/sout.ui:631 78 78 #: modules/gui/wxwidgets/dialogs/infopanels.cpp:338 79 79 #: modules/gui/wxwidgets/dialogs/wizard.cpp:852 80 #: modules/gui/wxwidgets/extrapanel.cpp:1 82 modules/stream_out/transcode.c:25780 #: modules/gui/wxwidgets/extrapanel.cpp:178 modules/stream_out/transcode.c:253 81 81 msgid "Audio" 82 82 msgstr "Àudio" … … 87 87 88 88 #: include/vlc_config_cat.h:61 include/vlc_config_cat.h:62 89 #: modules/gui/qt4/components/simple_preferences.cpp: 20089 #: modules/gui/qt4/components/simple_preferences.cpp:195 90 90 msgid "General audio settings" 91 91 msgstr "Paràmetres generals d'àudio" 92 92 93 93 #: include/vlc_config_cat.h:64 include/vlc_config_cat.h:89 94 #: src/video_output/video_output.c:43 994 #: src/video_output/video_output.c:435 95 95 msgid "Filters" 96 96 msgstr "Filtres" … … 101 101 "Els filtres d'àudio són utilitzats pel post-processament del flux d'àudio" 102 102 103 #: include/vlc_config_cat.h:68 src/audio_output/input.c: 92104 #: modules/gui/macosx/intf.m: 713 modules/gui/macosx/intf.m:714103 #: include/vlc_config_cat.h:68 src/audio_output/input.c:88 104 #: modules/gui/macosx/intf.m:683 modules/gui/macosx/intf.m:684 105 105 msgid "Visualizations" 106 106 msgstr "Visualitzacions" 107 107 108 #: include/vlc_config_cat.h:70 src/audio_output/input.c:16 4108 #: include/vlc_config_cat.h:70 src/audio_output/input.c:160 109 109 msgid "Audio visualizations" 110 110 msgstr "Visualitzacions de l'àudio" … … 118 118 msgstr "Aquests són els paràmetres generals pels mòduls de sortida d'àudio" 119 119 120 #: include/vlc_config_cat.h:75 src/libvlc-module.c:17 87120 #: include/vlc_config_cat.h:75 src/libvlc-module.c:1777 121 121 #: modules/gui/qt4/ui/sout.ui:758 122 122 #: modules/gui/wxwidgets/dialogs/streamout.cpp:578 123 #: modules/gui/wxwidgets/menus.cpp:2 76 modules/stream_out/transcode.c:289123 #: modules/gui/wxwidgets/menus.cpp:282 modules/stream_out/transcode.c:285 124 124 msgid "Miscellaneous" 125 125 msgstr "Miscel·lània" … … 129 129 msgstr "Paràmetres i mòduls varis de l'àudio" 130 130 131 #: include/vlc_config_cat.h:79 src/input/es_out.c:2077 132 #: src/libvlc-module.c:1456 modules/gui/macosx/extended.m:68 133 #: modules/gui/macosx/intf.m:716 modules/gui/macosx/output.m:160 134 #: modules/gui/macosx/playlistinfo.m:86 modules/gui/macosx/simple_prefs.m:119 135 #: modules/gui/macosx/wizard.m:379 136 #: modules/gui/qt4/components/info_panels.cpp:520 137 #: modules/gui/qt4/components/simple_preferences.cpp:76 131 #: include/vlc_config_cat.h:79 src/input/es_out.c:2073 132 #: src/libvlc-module.c:1448 modules/gui/macosx/extended.m:69 133 #: modules/gui/macosx/intf.m:686 modules/gui/macosx/output.m:160 134 #: modules/gui/macosx/playlistinfo.m:86 modules/gui/macosx/wizard.m:379 135 #: modules/gui/qt4/components/info_panels.cpp:508 136 #: modules/gui/qt4/components/simple_preferences.cpp:71 138 137 #: modules/gui/qt4/ui/sout.ui:542 139 138 #: modules/gui/wxwidgets/dialogs/infopanels.cpp:292 140 139 #: modules/gui/wxwidgets/dialogs/wizard.cpp:813 141 #: modules/gui/wxwidgets/extrapanel.cpp:1 80 modules/misc/dummy/dummy.c:97142 #: modules/stream_out/transcode.c: 201140 #: modules/gui/wxwidgets/extrapanel.cpp:176 modules/misc/dummy/dummy.c:93 141 #: modules/stream_out/transcode.c:197 143 142 msgid "Video" 144 143 msgstr "Vídeo" … … 149 148 150 149 #: include/vlc_config_cat.h:82 include/vlc_config_cat.h:83 151 #: modules/gui/qt4/components/simple_preferences.cpp:1 70150 #: modules/gui/qt4/components/simple_preferences.cpp:165 152 151 msgid "General video settings" 153 152 msgstr "Paràmetres generals de vídeo" … … 249 248 msgstr "Paràmetres avançats d'entrada. Utilitzeu-los amb atenció." 250 249 251 #: include/vlc_config_cat.h:135 src/libvlc-module.c:17 13252 #: modules/gui/qt4/dialogs/sout.cpp:4 4250 #: include/vlc_config_cat.h:135 src/libvlc-module
