Quick&dirty support for mpeg LPCM streams.

This commit is contained in:
Johns 2012-02-06 22:58:42 +01:00
parent c972f8c4dd
commit 99728258f1
2 changed files with 29 additions and 4 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Quick&dirty support for mpeg LPCM streams.
Workaround for text2skin undrawn OSD areas. Workaround for text2skin undrawn OSD areas.
Detect dvb LPCM stream and ignore it. Detect dvb LPCM stream and ignore it.

View File

@ -282,8 +282,20 @@ int PlayAudio(const uint8_t * data, int size,
// Private stram + LPCM ID // Private stram + LPCM ID
} else if (data[-n - 9 + 3] == 0xBD && data[0] == 0xA0) { } else if (data[-n - 9 + 3] == 0xBD && data[0] == 0xA0) {
if (AudioCodecID != CODEC_ID_PCM_DVD) { if (AudioCodecID != CODEC_ID_PCM_DVD) {
Debug(3, "[softhddev]%s: LPCM %d\n", __FUNCTION__, id); int samplerate;
int channels;
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);
CodecAudioClose(MyAudioDecoder); CodecAudioClose(MyAudioDecoder);
// FIXME: check supported formats.
samplerate = 48000;
channels = 2;
AudioSetup(&samplerate, &channels, 0);
printf("%d\n", size);
//CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_PCM_DVD); //CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_PCM_DVD);
AudioCodecID = CODEC_ID_PCM_DVD; AudioCodecID = CODEC_ID_PCM_DVD;
} }
@ -313,9 +325,21 @@ int PlayAudio(const uint8_t * data, int size,
} }
} }
avpkt->data = (void *)data; if (AudioCodecID == CODEC_ID_PCM_DVD) {
avpkt->size = size; if (size > 7) {
if (AudioCodecID != CODEC_ID_PCM_DVD) { char *buf;
if (!(buf = malloc(size - 7))) {
Error(_("softhddev: out of memory\n"));
} else {
swab(data + 7, buf, size - 7);
AudioEnqueue(buf, size - 7);
free(buf);
}
}
} else {
avpkt->data = (void *)data;
avpkt->size = size;
CodecAudioDecode(MyAudioDecoder, avpkt); CodecAudioDecode(MyAudioDecoder, avpkt);
} }