summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Keil <jkeil@users.sourceforge.net>2001-09-23 15:19:36 +0000
committerJuergen Keil <jkeil@users.sourceforge.net>2001-09-23 15:19:36 +0000
commitef97d9e510b71c54f96690601f62560fe1419fc0 (patch)
tree96ec7d4dcf37b406b441ab3a4856f0e11b043899
parent6240f83c4263544ed1dbb3a6dff1b2d2389cb397 (diff)
downloadxine-lib-ef97d9e510b71c54f96690601f62560fe1419fc0.tar.gz
xine-lib-ef97d9e510b71c54f96690601f62560fe1419fc0.tar.bz2
dvdnav on a DVD with LPCM sound never sends us a preview buffer with the
decoder_info stuff, so that the audio format is still unknown when we get the first real data buffer and try to open the audio driver. Added a quick hack to the lpcm decoder to grab the audio format from the decoder info data of a non-preview buffer, in case the audio format is unknown at audio driver open time. CVS patchset: 684 CVS date: 2001/09/23 15:19:36
-rw-r--r--src/liblpcm/xine_decoder.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/liblpcm/xine_decoder.c b/src/liblpcm/xine_decoder.c
index ef57b2738..fcf7f36da 100644
--- a/src/liblpcm/xine_decoder.c
+++ b/src/liblpcm/xine_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_decoder.c,v 1.10 2001/09/16 23:13:45 f1rmb Exp $
+ * $Id: xine_decoder.c,v 1.11 2001/09/23 15:19:36 jkeil Exp $
*
* 31-8-2001 Added LPCM rate sensing.
* (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk
@@ -92,6 +92,18 @@ void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
}
if (!this->output_open) {
+ /*
+ * with dvdnav we not get a preview buffer with audio format information
+ * (buf->decoder_info[0] == 0).
+ * grab the audio format from the first audio data buffer, in case
+ * the audio format is not yet known.
+ */
+ if (this->rate == 0 && this->bits_per_sample == 0) {
+ this->rate=buf->decoder_info[1];
+ this->bits_per_sample=buf->decoder_info[2] ;
+ this->number_of_channels=buf->decoder_info[3] ;
+ this->ao_cap_mode=(this->number_of_channels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO;
+ }
printf ("liblpcm: opening audio output (%d Hz sampling rate, mode=%d)\n",
this->rate, this->ao_cap_mode);
this->output_open = this->audio_out->open (this->audio_out, this->bits_per_sample,