summaryrefslogtreecommitdiff
path: root/softhddev.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-02-06 23:54:22 +0100
committerJohns <johns98@gmx.net>2012-02-06 23:54:22 +0100
commit947f6b312e6cabde44a0bef7ae593fe016b409a5 (patch)
tree85dffed51564b59566bc1f50de46c1393b47bfa8 /softhddev.c
parent99728258f14aaf76e4955cd2ce0f59ff69789a85 (diff)
downloadvdr-plugin-softhddevice-947f6b312e6cabde44a0bef7ae593fe016b409a5.tar.gz
vdr-plugin-softhddevice-947f6b312e6cabde44a0bef7ae593fe016b409a5.tar.bz2
Support more LPCM sample rates and channels.
Diffstat (limited to 'softhddev.c')
-rw-r--r--softhddev.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/softhddev.c b/softhddev.c
index d4e536d..1473171 100644
--- a/softhddev.c
+++ b/softhddev.c
@@ -282,20 +282,36 @@ int PlayAudio(const uint8_t * data, int size,
// Private stram + LPCM ID
} else if (data[-n - 9 + 3] == 0xBD && data[0] == 0xA0) {
if (AudioCodecID != CODEC_ID_PCM_DVD) {
+ static int samplerates[] = { 48000, 96000, 44100, 32000 };
int samplerate;
int channels;
+ int bits_per_sample;
Debug(3, "[softhddev]%s: LPCM %d sr:%d bits:%d chan:%d\n",
- __FUNCTION__, id, data[5] >> 6,
- (((data[5] >> 4) & 0x3) + 4) * 4, (data[5] & 0x7) + 1);
+ __FUNCTION__, id, data[5] >> 4,
+ (((data[5] >> 6) & 0x3) + 4) * 4, (data[5] & 0x7) + 1);
CodecAudioClose(MyAudioDecoder);
- // FIXME: check supported formats.
-
- samplerate = 48000;
- channels = 2;
+ bits_per_sample = (((data[5] >> 6) & 0x3) + 4) * 4;
+ if (bits_per_sample != 16) {
+ Error(_
+ ("softhddev: LPCM %d bits per sample aren't supported\n"),
+ bits_per_sample);
+ // FIXME: handle unsupported formats.
+ }
+ samplerate = samplerates[data[5] >> 4];
+ channels = (data[5] & 0x7) + 1;
AudioSetup(&samplerate, &channels, 0);
- printf("%d\n", size);
+ if (samplerate != samplerates[data[5] >> 4]) {
+ Error(_("softhddev: LPCM %d sample-rate is unsupported\n"),
+ samplerates[data[5] >> 4]);
+ // FIXME: support resample
+ }
+ if (channels != (data[5] & 0x7) + 1) {
+ Error(_("softhddev: LPCM %d channels are unsupported\n"),
+ (data[5] & 0x7) + 1);
+ // FIXME: support resample
+ }
//CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_PCM_DVD);
AudioCodecID = CODEC_ID_PCM_DVD;
}