diff options
author | Johns <johns98@gmx.net> | 2012-02-11 18:22:48 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-02-11 18:22:48 +0100 |
commit | a91533f6d1c3c723ef7e4ac89b1d7d53014453b5 (patch) | |
tree | b02d845fec3354cf7723d99abceecc4e912f248d | |
parent | baa4500a2c0214c3022e43377e31620b43d85f8f (diff) | |
download | vdr-plugin-softhddevice-a91533f6d1c3c723ef7e4ac89b1d7d53014453b5.tar.gz vdr-plugin-softhddevice-a91533f6d1c3c723ef7e4ac89b1d7d53014453b5.tar.bz2 |
Detect audio stream type only after stream switch.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | README.txt | 5 | ||||
-rw-r--r-- | Todo | 4 | ||||
-rw-r--r-- | audio.c | 8 | ||||
-rw-r--r-- | codec.c | 2 | ||||
-rw-r--r-- | softhddev.c | 157 |
6 files changed, 91 insertions, 86 deletions
@@ -1,6 +1,7 @@ User johns Date: + Detect audio stream type only after stream switch. Detect more h264 streams with leading zeros. VDPAU: support for studio levels added. Add support for skip chroma deinterlace to software deinterlacer. @@ -156,6 +156,11 @@ Setup: /etc/vdr/setup.conf softhddevice.Suspend.X11 = 0 1 suspend stops X11 server (not working yet) + VideoDisplayFormat = ? + 0 pan and scan + 1 letter box + 2 center cut-out + Setup: /etc/vdr/remote.conf ------ @@ -40,6 +40,7 @@ video: OSD can only be shown after some stream could be shown yaepghd changed position is lost on channel switch use x11 screen size without geometry configuration + pause (live tv) has sometime problems with SAT1 HD Pro7 HD vdpau: software decoder path not working @@ -83,10 +84,9 @@ audio: selectable. software volume support add pause support for replay pause - some plugin send a private LPCM stream (CODEC_ID_PCM_DVD), which - isn't supported by ffmpeg, write own parser. Mute should do a real mute and not only set volume to zero. Starting suspended and muted, didn't register the mute. + switching stero/dolby produces klick sound audio/alsa: better downmix of >2 channels on 2 channel hardware @@ -2070,13 +2070,7 @@ int64_t AudioGetClock(void) */ void AudioSetVolume(int volume) { -#ifdef USE_ALSA - AlsaSetVolume(volume); -#endif -#ifdef USE_OSS - OssSetVolume(volume); -#endif - (void)volume; + return AudioUsedModule->SetVolume(volume); } /** @@ -877,7 +877,7 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt) int err; int isAC3; - // FIXME: use swr_convert from swresample + // FIXME: use swr_convert from swresample (only in ffmpeg!) // FIXME: tell ac3 decoder to use downmix if (audio_decoder->ReSample) { audio_resample_close(audio_decoder->ReSample); diff --git a/softhddev.c b/softhddev.c index d8fccb4..3e1e7cb 100644 --- a/softhddev.c +++ b/softhddev.c @@ -76,6 +76,7 @@ static volatile char NewAudioStream; ///< new audio stream static volatile char SkipAudio; ///< skip audio stream static AudioDecoder *MyAudioDecoder; ///< audio decoder static enum CodecID AudioCodecID; ///< current codec id +static int AudioChannelID; ///< current audio channel id /** ** mpeg bitrate table. @@ -202,8 +203,7 @@ static int FindAudioSync(const AVPacket * avpkt) ** @param size size of PES packet ** @param id PES packet type */ -int PlayAudio(const uint8_t * data, int size, - __attribute__ ((unused)) uint8_t id) +int PlayAudio(const uint8_t * data, int size, uint8_t id) { int n; int osize; @@ -263,87 +263,92 @@ int PlayAudio(const uint8_t * data, int size, // Detect audio code // MPEG-PS mp2 MPEG1, MPEG2, AC3, LPCM, AAC LATM - // Syncword - 0x0B77 - if (data[0] == 0x0B && data[1] == 0x77) { - if (AudioCodecID != CODEC_ID_AC3) { - Debug(3, "[softhddev]%s: AC-3 %d\n", __FUNCTION__, id); - CodecAudioClose(MyAudioDecoder); - CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_AC3); - AudioCodecID = CODEC_ID_AC3; - } - // Syncword - 0xFFFC - 0xFFFF - } else if (data[0] == 0xFF && (data[1] & 0xFC) == 0xFC) { - if (AudioCodecID != CODEC_ID_MP2) { - Debug(3, "[softhddev]%s: MP2 %d\n", __FUNCTION__, id); - CodecAudioClose(MyAudioDecoder); - CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_MP2); - AudioCodecID = CODEC_ID_MP2; - } - // latm header 0x56E0 11bits: 0x2B7 - } else if (data[0] == 0x56 && (data[1] & 0xE0) == 0xE0) { - if (AudioCodecID != CODEC_ID_AAC_LATM) { - Debug(3, "[softhddev]%s: AAC LATM %d\n", __FUNCTION__, id); - CodecAudioClose(MyAudioDecoder); - CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_AAC_LATM); - AudioCodecID = CODEC_ID_AAC_LATM; - } - // Private stream + 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] >> 4, - (((data[5] >> 6) & 0x3) + 4) * 4, (data[5] & 0x7) + 1); - CodecAudioClose(MyAudioDecoder); - - 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. + // only if unknown or new channel id + if (AudioCodecID == CODEC_ID_NONE || AudioChannelID != id) { + AudioChannelID = id; + // Syncword - 0x0B77 + if (data[0] == 0x0B && data[1] == 0x77) { + if (AudioCodecID != CODEC_ID_AC3) { + Debug(3, "[softhddev]%s: AC-3 %d\n", __FUNCTION__, id); + CodecAudioClose(MyAudioDecoder); + CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_AC3); + AudioCodecID = CODEC_ID_AC3; } - samplerate = samplerates[data[5] >> 4]; - channels = (data[5] & 0x7) + 1; - AudioSetup(&samplerate, &channels, 0); - if (samplerate != samplerates[data[5] >> 4]) { - Error(_("softhddev: LPCM %d sample-rate is unsupported\n"), - samplerates[data[5] >> 4]); - // FIXME: support resample + // Syncword - 0xFFFC - 0xFFFF + } else if (data[0] == 0xFF && (data[1] & 0xFC) == 0xFC) { + if (AudioCodecID != CODEC_ID_MP2) { + Debug(3, "[softhddev]%s: MP2 %d\n", __FUNCTION__, id); + CodecAudioClose(MyAudioDecoder); + CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_MP2); + AudioCodecID = CODEC_ID_MP2; } - if (channels != (data[5] & 0x7) + 1) { - Error(_("softhddev: LPCM %d channels are unsupported\n"), - (data[5] & 0x7) + 1); - // FIXME: support resample + // latm header 0x56E0 11bits: 0x2B7 + } else if (data[0] == 0x56 && (data[1] & 0xE0) == 0xE0) { + // && (((data[1] & 0x1F) << 8) + (data[2] & 0xFF)) < size + if (AudioCodecID != CODEC_ID_AAC_LATM) { + Debug(3, "[softhddev]%s: AAC LATM %d\n", __FUNCTION__, id); + CodecAudioClose(MyAudioDecoder); + CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_AAC_LATM); + AudioCodecID = CODEC_ID_AAC_LATM; } - //CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_PCM_DVD); - AudioCodecID = CODEC_ID_PCM_DVD; - } - } else { - // no start package - // FIXME: Nick/Viva sends this shit, need to find sync in packet - // FIXME: otherwise it takes too long until sound appears + // Private stream + 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] >> 4, + (((data[5] >> 6) & 0x3) + 4) * 4, (data[5] & 0x7) + 1); + CodecAudioClose(MyAudioDecoder); - if (AudioCodecID == CODEC_ID_NONE) { - Debug(3, "[softhddev]%s: ??? %d\n", __FUNCTION__, id); - avpkt->data = (void *)data; - avpkt->size = size; - n = FindAudioSync(avpkt); - if (n < 0) { - return osize; + 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); + 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; } + } else { + // no start package + // FIXME: Nick/Viva sends this shit, need to find sync in packet + // FIXME: otherwise it takes too long until sound appears + + if (AudioCodecID == CODEC_ID_NONE) { + Debug(3, "[softhddev]%s: ??? %d\n", __FUNCTION__, id); + avpkt->data = (void *)data; + avpkt->size = size; + n = FindAudioSync(avpkt); + if (1 && n < 0) { + return osize; + } - avpkt->pts = AV_NOPTS_VALUE; - CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_MP2); - AudioCodecID = CODEC_ID_MP2; - data += n; - size -= n; + avpkt->pts = AV_NOPTS_VALUE; + CodecAudioOpen(MyAudioDecoder, NULL, CODEC_ID_MP2); + AudioCodecID = CODEC_ID_MP2; + data += n; + size -= n; + } } - // no decoder or codec known + // still no decoder or codec known if (AudioCodecID == CODEC_ID_NONE) { return osize; } |