Added support for ATSC devices

This commit is contained in:
Klaus Schmidinger 2010-03-06 12:01:17 +01:00
parent 3e09f8565d
commit ab9af4cea1
9 changed files with 82 additions and 32 deletions

View File

@ -2572,3 +2572,6 @@ Stephan Austerm
Lars Hanisch <dvb@flensrocker.de>
for suggesting to assign the source character 'V' to "Analog Video"
Alex Lasnier <alex@fepg.org>
for adding tuning support for ATSC devices

View File

@ -6384,8 +6384,10 @@ Video Disk Recorder Revision History
tracks appear in the "Audio" menu. Dolby Digital is always recorded.
This obsoletes the DOLBYINREC patch.
2010-03-05: Version 1.7.14
2010-03-06: Version 1.7.14
- Fixed handling empty strings in cSource::FromString().
- Assigned the source character 'I' to "IPTV" (suggested by Rolf Ahrenberg).
- Assigned the source character 'V' to "Analog Video" (suggested by Lars Hanisch).
- Added support for ATSC devices (thanks to Alex Lasnier).
This obsoletes the ATSC patch.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 2.8 2010/02/21 14:05:49 kls Exp $
* $Id: channels.h 2.9 2010/03/06 11:54:17 kls Exp $
*/
#ifndef __CHANNELS_H
@ -172,6 +172,7 @@ public:
const char *Parameters(void) const { return parameters; }
const cLinkChannels* LinkChannels(void) const { return linkChannels; }
const cChannel *RefChannel(void) const { return refChannel; }
bool IsAtsc(void) const { return cSource::IsAtsc(source); }
bool IsCable(void) const { return cSource::IsCable(source); }
bool IsSat(void) const { return cSource::IsSat(source); }
bool IsTerr(void) const { return cSource::IsTerr(source); }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 2.29 2010/02/21 17:10:35 kls Exp $
* $Id: dvbdevice.c 2.30 2010/03/06 11:07:05 kls Exp $
*/
#include "dvbdevice.h"
@ -27,6 +27,8 @@
#define DVBC_LOCK_TIMEOUT 2000 //ms
#define DVBT_TUNE_TIMEOUT 9000 //ms
#define DVBT_LOCK_TIMEOUT 2000 //ms
#define ATSC_TUNE_TIMEOUT 9000 //ms
#define ATSC_LOCK_TIMEOUT 2000 //ms
// --- DVB Parameter Maps ----------------------------------------------------
@ -184,17 +186,17 @@ cString cDvbTransponderParameters::ToString(char Type) const
char buffer[64];
char *q = buffer;
*q = 0;
ST(" S ") q += sprintf(q, "%c", polarization);
ST(" T") q += PrintParameter(q, 'B', MapToUser(bandwidth, BandwidthValues));
ST("CST") q += PrintParameter(q, 'C', MapToUser(coderateH, CoderateValues));
ST(" T") q += PrintParameter(q, 'D', MapToUser(coderateL, CoderateValues));
ST(" T") q += PrintParameter(q, 'G', MapToUser(guard, GuardValues));
ST("CST") q += PrintParameter(q, 'I', MapToUser(inversion, InversionValues));
ST("CST") q += PrintParameter(q, 'M', MapToUser(modulation, ModulationValues));
ST(" S ") q += PrintParameter(q, 'O', MapToUser(rollOff, RollOffValues));
ST(" S ") q += PrintParameter(q, 'S', MapToUser(system, SystemValues));
ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues));
ST(" T") q += PrintParameter(q, 'Y', MapToUser(hierarchy, HierarchyValues));
ST(" S ") q += sprintf(q, "%c", polarization);
ST(" T") q += PrintParameter(q, 'B', MapToUser(bandwidth, BandwidthValues));
ST(" CST") q += PrintParameter(q, 'C', MapToUser(coderateH, CoderateValues));
ST(" T") q += PrintParameter(q, 'D', MapToUser(coderateL, CoderateValues));
ST(" T") q += PrintParameter(q, 'G', MapToUser(guard, GuardValues));
ST("ACST") q += PrintParameter(q, 'I', MapToUser(inversion, InversionValues));
ST("ACST") q += PrintParameter(q, 'M', MapToUser(modulation, ModulationValues));
ST(" S ") q += PrintParameter(q, 'O', MapToUser(rollOff, RollOffValues));
ST(" S ") q += PrintParameter(q, 'S', MapToUser(system, SystemValues));
ST(" T") q += PrintParameter(q, 'T', MapToUser(transmission, TransmissionValues));
ST(" T") q += PrintParameter(q, 'Y', MapToUser(hierarchy, HierarchyValues));
return buffer;
}
@ -486,6 +488,16 @@ bool cDvbTuner::SetFrontend(void)
tuneTimeout = DVBT_TUNE_TIMEOUT;
lockTimeout = DVBT_LOCK_TIMEOUT;
}
else if (frontendType == SYS_ATSC) {
// ATSC
SETCMD(DTV_DELIVERY_SYSTEM, frontendType);
SETCMD(DTV_FREQUENCY, FrequencyToHz(channel.Frequency()));
SETCMD(DTV_INVERSION, dtp.Inversion());
SETCMD(DTV_MODULATION, dtp.Modulation());
tuneTimeout = ATSC_TUNE_TIMEOUT;
lockTimeout = ATSC_LOCK_TIMEOUT;
}
else {
esyslog("ERROR: attempt to set channel with unknown DVB frontend type");
return false;
@ -598,18 +610,18 @@ cOsdItem *cDvbSourceParam::GetOsdItem(void)
#undef ST
#define ST(s) if (strchr(s, type))
switch (param++) {
case 0: ST(" S ") return new cMenuEditChrItem( tr("Polarization"), &dtp.polarization, "hvlr"); else return GetOsdItem();
case 1: ST(" S ") return new cMenuEditMapItem( tr("System"), &dtp.system, SystemValues); else return GetOsdItem();
case 2: ST("CS ") return new cMenuEditIntItem( tr("Srate"), &data.srate); else return GetOsdItem();
case 3: ST("CST") return new cMenuEditMapItem( tr("Inversion"), &dtp.inversion, InversionValues); else return GetOsdItem();
case 4: ST("CST") return new cMenuEditMapItem( tr("CoderateH"), &dtp.coderateH, CoderateValues); else return GetOsdItem();
case 5: ST(" T") return new cMenuEditMapItem( tr("CoderateL"), &dtp.coderateL, CoderateValues); else return GetOsdItem();
case 6: ST("CST") return new cMenuEditMapItem( tr("Modulation"), &dtp.modulation, ModulationValues); else return GetOsdItem();
case 7: ST(" T") return new cMenuEditMapItem( tr("Bandwidth"), &dtp.bandwidth, BandwidthValues); else return GetOsdItem();
case 8: ST(" T") return new cMenuEditMapItem( tr("Transmission"), &dtp.transmission, TransmissionValues); else return GetOsdItem();
case 9: ST(" T") return new cMenuEditMapItem( tr("Guard"), &dtp.guard, GuardValues); else return GetOsdItem();
case 10: ST(" T") return new cMenuEditMapItem( tr("Hierarchy"), &dtp.hierarchy, HierarchyValues); else return GetOsdItem();
case 11: ST(" S ") return new cMenuEditMapItem( tr("Rolloff"), &dtp.rollOff, RollOffValues); else return GetOsdItem();
case 0: ST(" S ") return new cMenuEditChrItem( tr("Polarization"), &dtp.polarization, "hvlr"); else return GetOsdItem();
case 1: ST(" S ") return new cMenuEditMapItem( tr("System"), &dtp.system, SystemValues); else return GetOsdItem();
case 2: ST(" CS ") return new cMenuEditIntItem( tr("Srate"), &data.srate); else return GetOsdItem();
case 3: ST("ACST") return new cMenuEditMapItem( tr("Inversion"), &dtp.inversion, InversionValues); else return GetOsdItem();
case 4: ST(" CST") return new cMenuEditMapItem( tr("CoderateH"), &dtp.coderateH, CoderateValues); else return GetOsdItem();
case 5: ST(" T") return new cMenuEditMapItem( tr("CoderateL"), &dtp.coderateL, CoderateValues); else return GetOsdItem();
case 6: ST("ACST") return new cMenuEditMapItem( tr("Modulation"), &dtp.modulation, ModulationValues); else return GetOsdItem();
case 7: ST(" T") return new cMenuEditMapItem( tr("Bandwidth"), &dtp.bandwidth, BandwidthValues); else return GetOsdItem();
case 8: ST(" T") return new cMenuEditMapItem( tr("Transmission"), &dtp.transmission, TransmissionValues); else return GetOsdItem();
case 9: ST(" T") return new cMenuEditMapItem( tr("Guard"), &dtp.guard, GuardValues); else return GetOsdItem();
case 10: ST(" T") return new cMenuEditMapItem( tr("Hierarchy"), &dtp.hierarchy, HierarchyValues); else return GetOsdItem();
case 11: ST(" S ") return new cMenuEditMapItem( tr("Rolloff"), &dtp.rollOff, RollOffValues); else return GetOsdItem();
default: return NULL;
}
return NULL;
@ -745,6 +757,7 @@ bool cDvbDevice::Probe(int Adapter, int Frontend)
bool cDvbDevice::Initialize(void)
{
new cDvbSourceParam('A', "ATSC");
new cDvbSourceParam('C', "DVB-C");
new cDvbSourceParam('S', "DVB-S");
new cDvbSourceParam('T', "DVB-T");
@ -863,6 +876,7 @@ bool cDvbDevice::ProvidesSource(int Source) const
{
int type = Source & cSource::st_Mask;
return type == cSource::stNone
|| type == cSource::stAtsc && (frontendType == SYS_ATSC)
|| type == cSource::stCable && (frontendType == SYS_DVBC_ANNEX_AC || frontendType == SYS_DVBC_ANNEX_B)
|| type == cSource::stSat && (frontendType == SYS_DVBS || frontendType == SYS_DVBS2)
|| type == cSource::stTerr && (frontendType == SYS_DVBT);

25
pat.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: pat.c 2.7 2010/01/01 15:40:05 kls Exp $
* $Id: pat.c 2.8 2010/03/06 12:00:30 kls Exp $
*/
#include "pat.h"
@ -447,6 +447,29 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
}
}
break;
case 0x81: // STREAMTYPE_USER_PRIVATE
if (Channel->IsAtsc()) { // ATSC AC-3
char lang[MAXLANGCODE1] = { 0 };
SI::Descriptor *d;
for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
switch (d->getDescriptorTag()) {
case SI::ISO639LanguageDescriptorTag: {
SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d;
strn0cpy(lang, I18nNormalizeLanguageCode(ld->languageCode), MAXLANGCODE1);
}
break;
default: ;
}
delete d;
}
if (NumDpids < MAXDPIDS) {
Dpids[NumDpids] = esPid;
strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1);
NumDpids++;
}
ProcessCaDescriptors = true;
}
break;
default: ;//printf("PID: %5d %5d %2d %3d %3d\n", pmt.getServiceId(), stream.getPid(), stream.getStreamType(), pmt.getVersionNumber(), Channel->Number());
}
if (ProcessCaDescriptors) {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: sourceparams.c 1.1 2010/02/28 12:15:49 kls Exp $
* $Id: sourceparams.c 1.2 2010/03/06 11:13:39 kls Exp $
*/
#include "sourceparams.h"
@ -21,7 +21,7 @@ cSourceParam::cSourceParam(char Source, const char *Description)
return;
}
SourceParams.Add(this);
if (Source != 'C' && Source != 'S' && Source != 'T')
if (!strchr("ACST", Source)) // no, it's not "ATSC" ;-)
Sources.Add(new cSource(Source, Description));
dsyslog("registered source parameters for '%c - %s'", source, Description);
}

