1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed DVD audio sync problems

This commit is contained in:
Klaus Schmidinger 2001-11-24 14:48:04 +01:00
parent c1dd84e0e9
commit 6e6eeab1fd
4 changed files with 23 additions and 18 deletions

View File

@ -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).

View File

@ -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

View File

@ -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;

View File

@ -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);
}