From cd7ccd64fd51b77b8b75b6e85ef6891b1917aa59 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 13 Oct 2002 18:00:00 +0200 Subject: Version 1.1.13 - Added cDevice::DeviceNumber() to get the number of a device, not counting any gaps that might be in the index count. - Fixed fetching the current/next information to handle cases where the duration of an event is set wrongly and would last beyond the start time of the next event. - Adapted type names to the new HEAD version of the driver (which the previous NEWSTRUCT branch has been merged into). Note that to use this driver version you still need to add NEWSTRUCT=1 to the make call when building VDR. You need a HEAD version of the LinuxDVB driver dated 2002-10-11 or later to compile VDR with NEWSTRUCT=1. - Fixed radio channels in channels.conf.cable (thanks to Robert Schiele and Uwe Scheffler). - Fixed switching the video format in the Setup/DVB menu (thanks to Uwe Scheffler for reporting this one). - Reactivated full handling of second audio PID (even in 'Transfer Mode'). - Fixed a crash when closing down with remote control plugins (thanks to Oliver Endriss helping to debug this one). - Commands in the file 'commands.conf' can now have a '?' at the end of their title, which will result in a confirmation prompt before executing the command. - Changed a few leftover 'new char[...]' to MALLOC(char, ...). - If a command executed from the "Commands" menu doesn't return any output, the OSD will now be closed automatically. - The SVDRP command PUTE now triggers an immediate write of the 'epg.data' file (suggested by Gerhard Steiner). - The new configuration file 'reccmds.conf' can be used to define commands that shall be executed from the "Recordings" menu; see MANUAL and 'man vdr(5)' for details (suggested by Gerhard Steiner). --- transfer.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 11 deletions(-) (limited to 'transfer.c') diff --git a/transfer.c b/transfer.c index bd4390b..adb7260 100644 --- a/transfer.c +++ b/transfer.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: transfer.c 1.3 2002/09/22 09:50:48 kls Exp $ + * $Id: transfer.c 1.4 2002/10/12 13:32:48 kls Exp $ */ #include "transfer.h" @@ -21,6 +21,8 @@ cTransfer::cTransfer(int VPid, int APid1, int APid2, int DPid1, int DPid2) { ringBuffer = new cRingBufferLinear(VIDEOBUFSIZE, true); remux = new cRemux(VPid, APid1, APid2, DPid1, DPid2); + canToggleAudioTrack = false; + audioTrack = 0xC0; gotBufferReserve = false; active = false; } @@ -86,9 +88,9 @@ void cTransfer::Action(void) if (r > 0) { int Count = r, Result; - const uchar *p = remux->Process(b, Count, Result); + uchar *p = remux->Process(b, Count, Result); if (p) { - //XXX+ StripAudio??? + StripAudioPackets(p, Result, audioTrack); while (Result > 0 && active) { int w = PlayVideo(p, Result); if (w > 0) { @@ -112,15 +114,65 @@ void cTransfer::Action(void) dsyslog("transfer thread ended (pid=%d)", getpid()); } -void cTransfer::SetAudioPid(int APid) +void cTransfer::StripAudioPackets(uchar *b, int Length, uchar Except) { - /*XXX+ - Clear(); - //XXX we may need to have access to the audio device, too, in order to clear it - CHECK(ioctl(toDevice, VIDEO_CLEAR_BUFFER)); - gotBufferReserve = false; - remux.SetAudioPid(APid); - XXX*/ + for (int i = 0; i < Length - 6; i++) { + if (b[i] == 0x00 && b[i + 1] == 0x00 && b[i + 2] == 0x01) { + uchar c = b[i + 3]; + int l = b[i + 4] * 256 + b[i + 5] + 6; + switch (c) { + case 0xBD: // dolby + if (Except) + ;//XXX+ PlayExternalDolby(&b[i], Length - i); + // continue with deleting the data - otherwise it disturbs DVB replay + case 0xC0 ... 0xC1: // audio + if (c == 0xC1) + canToggleAudioTrack = true; + if (!Except || c != Except) { + int n = l; + for (int j = i; j < Length && n--; j++) + b[j] = 0x00; + } + break; + case 0xE0 ... 0xEF: // video + break; + default: + //esyslog("ERROR: unexpected packet id %02X", c); + l = 0; + } + if (l) + i += l - 1; // the loop increments, too! + } + /*XXX + else + esyslog("ERROR: broken packet header"); + XXX*/ + } +} + +int cTransfer::NumAudioTracks(void) const +{ + return canToggleAudioTrack ? 2 : 1; +} + +const char **cTransfer::GetAudioTracks(int *CurrentTrack = NULL) const +{ + if (NumAudioTracks()) { + if (CurrentTrack) + *CurrentTrack = (audioTrack == 0xC0) ? 0 : 1; + static const char *audioTracks1[] = { "Audio 1", NULL }; + static const char *audioTracks2[] = { "Audio 1", "Audio 2", NULL }; + return NumAudioTracks() > 1 ? audioTracks2 : audioTracks1; + } + return NULL; +} + +void cTransfer::SetAudioTrack(int Index) +{ + if ((audioTrack == 0xC0) != (Index == 0)) { + audioTrack = (Index == 1) ? 0xC1 : 0xC0; + DeviceClear(); + } } // --- cTransferControl ------------------------------------------------------ -- cgit v1.2.3