From: Takashi Iwai Subject: Re: VLC SPDIF passthrough Date: Thu, 22 Dec 2005 17:35:21 +0100 Message-ID: References: <43A6B98B.6060901@lelik.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <43A6B98B.6060901@lelik.org> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Andrey L Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Mon, 19 Dec 2005 05:45:47 -0800, Andrey L wrote: > > Hi guys. For a number of last nights I'm trying to get SPDIF passthrough > working on my setup - ATI RS482 chipset + intel hd audio + realtek > ALC880 connected to onkyo reciever. The problem seems common - receiver > switches to dolby digital mode but there is no sound (otherwise > everything works perfectly, including SPDIF in PCM mode). I have the > latest alsa drivers, library and VLC. > > I tried lots of theories and so far I believe the problem is due to > invalid frame size. The VLC code looks (very simplified) like following > fragment (it is in modules\audio_output\alsa.c in vlc source tree) : > > /* Get Initial hardware parameters */ > snd_pcm_hw_params_any( p_sys->p_snd_pcm, p_hw ) > /* Set format. */ > snd_pcm_hw_params_set_format( p_sys->p_snd_pcm, p_hw,i_snd_pcm_format ) > /* Set channels. */ > snd_pcm_hw_params_set_channels( p_sys->p_snd_pcm, p_hw,i_channels) > /* Set rate. */ > snd_pcm_hw_params_set_rate_near( p_sys->p_snd_pcm, > p_hw,&p_aout->output.output.i_rate,NULL ); > /* Set buffer size. */ > snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm,p_hw, > &i_buffer_size ) ; > /* Set period size. */ > snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm,p_hw, > &i_period_size, NULL ) ; > /* Commit hardware parameters. */ > snd_pcm_hw_params( p_sys->p_snd_pcm, p_hw ) ; > > > In the code above VLC tries to set parameters as specified in AC3 spec - > {//i_snd_pcm_format=SND_PCM_FORMAT_IEC958_SUBFRAME,i_channels=2,i_rate=48K,i_buffer_size=1536,i_period_size=16*1536}. IEC958_SUBFRAME format is used for the raw SPDIF 32bit data including preemble, etc. Usually this is not what you want to use. For SPDIF passthrough, open "spdif" PCM and use S16_LE format. You'll still need to encode the AC3 to SPDIF frames, but the format is still S16_LE. Also, the buffer and period sizes are not restricted by the iec958 frame size. It's simply the size of ring buffer and irq updates. Takashi ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click