diff options
author | Johns <johns98@gmx.net> | 2012-02-06 22:58:42 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-02-06 22:58:42 +0100 |
commit | 99728258f14aaf76e4955cd2ce0f59ff69789a85 (patch) | |
tree | edaa264e1c82e2b158fded670ad454249b6fec1c /softhddev.c | |
parent | c972f8c4ddf11c4f3f9b5db87980f5b472a10a40 (diff) | |
download | vdr-plugin-softhddevice-99728258f14aaf76e4955cd2ce0f59ff69789a85.tar.gz vdr-plugin-softhddevice-99728258f14aaf76e4955cd2ce0f59ff69789a85.tar.bz2 |
Quick&dirty support for mpeg LPCM streams.
Diffstat (limited to 'softhddev.c')
-rw-r--r-- | softhddev.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/softhddev.c b/softhddev.c index 366eabe..d4e536d 100644 --- a/softhddev.c +++ b/softhddev.c @@ -282,8 +282,20 @@ 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) { - 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); + + // FIXME: check supported formats. + + samplerate = 48000; + channels = 2; + AudioSetup(&samplerate, &channels, 0); + printf("%d\n", size); //CodecAudioOpen(MyAudioDecoder, NULL, 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; - avpkt->size = size; - if (AudioCodecID != CODEC_ID_PCM_DVD) { + if (AudioCodecID == CODEC_ID_PCM_DVD) { + if (size > 7) { + 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); } |