Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- ==============
- (©) by Michael Slomski
- ==============
- This stuff will read a ".mst40" File from Metz-TV and a write some of the content to a pure text file.
- User of your own risk!
- For every Questions write to alex.in.muc at web dot de
- *)
- property unsigned : false -- 0..255 oder 0..65553
- property signed : true -- -127..127 oder -31xxx..31xxx
- global rawData
- (* ====================================================== *)
- to data_to_string(d)
- try
- d as text
- on error m
- end try
- set o1 to offset of "«" in m
- set o2 to offset of "»" in m
- {m's text (o1 + 6) thru (o1 + 9), m's text (o1 + 10) thru (o2 - 1)}
- end data_to_string
- on Hex2String(inData)
- set theString to ""
- repeat with i from 1 to count inData by 2
- set theString to theString & character id hexToNum((item i of inData & item (i + 1) of inData), unsigned)
- end repeat
- return theString
- end Hex2String
- on hexToNum(inVal, myParam)
- script o
- property hexChrs : "0123456789abcdef" as Unicode text -- TIDs obey AppleScript's case attribute with Unicode.
- on getHexVal(c)
- set AppleScript's text item delimiters to c
- set v to (count text item 1 of hexChrs)
- if (v is 16) then error "Non-hex character(s)."
- return v
- end getHexVal
- end script
- set astid to AppleScript's text item delimiters
- try
- set inVal to inVal as Unicode text -- Speeds up use of TIDs with Unicode 'hexChrs' in o.
- tell o to set n to getHexVal(character 1 of inVal)
- if myParam and (n > 7) then set n to n - 16
- repeat with i from 2 to (count inVal)
- tell o to set n to n * 16 + getHexVal(character i of inVal)
- end repeat
- on error msg number errNum
- set AppleScript's text item delimiters to astid
- log inVal
- error "hexToNum handler: " & msg number errNum
- end try
- set AppleScript's text item delimiters to astid
- return n
- end hexToNum
- on getN_Bytes(theOff, theLen)
- set h to theOff * 2 - 1
- set inData to text h thru (h + theLen * 2 - 1) of rawData
- set theAscii to ""
- repeat with i from 1 to count inData by 2
- set theAscii to theAscii & " " & (item i of inData & item (i + 1) of inData)
- end repeat
- return {theOff + theLen, theAscii}
- end getN_Bytes
- on getInt16(theOff, mySign)
- set h to theOff * 2 - 1
- set hexStr to text (h + 2) thru (h + 3) of rawData & text h thru (h + 1) of rawData
- return {theOff + 2, hexToNum(hexStr, mySign)}
- end getInt16
- on getInt32(theOff, mySign)
- set h to theOff * 2 - 1
- set hexStr to text (h + 6) thru (h + 7) of rawData & text (h + 4) thru (h + 5) of rawData & text (h + 2) thru (h + 3) of rawData & text h thru (h + 1) of rawData
- return {theOff + 4, hexToNum(hexStr, mySign)} -- newOff, value
- end getInt32
- on getByte(theOff, mySign)
- set h to theOff * 2 - 1
- set hexStr to text h thru (h + 1) of rawData
- if mySign = 1 then
- -- Wertebereich immer nur 0..9
- set retval to hexStr as number
- else
- set retval to hexToNum(hexStr, mySign)
- end if
- return {theOff + 1, retval}
- end getByte
- on getBool(theOff)
- set {nextPos, nHex} to getByte(theOff, unsigned)
- return {nextPos, item (nHex + 1) of {false, true}}
- end getBool
- on getFreq(theOff)
- set {h, a} to getByte(theOff, unsigned)
- set {h, b} to getByte(theOff + 1, unsigned)
- --log {a, b, (a / 16) + (b * 16)}
- return {theOff + 2, (a / 16) + (b * 16)}
- end getFreq
- on get2ByteHex(theOff)
- set h to theOff * 2 - 1
- set hexStr to text (h + 2) thru (h + 3) of rawData & text h thru (h + 1) of rawData
- return {theOff + 2, hexStr} -- newOff, value
- end get2ByteHex
- on get3ByteHex(theOff)
- set h to theOff * 2 - 1
- set hexStr to text (h + 4) thru (h + 5) of rawData & text (h + 2) thru (h + 3) of rawData & text h thru (h + 1) of rawData
- return {theOff + 3, hexStr} -- newOff, value
- end get3ByteHex
- on doShowTvList(tvList)
- try
- set exFile to (choose file name with prompt "Senderliste speichern" default name "Senderliste.txt") as text
- if exFile does not end with ".txt" then set exFile to exFile & ".txt"
- set exFileRef to (open for access exFile with write permission)
- set fileOpen to true
- set AppleScript's text item delimiters to tab
- on error
- set fileOpen to false
- log "Fehler 1"
- end try
- try
- repeat with aItem in tvList
- log aItem
- if fileOpen then
- write (aItem as text) to exFileRef
- write return to exFileRef
- end if
- end repeat
- on error
- if fileOpen = true then close exFileRef
- set fileOpen to false
- log "Fehler 2"
- set AppleScript's text item delimiters to ""
- end try
- if fileOpen = true then
- close exFileRef
- set AppleScript's text item delimiters to ""
- end if
- end doShowTvList
- on getText(theOff, theLen)
- --log {theOff, theLen}
- set h to theOff * 2 - 1
- set hexStr to text h thru (h + theLen * 2 - 1) of rawData
- return Hex2String(hexStr)
- end getText
- (* ====================================================== *)
- (* ====================================================== *)
- on getAllgemein(someOffset, blockSize)
- --set {h, sData} to (getN_Bytes(someOffset, blockSize))
- --log {someOffset, h, sData}
- set aLen to 0
- set aName to ""
- set aDecoder to false
- set aKlang to "generell"
- set aKlangKorr to 0
- set aEPG to false
- -- charCodeTable
- set {h, aCharCodeTable} to getByte(someOffset, unsigned) -- wirklich true, d.h immer < 10?
- --log {h, aCharCodeTable}
- -- Decoder (yes/no) {0=off, 1 = on}
- set {h, aDecoder} to getBool(someOffset + 1)
- --log {h, "Decoder: ", aDecoder}
- -- Klangeinstellung (generell / Sprache / Normal) { 0,1,2}
- set {h, aKlang} to getByte(someOffset + 2, unsigned)
- set aKlang to item (aKlang + 1) of {"generell", "Sprache", "Normal"}
- --log {h, "Klang: ", aKlang}
- -- Lautstärkeeinstellung (-30..30)
- set {h, aKlangKorr} to getByte(someOffset + 3, unsigned)
- --log {h, aKlangKorr}
- -- in EPG anzeigen (true / false) {0=off, 1 = on}
- set {h, aEPG} to getBool(someOffset + 4)
- --log {h, aEPG}
- return {aCharCodeTable, aDecoder, aKlang, aKlangKorr, aEPG}
- end getAllgemein
- on getTV(someOffset)
- set aCNI to "0000"
- set aFarbKorr to 0
- set aKontrastKorr to 0
- set aBildKorr to 0
- set aRauschRed to 0
- set aCTI to 0
- set aKammfilter to 0
- set aFarbversatz to 0
- set aBildformat to 0
- set aVideoprofil to 0
- -- CNI-Daten { 0x0000 }
- set {h, aCNI} to get2ByteHex(someOffset)
- --log {h, "aCNI : 0x" & aCNI}
- -- Farbstärke-Korr {-30..30}
- set {h, aFarbKorr} to getByte(someOffset + 2, unsigned)
- --log {h, "aFarbKorr : ", aFarbKorr}
- -- Kontrast-Korr {-30..30}
- set {h, aKontrastKorr} to getByte(someOffset + 3, unsigned)
- --log {h, "aKontrastKorr : ", aKontrastKorr}
- -- Bildschärfe-Korr {generell, 1..5}
- set {h, aBildKorr} to getByte(someOffset + 4, unsigned)
- --log {h, "aBildKorr : ", aBildKorr}
- set aBildKorr to item (aBildKorr + 1) of {"generell", 1, 2, 3, 4, 5}
- -- Rauschreduktion {0..5}
- set {h, aRauschRed} to getByte(someOffset + 5, unsigned)
- --log {h, "aRauschRed : ", aRauschRed}
- -- CTI {"generell", "aus", "an"}
- set {h, aCTI} to getByte(someOffset + 6, unsigned)
- --log {h, "aCTI : ", aCTI}
- set aCTI to item (aCTI + 1) of {"generell", "aus", "an"}
- -- Kammfilter {"generell", "aus", "an"}
- set {h, aKammfilter} to getByte(someOffset + 7, unsigned)
- --log {h, "aKammfilter : ", aKammfilter}
- set aKammfilter to item (aKammfilter + 1) of {"generell", "aus", "an"}
- --log {h, "aKammfilter : ", aKammfilter}
- -- Farbversatz {-3..3}
- set {h, aFarbversatz} to getByte(someOffset + 8, unsigned)
- --log {h, "aFarbversatz : ", aFarbversatz}
- -- Bildformat
- set {h, aBildformat} to getByte(someOffset + 9, unsigned)
- --log {h, "aBildformat : ", aBildformat}
- set aBildformat to item (aBildformat + 1) of {"4:3", "16:9", "Automatik", "Original"}
- --log {h, 4, aBildformat}
- -- Videoprofil {}
- set {h, aVideoprofil} to getByte(someOffset + 10, unsigned)
- --log {h, "aVideoprofil : ", aVideoprofil}
- set aVideoprofil to item (aVideoprofil + 1) of {"Standard", "Sport", "Brillant", "Spiele", "PC_Monitor", "Benutzer", "undefiniert", "generell"}
- --log {h, "aVideoprofil : ", aVideoprofil}
- return {aCNI, aFarbKorr, aKontrastKorr, aBildKorr, aRauschRed, aCTI, aKammfilter, aFarbversatz, aBildformat, aVideoprofil}
- end getTV
- (* DVB *)
- on getDVB(someOffset, blkSize, isRadio)
- set aServiceID to 0
- set aIsCryped to false
- set aCaNr to 0
- set aVideoDecoder to 0
- set aSubAudio to false
- set aAudioTag to 0
- set aVideoFormat to 0
- set aAudioFormat to 0
- set aCaSystemPIDs to {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -- 16 HexWerte á 2 Byte
- set pIDs to {0, 0, 0, 0}
- set {h, aServiceID} to getInt16(someOffset + 6, unsigned)
- --log {"aserviceID : ", aserviceID}
- set aCaSystemPIDs to {}
- repeat with i from 0 to 15 --16x2Byte
- --set h to (someOffset + 8) + i * 2
- set {h, aPID} to get2ByteHex(h)
- set aCaSystemPIDs to aCaSystemPIDs & aPID
- end repeat
- log {h, "aCaSystemPIDs : ", aCaSystemPIDs}
- set {h, aIsCryped} to getBool(someOffset + 40)
- --log {h, "aIsCryped : ", aIsCryped}
- set {h, aCaNr} to getByte(someOffset + 41, unsigned)
- set aCaNr to item (aCaNr + 1) of {"kein", "1", "2", "auto"}
- --log {h, "aCaNr : ", aCaNr}
- set {h, aVideoDecoder} to getByte(someOffset + 42, unsigned)
- set aVideoDecoder to item (aVideoDecoder + 1) of {"SD", "HD", "kein"}
- --log {h, "aVideoDecoder : ", aVideoDecoder}
- set {h, aSubAudio} to getBool(someOffset + 43)
- --log {h, "aSubAudio : ", aSubAudio}
- set {h, aAudioTag} to getByte(someOffset + 44, unsigned)
- --log {h, "aAudioTag : ", aAudioTag}
- set {h, aVideoFormat} to getByte(someOffset + 45, unsigned)
- set aVideoFormat to item (aVideoFormat + 1) of {"SD", "HD-MPEG2", "HD-MPEG4", "SD-MPEG4"}
- --log {h, "aVideoFormat : ", aVideoFormat}
- if not isRadio then
- set {h, aPID_PCR} to getInt16(someOffset + 46, unsigned)
- set {h, aPID_Audio} to getInt16(someOffset + 48, unsigned)
- set {h, aPID_TTX} to getInt16(someOffset + 50, unsigned)
- set {h, aPID_Video} to getInt16(someOffset + 52, unsigned)
- set pIDs to {aPID_Audio, aPID_Video, aPID_PCR, aPID_TTX}
- else
- set pIDs to {aPID_PCR, aPID_Audio}
- end if
- --log {h, "pIDs : ", pIDs}
- set {h, aAudioFormat} to getByte(someOffset + blkSize + 18, unsigned) -- ACHTUNG, der liegt meilenweit weg vom Rest!
- --log {h, "aAudioFormat : ", aAudioFormat}
- set aAudioFormat to item (aAudioFormat + 1) of {"MPEG", "AC3", "EnhAC3", "AAC", "HE-AAC"}
- --log {h, "aAudioFormat : ", aAudioFormat}
- return {aServiceID, aIsCryped, aCaNr, aVideoDecoder, aSubAudio, aAudioTag, aVideoFormat, aAudioFormat, aCaSystemPIDs, pIDs}
- end getDVB
- (* KnotenAllgm *)
- on getKnotenAllgm(someOffset, isRadio)
- set aNetzwerkTyp to "---"
- set aTransportStreamID to 0
- set aOriginalNetworkID to 0
- set aFreq to 0
- set aSymbolrate to 0
- -- aNetzwerkTyp {}
- set {h, aNetzwerkTyp} to getByte(someOffset, unsigned)
- set aNetzwerkTyp to item (aNetzwerkTyp + 1) of {"unbekannt", "DVB-C", "DVB-S", "DVB-T", "DVB-C2", "DVB-S2", "DVB-T2", "Analog"}
- --log {h, "aNetzwerkTyp : ", aNetzwerkTyp}
- -- aTransportStreamID {}
- set {h, aTransportStreamID} to getInt16(someOffset + 1, unsigned)
- --log {h, "aTransportStreamID : ", aTransportStreamID}
- -- aOriginalNetworkID {}
- set {h, aOriginalNetworkID} to getInt16(someOffset + 3, unsigned) -- Bereich?
- --log {h, "aOriginalNetworkID : ", aOriginalNetworkID}
- -- aSymbolrate {}
- set {h, aSymbolrate} to getInt16(someOffset + 5, unsigned)
- --log {h, "aSymbolrate : ", aSymbolrate}
- -- aFreq {}
- set {h, aFreq} to getInt32(someOffset + 7, unsigned)
- log {h, "aFreq : ", aFreq}
- return {aNetzwerkTyp, aTransportStreamID, aOriginalNetworkID, aFreq, aSymbolrate}
- end getKnotenAllgm
- (* Terrestische Programmplatzdaten (ANALOG)*)
- on getTerrestrisch(someOffset)
- set aFreq to 0
- set aVCR to 0
- set aZMono to false
- set aFarbnorm to 0
- set aTVStd to 0
- -- Freq.
- set {h, aFreq} to getFreq(someOffset) -- ??? Real wie 479,25 2 Byte
- log {"aCNI : ", aFreq}
- -- VCR (aus / Opt.1 / Opt.2)
- set {h, aVCR} to getByte(someOffset + 2, unsigned)
- set aVCR to item (aVCR + 1) of {"aus", "Opt.1", "Opt.2"}
- --log {"aVCR : ", aVCR}
- -- Zwangsmono (ein / aus)
- set {h, aZMono} to getByte(someOffset + 3, unsigned) -- 5 = on; 6 = off
- set aZMono to item (aZMono - 4) of {true, false}
- --log {"aZMono : ", aZMono}
- -- Farbnorm (Automatik / PAL / SECAM / NTSC / NTSC44 / PAL60 / PAL M / PAL N)
- set {h, aFarbnorm} to getByte(someOffset + 4, unsigned)
- set aFarbnorm to item (aFarbnorm + 1) of {"Automatik", "PAL", "SECAM", "NTSC", "NTSC44", "PAL60", "PAL M", "PAL N"}
- --log {"aFarbnorm : ", aFarbnorm}
- -- TV-Standard (B/G, D/K, I, L, M/N)
- set {h, aTVStd} to getByte(someOffset + 5, unsigned)
- set aTVStd to item (aTVStd + 1) of {"B/G", "D/K", "I", "L", "M/N"}
- --log {"aTVStd : ", aTVStd}
- return {aFreq, aVCR, aZMono, aFarbnorm, aTVStd}
- end getTerrestrisch
- (* Knoten DVB-S *)
- on getDVB_S(someOffset)
- set aPolarisation to "hor"
- set aSatellit to "---"
- set aDVB_System to "---"
- set aRollOff to "---"
- set aFEC to "---"
- -- Polarisation {}
- set {h, b} to getBool(someOffset, unsigned)
- if b then set aPolarisation to "vert"
- --log {h, "aPolarisation : ", aPolarisation}
- -- Satellit {}
- set {h, aSatellit} to getByte(someOffset + 1, unsigned)
- set aSatellit to item (aSatellit + 1) of {"A", "B", "C", "D"}
- --log {h, "aSatellit : ", aSatellit}
- -- RollOff {}
- set {h, aRollOff} to getByte(someOffset + 4, unsigned) --???
- set aRollOff to item (aRollOff + 1) of {"0.35", "0.25", "0.20"}
- --log {h, "aRollOff : ", aRollOff}
- -- Modulations-Typ {}
- set {h, aModTyp} to getByte(someOffset + 8, unsigned)
- set aModTyp to item (aModTyp + 1) of {"auto", "QPSK", "8PSK", "16QAM"}
- --log {h, "aModTyp : ", aModTyp}
- -- DVB_System {}
- set {h, aDVB_System} to getByte(someOffset + 9, unsigned)
- set aDVB_System to item (aDVB_System + 1) of {"DVB-S", "DVB-S2"}
- --log {h, "aDVB_System : ", aDVB_System}
- -- FEC {}
- set {h, aFEC} to getByte(someOffset + 11, unsigned)
- set aFEC to item (aFEC + 1) of {"undef", "1/2", "2/3", "3/4", "5/6", "7/8", "8/9", "3/5", "4/5", "9/10"}
- --log {h, "aFEC : ", aFEC}
- return {aPolarisation, aSatellit, aDVB_System, aModTyp, aRollOff, aFEC}
- end getDVB_S
- (* Knoten DVB-T *)
- on getDVB_T(someOffset)
- set aConstellation to "---"
- set aCodeRateHP to "---"
- set aTransMode to "---"
- set aGuardIntervall to "---"
- -- Constellation {}
- set {h, aConstellation} to getByte(someOffset + 3, unsigned)
- --log {h, aConstellation}
- set aConstellation to item (aConstellation + 1) of {"QPSK", "16QAM", "64QAM"}
- --log {h, "aConstellation : ", aConstellation}
- -- Code-Rate-HP {}
- set {h, aCodeRateHP} to getByte(someOffset + 4, unsigned)
- set aCodeRateHP to item (aCodeRateHP + 1) of {"1/2", "2/3", "3/4", "5/6", "7/8"}
- --log {h, "aCodeRateHP : ", aCodeRateHP}
- -- aTransmission-Mode {}
- set {h, aTransMode} to getByte(someOffset + 5, unsigned)
- set aTransMode to item (aTransMode + 1) of {"2k", "4k", "8k"}
- --log {h, "aTransMode : ", aTransMode}
- -- aGuardIntervall {}
- set {h, aGuardIntervall} to getByte(someOffset + 6, unsigned)
- set aGuardIntervall to item (aGuardIntervall + 1) of {"1/32", "1/16", "1/8", "1/4"}
- --log {h, "aGuardIntervall : ", aGuardIntervall}
- return {aConstellation, aCodeRateHP, aTransMode, aGuardIntervall}
- end getDVB_T
- (* Knoten DVB-C *)
- on getDVB_C(someOffset)
- set aModulation to "---"
- -- Modulation {}
- set {h, aModulation} to getByte(someOffset + 2, unsigned)
- --log {h, "aModulation : ", aModulation}
- set aModulation to item (aModulation + 1) of {"AutoQAUM", "16QAM", "32QAM", "64QAM", "128QAM", "256QAM", "QPSK"}
- log {h, "aModulation : ", aModulation}
- -- in +6 steht auch noch was drin!
- return {aModulation}
- end getDVB_C
- (* ====================================================== *)
- (* ====================================================== *)
- (* ==== File auswählen ==== *)
- (* ================== *)
- set thefile to choose file of type {"mst40"}
- set filecontent to read thefile as data
- close thefile
- -- fileData in Text wandeln
- set rawData to item 2 of data_to_string(filecontent)
- log (" ---------------------------")
- set myOff to 1
- set {h, sData} to getN_Bytes(myOff, 2)
- log {tab & tab, myOff, 2, tab & tab & sData}
- set myOff to h
- set {h, sData} to getN_Bytes(myOff, 2)
- log {tab & tab, myOff, 2, tab & tab & sData}
- log (" ---------------------------")
- (* ==== auf richtige Dateiversion testen ==== *)
- (* =========================== *)
- if text 1 thru 4 of rawData ≠ "0004" then
- display dialog "Sorry, unbekanntes Dateiformat. Es wird nur das 4er mit der Dateiendung '.mst40' unterstützt"
- -- und raus bist du
- return -128
- end if
- set myOff to 3
- -- jetzt die Anzahl der TV-Kanäle bestimmen
- -- TV Sender (kommen wohl immer zuerst)
- set {myOff, tvCount} to (getInt16(myOff, signed))
- set blockSize to 4
- set {h, sData} to (getN_Bytes(myOff, blockSize)) -- unbekannt, 67 Bytes überspringen
- log {tab & tab, myOff, blockSize, tab & sData}
- set myOff to h
- set tvList to {}
- repeat with i from 1 to tvCount
- log {"Nr.: " & i & " ", myOff, blockSize, tab & sData}
- set myOff to h
- set {h, aProgTyp} to getByte(myOff, unsigned)
- if aProgTyp = 0 then
- -- undefined, wieviel überspringen bis zum nächsten?
- set blockSize to 99
- set {h, sData} to (getN_Bytes(myOff, blockSize))
- log {tab & tab, myOff, blockSize, tab & sData}
- set myOff to h
- set tvList to tvList & {{"Nr.: " & i, "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---"}}
- end if
- if {1, 3, 4, 5, 8, 9, 10} contains aProgTyp then
- -- allgm lesen
- set {h, aLen} to getByte(myOff + 1, unsigned)
- set channelName to getText(h, aLen)
- --log {myOff + 1 + h, aLen, aName}
- set h2 to 1 + (aLen + 1)
- set blockSize to h2 + 5 + 2 -- Füllbytes "von unten"
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log {tab & tab, myOff, blockSize, tab & sData, tab & channelName}
- set {charCodeTable, decoder, klang, lautKorr, inEPG} to getAllgemein(myOff + h2, blockSize - aLen - 2)
- log {"Nr.: " & i, channelName, charCodeTable, decoder, klang, lautKorr, inEPG}
- set myOff to myOff + blockSize
- --if progType = 2 then break
- if {1, 3, 4, 5} contains aProgTyp then
- (* werden derzeit bei 1. Block mitgelesen
- set blockSize to 2
- set {h, sData} to (getN_Bytes(myOff, blockSize)) -- unbekannt, 2 Bytes überspringen
- log {tab & tab, myOff, blockSize, tab & sData}
- set myOff to h
- *)
- -- Block TV lesen
- set blockSize to 11
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log {tab & tab, myOff, blockSize, tab & sData}
- set {cni, farbKorr, kontkorr, bildKorr, rauschRed, cti, kammfilter, farbversatz, bildformat, videoprofil} to getTV(myOff)
- log {"0x" & cni, farbKorr, kontkorr, bildKorr, rauschRed, cti, kammfilter, farbversatz, bildformat, videoprofil}
- log
- set myOff to h
- end if
- if aProgTyp = 1 then
- -- Terrestrisch (Analog)
- set blockSize to 12
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log {tab & tab, myOff, blockSize, tab & sData}
- set {freq, vcr, zMono, farbnorm, tvStd} to getTerrestrisch(myOff)
- log {freq, vcr, zMono, farbnorm, tvStd}
- set tvList to tvList & {{"Nr.: " & i, channelName, inEPG, "0x" & cni, freq, "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---", "---"}}
- set myOff to h
- set blockSize to 67
- set {h, sData} to (getN_Bytes(myOff, blockSize)) -- unbekannt, 67 Bytes überspringen
- log {tab & tab, myOff, blockSize, tab & sData}
- set myOff to h
- end if
- if {3, 4, 5} contains aProgTyp then
- -- Block DVB lesen
- set blockSize to 54
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log {tab & tab, myOff, blockSize, tab & sData}
- set {serviceID, isCryped, caNr, videoDecoder, subAudio, audioTag, videoFormat, audioFormat, caSystemPIDs, pIDs} to getDVB(myOff, blockSize, false) -- false = TV, true = Radio
- log {serviceID, isCryped, caNr, videoDecoder, subAudio, audioTag, videoFormat, audioFormat, caSystemPIDs, pIDs}
- log
- set myOff to h
- -- Block Knoten allgm. lesen
- set blockSize to 11
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log {tab & tab, myOff, blockSize, tab & sData}
- set {netzwerkTyp, transportStreamID, originalNetworkID, freq, symbolrate} to getKnotenAllgm(myOff, false) -- false = TV, true = Radio
- log {netzwerkTyp, transportStreamID, originalNetworkID, freq, symbolrate}
- log
- set myOff to h
- if aProgTyp = 3 then
- -- Block DVB-S lesen
- set blockSize to 14
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log {tab & tab, myOff, blockSize, tab & sData}
- set {polarisation, satellit, dvbSystem, modTyp, rollOff, fec} to getDVB_S(myOff)
- log {polarisation, satellit, dvbSystem, modTyp, rollOff, fec}
- set tvList to tvList & {{"Nr.: " & i, channelName, inEPG, "0x" & cni, freq, isCryped, pIDs, netzwerkTyp, serviceID, transportStreamID, originalNetworkID, symbolrate, Modulation, polarisation, "---", "---", "---", videoFormat, audioFormat}}
- log
- set myOff to h
- end if
- if aProgTyp = 4 then
- -- Block DVB-T lesen
- set blockSize to 7 + 7
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log {tab & tab, myOff, blockSize, tab & sData}
- set {constellation, codeRateHP, transMode, guardIntervall} to getDVB_T(myOff)
- log {constellation, codeRateHP, transMode, guardIntervall}
- log
- set tvList to tvList & {{"Nr.: " & i, channelName, inEPG, "0x" & cni, freq, isCryped, pIDs, netzwerkTyp, serviceID, transportStreamID, originalNetworkID, symbolrate, Modulation, "---", codeRateHP, transMode, guardIntervall, videoFormat, audioFormat}}
- set myOff to myOff + h
- end if
- if aProgTyp = 5 then
- -- Block DVB-C lesen
- set blockSize to 14 -- mit viel Luft!!!
- set {h, sData} to getN_Bytes(myOff, blockSize)
- log
- log {tab & tab, myOff, blockSize, tab & sData}
- set Modulation to getDVB_C(myOff)
- log (Modulation)
- log
- set tvList to tvList & {{"Nr.: " & i, channelName, inEPG, "0x" & cni, freq, isCryped, pIDs, netzwerkTyp, serviceID, transportStreamID, originalNetworkID, symbolrate, Modulation, "---", "---", "---", "---", videoFormat, audioFormat}}
- set myOff to h
- end if
- end if
- end if
- --return
- log ("------------------------------------------------------------------------------------------------------------")
- end repeat
- (* ====================================================== *)
- doShowTvList(tvList, true)
Advertisement
Add Comment
Please, Sign In to add comment