Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: AC3 over DVB-s is possible - Part2
On Tue, Feb 19, 2002 at 08:44:52PM +0000, Stefan Huelswitt wrote:
> On 19 Feb 2002 Wolfgang Fiesel <fie@iis.fhg.de> wrote:
>
> > as I promised last week,
> > now AC-3 over Digital Output (SPDIF) for DVB-S is reality (recordings
> > and DVD playback).
>
> Very good!! This is great work!! Thanks.
>
> It works fine with DVD and recordings here. CPU load is around
> 3-4% on my Celeron/400. Only drawback is, that before switching
> to DD there is a small audio glitch. By this may be because the
> DD-receiver needs some frames to detect the wrapped ac3 data.
> All trickmodes are working flawlessly here, too.
ac3play is sending a special pause frame whereas ac3dec sends
a zero frame before any AC3 warred data. The ac3play version I've
hacked on the base of ac3play-0.5.0 can use both:
static void write_pause_burst(int leadin)
{
unsigned short int *sbuf = (unsigned short int *)&buf[0];
ssize_t todo;
// Don't set or overwrite spdif header,
// this is done in spdif_init only once
switch (leadin) {
default:
case 0:
sbuf[2] = char2short(0x00, 7<<5); // null frame, stream = 7
sbuf[3] = shorts(0x0000); // No data therein
todo = SAMPLE_BUF;
break;
case 1:
sbuf[2] = char2short(0x03, 0x00); // Audio ES Channel empty, wait for DD Decoder or pause
sbuf[3] = char2short(0x20, 0x00); // Trailing frame size is 0x2000 bits aka 1024 bytes
todo = SAMPLE_BUF;
break;
case -1:
sbuf[2] = char2short(0x03, 0x01); // User stop, skip or error
sbuf[3] = char2short(0x00, 0x08); // Trailing frame size is zero
todo = 8;
break;
}
memset(&buf[8], 0, BURST_SIZE - 8);
// SAMPLE_BUF is BURST_SIZE/4
write_burst((u_char *)buf, todo);
}
BURST_SIZE is 6144 to warp AC3 frames into 4*(6*256) bytes (zero padded)
IEC 958 frame representing 2 channels both with 2 bytes in on word,
256 frames in one block, 6 blocks in one sample.
SAMPLE_BUF is 6144/4 (1536)
The macros char2short and shorts are defined as
#ifndef WORDS_BIGENDIAN
# define char2short(a,b) ((((b) << 8) & 0xffff) ^ ((a) & 0xffff))
# define shorts(a) (a)
#else
# define char2short(a,b) ((((a) << 8) & 0xffff) ^ ((b) & 0xffff))
# define shorts(a) char2short(((a) & 0xff),(((a) >> 8) & 0xff));
#endif
beside this I'm using HW ring buffering of alsa 0.9.0_cvs20020117 (8*2048 bytes)
together with SW start threshold and transfer align on 1536 bytes.
No audio glitches anymore ;^)
Werner
Home |
Main Index |
Thread Index