View File

@ -196,6 +196,10 @@ C DVB-C
T DVB-T
# ATSC
A ATSC
# Plugins
I IPTV

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: sources.h 2.1 2010/02/21 16:11:19 kls Exp $
* $Id: sources.h 2.2 2010/03/06 11:53:54 kls Exp $
*/
#ifndef __SOURCES_H
@ -16,6 +16,7 @@ class cSource : public cListObject {
public:
enum eSourceType {
stNone = 0x00000000,
stAtsc = ('A' << 24),
stCable = ('C' << 24),
stSat = ('S' << 24),
stTerr = ('T' << 24),
@ -35,6 +36,7 @@ public:
static cString ToString(int Code);
static int FromString(const char *s);
static int FromData(eSourceType SourceType, int Position = 0, bool East = false);
static bool IsAtsc(int Code) { return (Code & st_Mask) == stAtsc; }
static bool IsCable(int Code) { return (Code & st_Mask) == stCable; }
static bool IsSat(int Code) { return (Code & st_Mask) == stSat; }
static bool IsTerr(int Code) { return (Code & st_Mask) == stTerr; }

5
vdr.5
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
.\" $Id: vdr.5 2.15 2010/02/21 14:29:06 kls Exp $
.\" $Id: vdr.5 2.16 2010/03/06 12:01:00 kls Exp $
.\"
.TH vdr 5 "10 Feb 2008" "1.6" "Video Disk Recorder Files"
.SH NAME
@ -402,8 +402,9 @@ The first character of the \fBcode\fR must be one of
.TS
tab (@);
l l.
\fBS\fR@Satellite
\fBA\fR@ATSC
\fBC\fR@Cable
\fBS\fR@Satellite
\fBT\fR@Terrestrial
.TE