diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-11-24 14:48:04 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-11-24 14:48:04 +0100 |
commit | 6e6eeab1fdec4c628a624099e5d5e475ff46b619 (patch) | |
tree | b91ae8b17782cb9ea989ecac2b5b75e6613fa77a | |
parent | c1dd84e0e97390ce18d2cb49f0bf7623adda047f (diff) | |
download | vdr-6e6eeab1fdec4c628a624099e5d5e475ff46b619.tar.gz vdr-6e6eeab1fdec4c628a624099e5d5e475ff46b619.tar.bz2 |
Fixed DVD audio sync problems
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | ac3dec/ac3.h | 6 | ||||
-rw-r--r-- | ac3dec/decode.c | 8 | ||||
-rw-r--r-- | dvbapi.c | 26 |
4 files changed, 23 insertions, 18 deletions
@@ -876,3 +876,4 @@ Video Disk Recorder Revision History - Removed the range limits for the Frequency and Srate parameters of channel definitions. - Changed the maximum value for PIDs in channels.conf from 0xFFFE to 0x1FFF. +- Fixed DVD audio sync problems (thanks to Andreas Schultz). diff --git a/ac3dec/ac3.h b/ac3dec/ac3.h index d325f3bb..8f268fbd 100644 --- a/ac3dec/ac3.h +++ b/ac3dec/ac3.h @@ -19,7 +19,11 @@ * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * + *------------------------------------------------------------ * + * 24 Nov 2001 + * Andreas Schultz <aschultz@cs.uni-magdeburg.de> + * Added ac3_buffersize() */ #define AC3_BUFFER_SIZE (6*1024*16) @@ -55,4 +59,6 @@ size_t ac3dec_decode_data (plugin_output_audio_t *output, uint8_t *data_start, u size_t ac3dec_decode_data (uint8_t *data_start ,uint8_t *data_end, int ac3reset, int *input_pointer, int *output_pointer, char *ac3_data); #endif +uint32_t ac3_buffersize(); + #endif diff --git a/ac3dec/decode.c b/ac3dec/decode.c index fb852055..1ff517c4 100644 --- a/ac3dec/decode.c +++ b/ac3dec/decode.c @@ -31,6 +31,9 @@ * Matjaz Thaler <matjaz.thaler@rd.iskraemeco.si> * Added support for DVB-s PCI card * + * 24 Nov 2001 + * Andreas Schultz <aschultz@cs.uni-magdeburg.de> + * Added ac3_buffersize() */ #ifdef HAVE_CONFIG_H @@ -96,6 +99,11 @@ static uint32_t buffer_size = 0;; // for error handling jmp_buf error_jmp_mark; +uint32_t ac3_buffersize() +{ + return buffer_size; +} + static uint32_t decode_buffer_syncframe (syncinfo_t *syncinfo, uint8_t **start, uint8_t *end) { uint8_t *cur = *start; @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz <aschultz@warp10.net> * based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si> * - * $Id: dvbapi.c 1.139 2001/11/24 11:03:01 kls Exp $ + * $Id: dvbapi.c 1.140 2001/11/24 14:45:58 kls Exp $ */ //#define DVDDEBUG 1 @@ -1403,22 +1403,16 @@ cFrame *cAC3toPCM::Get(int size, uchar PTSflags, uchar *PTSdata) int p_size = (size > MAXSIZE) ? MAXSIZE : size; int length = 10; // default header bytes int header = 0; - int stuffb = 0; switch (PTSflags) { case 2: header = 5; // additional header bytes - stuffb = 1; break; case 3: header = 10; break; default: header = 0; } - // header = 0; //XXX ??? - stuffb = 0; //XXX ??? - length += header; - length += stuffb; buffer[0] = 0x00; buffer[1] = 0x00; @@ -1427,19 +1421,13 @@ cFrame *cAC3toPCM::Get(int size, uchar PTSflags, uchar *PTSdata) buffer[6] = 0x80; buffer[7] = PTSflags << 6; - buffer[8] = header + stuffb; + buffer[8] = header; if (header) memcpy(&buffer[9], (void *)PTSdata, header); - // add stuffing - data = buffer + 9 + header; - for (int cnt = 0; cnt < stuffb; cnt++) - data[cnt] = 0xff; - length += stuffb; - // add data - data = buffer + 9 + header + stuffb + 7; + data = buffer + 9 + header + 7; int cnt = 0; while (p_size) { if (ac3outp != ac3inp) { // data in the buffer @@ -1453,7 +1441,7 @@ cFrame *cAC3toPCM::Get(int size, uchar PTSflags, uchar *PTSdata) break; } - data = buffer + 9 + header + stuffb; + data = buffer + 9 + header; data[0] = aLPCM; // substream ID data[1] = 0x00; // other stuff (see DVB specs), ignored by driver data[2] = 0x00; @@ -2014,8 +2002,10 @@ void cDVDplayBuffer::handleAC3(unsigned char *sector, int length, uchar PTSflags #define PCM_FRAME_SIZE 1536 AC3toPCM.Put(sector, length); cFrame *frame; - if ((frame = AC3toPCM.Get(PCM_FRAME_SIZE, PTSflags, PTSdata)) != NULL) - putFrame(frame); + if (ac3_buffersize() <= 100) { + if ((frame = AC3toPCM.Get(PCM_FRAME_SIZE, PTSflags, PTSdata)) != NULL) + putFrame(frame); + } while ((frame = AC3toPCM.Get(PCM_FRAME_SIZE)) != NULL) putFrame(frame); } |