Changeset ced125da0699eb348462270926a6802288800433

Show
Ignore:
Timestamp:
03/02/08 17:07:53 (4 months ago)
Author:
André Weber <WeberAndre@gmx.de>
git-committer:
André Weber <WeberAndre@gmx.de> 1204474073 +0100
git-parent:

[9438646c972ab353d6cd686397f29e16174499ef]

git-author:
André Weber <WeberAndre@gmx.de> 1204474073 +0100
Message:

Revert "#492 bugfix, for SPDIF audio ouput of AC3 and DTS sound on Windows"

This reverts commit 9438646c972ab353d6cd686397f29e16174499ef.
wrong file in my list I'am sorry, and wrong file modes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/audio_output/waveout.c

    • Property mode changed from 100755 to 100644
    r9438646 rced125d  
    3232#include <vlc/vlc.h> 
    3333#include <vlc_aout.h> 
    34 #include <vlc_charset.h> 
    3534 
    3635#include <windows.h> 
     
    122121/* local functions */ 
    123122static 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 ); 
     123static int OpenWaveOut   ( aout_instance_t *, int, int, int, int, vlc_bool_t ); 
     124static int OpenWaveOutPCM( aout_instance_t *, int*, int, int, int, vlc_bool_t ); 
    128125static int PlayWaveOut   ( aout_instance_t *, HWAVEOUT, WAVEHDR *, 
    129                            aout_buffer_t *, vlc_bool_t ); 
     126                           aout_buffer_t * ); 
    130127 
    131128static void CALLBACK WaveOutCallback ( HWAVEOUT, UINT, DWORD, DWORD, DWORD ); 
     
    135132static int VolumeGet( aout_instance_t *, audio_volume_t * ); 
    136133static 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  
    150134 
    151135/***************************************************************************** 
     
    156140    "The option allows you to enable or disable the high-quality float32 " \ 
    157141    "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") 
    163142 
    164143vlc_module_begin(); 
     
    169148    set_subcategory( SUBCAT_AUDIO_AOUT ); 
    170149    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  
    179150    set_callbacks( Open, Close ); 
    180151vlc_module_end(); 
     
    188159struct aout_sys_t 
    189160{ 
    190     uint32_t i_wave_device_id;               /* ID of selected output device */ 
    191  
    192161    HWAVEOUT h_waveout;                        /* handle to waveout instance */ 
    193162 
     
    198167    notification_thread_t *p_notif;                      /* WaveOutThread id */ 
    199168    HANDLE event; 
    200     HANDLE new_buffer_event; 
    201  
    202     // rental from alsa.c to synchronize startup of audiothread 
    203     int b_playing;                                         /* playing status */ 
    204     mtime_t start_date; 
    205  
    206     int i_repeat_counter; 
    207169 
    208170    int i_buffer_size; 
     
    253215    p_aout->b_die = VLC_FALSE; 
    254216 
    255  
    256     /* 
    257      initialize/update Device selection List 
    258     */ 
    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 blame 
    288          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  
    299217    if( var_Type( p_aout, "audio-device" ) == 0 ) 
    300218    { 
     
    305223    { 
    306224        /* Probe() has failed. */ 
    307         var_Destroy( p_aout, "waveout-device"); 
    308225        free( p_aout->output.p_sys ); 
    309226        return VLC_EGENERIC; 
    310227    } 
    311228 
     229    var_Create( p_aout, "waveout-float32", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 
    312230 
    313231    /* Open the device */ 
     
    316234        p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i'); 
    317235 
    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'), 
    321237                         p_aout->output.output.i_physical_channels, 
    322238                         aout_FormatNbChannels( &p_aout->output.output ), 
     
    365281        } 
    366282 
    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, 
    370284                            p_aout->output.output.i_physical_channels, 
    371285                            aout_FormatNbChannels( &p_aout->output.output ), 
     
    414328        return 1; 
    415329    } 
    416     p_aout->output.p_sys->i_repeat_counter = 0; 
    417  
    418330 
    419331    /* Zero the buffer. WinCE doesn't have calloc(). */ 
     
    426338    p_aout->output.p_sys->p_notif->p_aout = p_aout; 
    427339    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  
    435340 
    436341    /* Then launch the notification thread */ 
    437342    if( vlc_thread_create( p_aout->output.p_sys->p_notif, 
    438343                           "waveOut Notification Thread", WaveOutThread, 
    439                            VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) ) 
     344                           VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) ) 
    440345    { 
    441346        msg_Err( p_aout, "cannot create WaveOutThread" ); 
     
    449354        p_aout->output.p_sys->waveheader[i].dwUser = 0; 
    450355    } 
     356    PlayWaveOut( p_aout, p_aout->output.p_sys->h_waveout, 
     357                 &p_aout->output.p_sys->waveheader[0], NULL ); 
    451358 
    452359    return 0; 
     
    472379    if( p_aout->output.output.i_physical_channels == i_physical_channels ) 
    473380    { 
    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, 
    477382                            i_physical_channels, 6, 
    478383                            p_aout->output.output.i_rate, VLC_TRUE ) 
     
    480385        { 
    481386            val.i_int = AOUT_VAR_5_1; 
    482             text.psz_string = (char *)N_("5.1"); 
     387            text.psz_string = N_("5.1"); 
    483388            var_Change( p_aout, "audio-device", 
    484389                        VLC_VAR_ADDCHOICE, &val, &text ); 
     
    493398        == i_physical_channels ) 
    494399    { 
    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, 
    498401                            i_physical_channels, 4, 
    499402                            p_aout->output.output.i_rate, VLC_TRUE ) 
     
    501404        { 
    502405            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"); 
    504407            var_Change( p_aout, "audio-device", 
    505408                        VLC_VAR_ADDCHOICE, &val, &text ); 
     
    510413    /* Test for stereo support */ 
    511414    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, 
    515416                        i_physical_channels, 2, 
    516417                        p_aout->output.output.i_rate, VLC_TRUE ) 
     
    518419    { 
    519420        val.i_int = AOUT_VAR_STEREO; 
    520         text.psz_string = (char *)N_("Stereo"); 
     421        text.psz_string = N_("Stereo"); 
    521422        var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); 
    522423        msg_Dbg( p_aout, "device supports 2 channels" ); 
     
    525426    /* Test for mono support */ 
    526427    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, 
    530429                        i_physical_channels, 1, 
    531430                        p_aout->output.output.i_rate, VLC_TRUE ) 
     
    533432    { 
    534433        val.i_int = AOUT_VAR_MONO; 
    535         text.psz_string = (char *)N_("Mono"); 
     434        text.psz_string = N_("Mono"); 
    536435        var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); 
    537436        msg_Dbg( p_aout, "device supports 1 channel" ); 
     
    541440    if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) 
    542441    { 
    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'), 
    546443                         p_aout->output.output.i_physical_channels, 
    547444                         aout_FormatNbChannels( &p_aout->output.output ), 
     
    551448            msg_Dbg( p_aout, "device supports A/52 over S/PDIF" ); 
    552449            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"); 
    554451            var_Change( p_aout, "audio-device", 
    555452                        VLC_VAR_ADDCHOICE, &val, &text ); 
     
    581478static void Play( aout_instance_t *_p_aout ) 
    582479{ 
    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     } 
    598480} 
    599481 
     
    609491    vlc_object_kill( p_aout ); 
    610492 
    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 */ 
    612496    SetEvent( p_sys->event ); 
    613     SetEvent( p_sys->new_buffer_event ); 
    614  
    615497    vlc_thread_join( p_sys->p_notif ); 
    616498    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 */ 
    661502    if( waveOutClose( p_sys->h_waveout ) != MMSYSERR_NOERROR ) 
    662503    { 
    663504        msg_Err( p_aout, "waveOutClose failed" ); 
    664505    } 
    665  
    666     /* 
    667       because so long, the waveout device is playing, the callback 
    668       could occur and need the events 
    669     */ 
    670     CloseHandle( p_sys->event ); 
    671     CloseHandle( p_sys->new_buffer_event); 
    672506 
    673507    free( p_sys->p_silence_buffer ); 
     
    678512 * OpenWaveOut: open the waveout sound device 
    679513 ****************************************************************************/ 
    680 static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_format, 
     514static int OpenWaveOut( aout_instance_t *p_aout, int i_format, 
    681515                        int i_channels, int i_nb_channels, int i_rate, 
    682516                        vlc_bool_t b_probe ) 
     
    745579    } 
    746580 
    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  
    771581    /* 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
    773583                          (WAVEFORMATEX *)&waveformat, 
    774584                          (DWORD_PTR)WaveOutCallback, (DWORD_PTR)p_aout, 
     
    809619 * OpenWaveOutPCM: open a PCM waveout sound device 
    810620 ****************************************************************************/ 
    811 static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i_format, 
     621static int OpenWaveOutPCM( aout_instance_t *p_aout, int *i_format, 
    812622                           int i_channels, int i_nb_channels, int i_rate, 
    813623                           vlc_bool_t b_probe ) 
    814624{ 
    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'), 
    818630                                   i_channels, i_nb_channels, i_rate, b_probe ) 
    819631        != VLC_SUCCESS ) 
    820632    { 
    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'), 
    822634                          i_channels, i_nb_channels, i_rate, b_probe ) 
    823635             != VLC_SUCCESS ) 
     
    842654 *****************************************************************************/ 
    843655static 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 ) 
    846657{ 
    847658    MMRESULT result; 
    848659 
    849660    /* Prepare the buffer */ 
    850     if( p_buffer != NULL )  
    851     { 
     661    if( p_buffer != NULL ) 
    852662        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 
    867664        /* 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_size 
    876                                           ); 
    877            } 
    878         } 
    879665        p_waveheader->lpData = p_aout->output.p_sys->p_silence_buffer; 
    880     } 
    881666 
    882667    p_waveheader->dwUser = p_buffer ? (DWORD_PTR)p_buffer : (DWORD_PTR)1; 
     
    927712 
    928713    /* Don't wake up the thread too much */ 
    929     if( i_queued_frames <= FRAMES_NUM/2 ) 
     714    if( i_queued_frames < FRAMES_NUM / 2 ) 
    930715        SetEvent( p_aout->output.p_sys->event ); 
    931 } 
    932  
    933  
    934 /**************************************************************************** 
    935  * WaveOutClearDoneBuffers: Clear all done marked buffers, and free aout_bufer 
    936  **************************************************************************** 
    937  * return value is the number of still playing buffers in the queue 
    938  ****************************************************************************/ 
    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; 
    968716} 
    969717 
     
    983731    int i, i_queued_frames; 
    984732    vlc_bool_t b_sleek; 
    985     mtime_t next_date; 
    986     uint32_t i_buffer_length = 64; 
    987733 
    988734    /* We don't want any resampling when using S/PDIF */ 
    989735    b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i'); 
    990736 
    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 
    1013741        /* 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        } 
    1015766 
    1016767        if( p_aout->b_die ) return; 
     
    1022773            if( p_waveheader[i].dwFlags & WHDR_DONE ) 
    1023774            { 
    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 sync 
    1028                 if(next_date < mdate()) 
    1029                    next_date = mdate(); 
    1030  
    1031  
    1032775                /* Take into account the latency */ 
    1033776                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, 
    1035779                    b_sleek ); 
    1036  
    1037                 if(!p_buffer) 
    1038                 { 
    1039 #if 0 
    1040                     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 #endif 
    1047                     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_sleek 
    1057                                    ); 
    1058                     } 
    1059                 } 
    1060780 
    1061781                if( !p_buffer && i_queued_frames ) 
     
    1063783                    /* We aren't late so no need to play a blank sample */ 
    1064784                    break; 
    1065                 } 
    1066  
    1067                 if( p_buffer ) 
    1068                 { 
    1069                     mtime_t buffer_length = (p_buffer->end_date 
    1070                                              - p_buffer->start_date); 
    1071                     next_date = next_date + buffer_length; 
    1072                     i_buffer_length = buffer_length/1000; 
    1073785                } 
    1074786 
     
    1084796 
    1085797                PlayWaveOut( p_aout, p_sys->h_waveout, 
    1086                              &p_waveheader[i], p_buffer, b_sleek ); 
     798                             &p_waveheader[i], p_buffer ); 
    1087799 
    1088800                i_queued_frames++; 
    1089801            } 
    1090802        } 
    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    } 
    1113804} 
    1114805 
     
    1149840    return 0; 
    1150841} 
    1151  
    1152  
    1153 /* 
    1154   reload the configuration drop down list, of the Audio Devices 
    1155 */ 
    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.wPid 
    1199                                               ); 
    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 output 
    1218   if device not found return WAVE_MAPPER, so let 
    1219   windows decide which prefered audio device 
    1220   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.wPid 
    1238                                               ); 
    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  
    1010"Project-Id-Version: vlc 0.8.2-svn\n" 
    1111"Report-Msgid-Bugs-To: vlc-devel@videolan.org\n" 
    12 "POT-Creation-Date: 2008-02-26 19:44+0000\n" 
     12"POT-Creation-Date: 2008-01-07 21:06+0100\n" 
    1313"PO-Revision-Date: 2005-04-28 19:16+0100\n" 
    1414"Last-Translator: Lorena Gomes i Xènia Albà\n" 
     
    2727 
    2828#: include/vlc_config_cat.h:40 include/vlc_config_cat.h:131 
    29 #: modules/gui/macosx/playlistinfo.m:62 modules/gui/wince/playlist.cpp:675 
     29#: modules/gui/macosx/playlistinfo.m:62 modules/gui/wince/playlist.cpp:671 
    3030#: modules/gui/wxwidgets/dialogs/fileinfo.cpp:82 
    31 #: modules/visualization/visual/visual.c:115 
     31#: modules/visualization/visual/visual.c:111 
    3232msgid "General" 
    3333msgstr "General" 
    3434 
    35 #: include/vlc_config_cat.h:43 modules/gui/macosx/simple_prefs.m:87 
    36 #: modules/gui/qt4/components/simple_preferences.cpp:73 
    37 #: modules/misc/dummy/dummy.c:67 
     35#: include/vlc_config_cat.h:43 
     36#: modules/gui/qt4/components/simple_preferences.cpp:68 
     37#: modules/misc/dummy/dummy.c:63 
    3838msgid "Interface" 
    3939msgstr "Interfície" 
     
    5656msgstr "Paràmetres per a les interfícies del VLC" 
    5757 
    58 #: include/vlc_config_cat.h:51 src/libvlc-module.c:151 
     58#: include/vlc_config_cat.h:51 src/libvlc-module.c:147 
    5959msgid "Control interfaces" 
    6060msgstr "Interfícies de control" 
     
    6868msgstr "Configuració de les tecles ràpides" 
    6969 
    70 #: include/vlc_config_cat.h:58 src/input/es_out.c:2049 
    71 #: src/libvlc-module.c:1408 modules/gui/beos/InterfaceWindow.cpp:284 
    72 #: modules/gui/macosx/extended.m:69 modules/gui/macosx/intf.m:70
     70#: 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:67
    7373#: 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:378 
    75 #: modules/gui/qt4/components/info_panels.cpp:519 
    76 #: modules/gui/qt4/components/simple_preferences.cpp:75 
     74#: modules/gui/macosx/wizard.m:378 
     75#: modules/gui/qt4/components/info_panels.cpp:507 
     76#: modules/gui/qt4/components/simple_preferences.cpp:70 
    7777#: modules/gui/qt4/ui/sout.ui:631 
    7878#: modules/gui/wxwidgets/dialogs/infopanels.cpp:338 
    7979#: modules/gui/wxwidgets/dialogs/wizard.cpp:852 
    80 #: modules/gui/wxwidgets/extrapanel.cpp:182 modules/stream_out/transcode.c:257 
     80#: modules/gui/wxwidgets/extrapanel.cpp:178 modules/stream_out/transcode.c:253 
    8181msgid "Audio" 
    8282msgstr "Àudio" 
     
    8787 
    8888#: include/vlc_config_cat.h:61 include/vlc_config_cat.h:62 
    89 #: modules/gui/qt4/components/simple_preferences.cpp:200 
     89#: modules/gui/qt4/components/simple_preferences.cpp:195 
    9090msgid "General audio settings" 
    9191msgstr "Paràmetres generals d'àudio" 
    9292 
    9393#: include/vlc_config_cat.h:64 include/vlc_config_cat.h:89 
    94 #: src/video_output/video_output.c:439 
     94#: src/video_output/video_output.c:435 
    9595msgid "Filters" 
    9696msgstr "Filtres" 
     
    101101"Els filtres d'àudio són utilitzats pel post-processament del flux d'àudio" 
    102102 
    103 #: include/vlc_config_cat.h:68 src/audio_output/input.c:92 
    104 #: modules/gui/macosx/intf.m:713 modules/gui/macosx/intf.m:71
     103#: include/vlc_config_cat.h:68 src/audio_output/input.c:88 
     104#: modules/gui/macosx/intf.m:683 modules/gui/macosx/intf.m:68
    105105msgid "Visualizations" 
    106106msgstr "Visualitzacions" 
    107107 
    108 #: include/vlc_config_cat.h:70 src/audio_output/input.c:164 
     108#: include/vlc_config_cat.h:70 src/audio_output/input.c:160 
    109109msgid "Audio visualizations" 
    110110msgstr "Visualitzacions de l'àudio" 
     
    118118msgstr "Aquests són els paràmetres generals pels mòduls de sortida d'àudio" 
    119119 
    120 #: include/vlc_config_cat.h:75 src/libvlc-module.c:178
     120#: include/vlc_config_cat.h:75 src/libvlc-module.c:177
    121121#: modules/gui/qt4/ui/sout.ui:758 
    122122#: modules/gui/wxwidgets/dialogs/streamout.cpp:578 
    123 #: modules/gui/wxwidgets/menus.cpp:276 modules/stream_out/transcode.c:289 
     123#: modules/gui/wxwidgets/menus.cpp:282 modules/stream_out/transcode.c:285 
    124124msgid "Miscellaneous" 
    125125msgstr "Miscel·lània" 
     
    129129msgstr "Paràmetres i mòduls varis de l'àudio" 
    130130 
    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 
    138137#: modules/gui/qt4/ui/sout.ui:542 
    139138#: modules/gui/wxwidgets/dialogs/infopanels.cpp:292 
    140139#: modules/gui/wxwidgets/dialogs/wizard.cpp:813 
    141 #: modules/gui/wxwidgets/extrapanel.cpp:180 modules/misc/dummy/dummy.c:97 
    142 #: modules/stream_out/transcode.c:201 
     140#: modules/gui/wxwidgets/extrapanel.cpp:176 modules/misc/dummy/dummy.c:93 
     141#: modules/stream_out/transcode.c:197 
    143142msgid "Video" 
    144143msgstr "Vídeo" 
     
    149148 
    150149#: include/vlc_config_cat.h:82 include/vlc_config_cat.h:83 
    151 #: modules/gui/qt4/components/simple_preferences.cpp:170 
     150#: modules/gui/qt4/components/simple_preferences.cpp:165 
    152151msgid "General video settings" 
    153152msgstr "Paràmetres generals de vídeo" 
     
    249248msgstr "Paràmetres avançats d'entrada. Utilitzeu-los amb atenció." 
    250249 
    251 #: include/vlc_config_cat.h:135 src/libvlc-module.c:171
    252 #: modules/gui/qt4/dialogs/sout.cpp:44 
     250#: include/vlc_config_cat.h:135 src/libvlc-module