Click here to go to the forum index Click here for the home page
 
Author Message

<  TAP and patch development  ~  SvcID from Rec Header

Page 1 of 1
BobD
Posted: Sun Mar 06, 2011 11:04 am Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4189 Location: Nottingham
Anyone have any toppy-model independent code for finding the svcId from a .rec file header (or from a TYPE_File * pointer to the file)? I have looked in the FireBird library and have just got confused!

I am trying to find a better way of handling line up/LCN/Channel name changes in MyStuff, which currently relies on svcNums and Channel Names as stored in MEI files and .rec headers. Switching to storing svcIDs in the saved MEI files and then matching these up with the svcIDs already saved (I think) in the .rec header would be more reliable.

Cheers

_________________
FW: ChunkyWizard Recommended
TAPs:
MyStuff (always one version ahead of everyone else!), and recommended support TAPS
MyStuff skins, manual and latest version: http://www.BobDsMyStuff.co.uk
Known bugs & forthcoming fixes: http://www.BobDsMyStuff.co.uk/Bugs.shtml
Changes coming in the next version: http://www.BobDsMyStuff.co.uk/NextVersion.shtml
View user's profile Send private message Visit poster's website
Black Cloud
Posted: Sun Mar 06, 2011 2:51 pm Reply with quote
Frequent contributor Joined: 18 Sep 2005 Posts: 297 Location: Brentwood Transmitter: Crystal Palace
Of the two file types I know of (5000 and 5800), the ServiceID is always the same distance into the header. It is a word at 0x12 from the start of the file.

This info is from the Toppy Internal Information document. Sorry, lost the link as I have it stored locally.

Hope that helps.

_________________
HW: TF5800 Black Panther 1.5TB. FW: 5.13.65 Patched
SW: TAP Commander 1.32, Goldfish 0.5, Font Manager 1.0d, SecCache v0.4, EIT Sub v0.6, EPG2MEI v0.96, Extend v1.7, TF5000 Display v1.53, MyStuff 6.4, MHEG On/Off A3, WSSkiller V2.12d
View user's profile Send private message
mstombs
Posted: Sun Mar 06, 2011 2:53 pm Reply with quote
Frequent contributor Joined: 31 Dec 2006 Posts: 671
I have some php code from various sources that reads a rec header and outputs for example:-

Code:
00000000h : 5446 7263 5010 0000 001d 0019 0000 0000  ; TFrcP...........
00000010h : 11b0 5740 02c1 01f5 01f5 01f6 4534 2b31  ; ..W@........E4+1
00000020h : 004e 4500 0000 0000 0000 0000 0000 0000  ; .NE.............
00000030h : 0000 0000 0000 0000 0030 0800 000a 8750  ; .........0.....P
00000040h : 5000 0000 233a 3008 8000 001e 0000 c71d  ; P...#.0.........
00000050h : d8e2 1600 d8e2 161e 0406 0053 6372 7562  ; ...........Scrub
00000060h : 7342 7261 6e64 206e 6577 2073 6572 6965  ; sBrand new serie
00000070h : 7320 2d20 4f75 7220 526f 6c65 204d 6f64  ; s - Our Role Mod
00000080h : 656c 733a 204a 4420 616e 6420 4472 6577  ; els. JD and Drew
00000090h : 206c 6561 726e 2061 2074 6f75 6768 206c  ;  learn a tough l
000000A0h : 6573 736f 6e20 696e 206d 656e 746f 7269  ; esson in mentori
000000B0h : 6e67 2077 6865 6e20 4472 2043 6f78 2061  ; ng when Dr Cox a
000000C0h : 6e64 204c 7563 7920 7368 6f77 2074 6865  ; nd Lucy show the
000000D0h : 6d20 7468 6174 2c20 736f 6d65 7469 6d65  ; m that, sometime
000000E0h : 732c 2074 6865 2073 7475 6465 6e74 2063  ; s, the student c
000000F0h : 616e 2062 6520 7468 6520 7465 6163 6865  ; an be the teache
00000100h : 722e 2020 5b53 5d00 6e64 2070 726f 6c6f  ; r.  [S].nd prolo
00000110h : 6e67 6564 2076 6900 0000 0043 3331 002f  ; nged vi....C31..
00000120h : 4631 3948 5000 0000 0000 0000 0000 0000  ; F19HP...........
00000130h : 0000 0040 0000 0000 0000 0143 4954 5620  ; ...@.......CITV
00000140h : 7265 7475 726e 7320 6174 2030 363a 3030  ; returns at 06.00
00000150h : 4349 5456 2072 6574 7572 6e73 5740 0000  ; CITV returnsW@..
00000160h : 0000 0000 0000 0000 0000 0000 0000 0000  ; ................
------ tRECHeader(14) ------
Id=TFrc
Version=5010
Duration=29
ServiceNR=25
ServiceType=0

------ tRECServiceInfo5010(42) -----
TunerInfo=0
TunerInfo=00
ServiceID=5740
ServiceID=22336
PMTPID=705
PCRPID=501
VideoPID=501
AudioPID=502
ServiceName=E4+1

------ tRECTPInfo -----
ChannelNumber=48
Bandwidth=8
Frequency=690000
TSID=20480
LPHPStream=0
NetworkID=9018

------ tRECEventInfo(294) -----
DurationHour=0
DurationMin=30
EventID=50973
StartTimeMJD=55522
StartTimeHour=22
StartTimeMin=0
EndTimeMJD=55522
EndTimeHour=22
EndTimeMin=30
TextLength=6
ParentalRate=0
EventName=Scrubs
EventDescription=Brand new series - Our Role Models: JD and Drew learn a tough lesson in mentoring when Dr Cox and Lucy show them that, sometimes, the student can be the teacher.  [S]

------ tRECExtendedEventInfo(1030) -----
TextLength=0
EventID=0
ExtendedText=

------ Event summary -----
ServiceName=E4+1

StartDate=10:00pm Mon, 22 Nov 2010
EndDate=10:30pm Mon, 22 Nov 2010
EventDuration=30 minutes
EventName=Scrubs
EventDescription=Brand new series - Our Role Models: JD and Drew learn a tough lesson in mentoring when Dr Cox and Lucy show them that, sometimes, the student can be the teacher.  [S]
ExtendedText=

RecordingDuration=29 minutes

ChannelName=E4+1
durn_hours=0
durn_mins=30
title=Scrubs
description=Brand new series - Our Role Models: JD and Drew learn a tough lesson in mentoring when Dr Cox and Lucy show them that, sometimes, the student can be the teacher.  [S]
extended_desc=


relevant bit of code I think is



Code:
 $p = 0 ;
 $size = 14 ;
 $tRECHeader = substr($header,$p,$size) ;
 $p += $size ;
 echo "\n------ tRECHeader($size) ------\n" ;
 echo "Id=".substr($tRECHeader,0,4)."\n" ;
 $version=bin2hex(substr($tRECHeader,4,2)) ;
 echo "Version=$version\n" ;

 $RecordingDuration=value("n",substr($tRECHeader,8,2)) ;
 echo "Duration=$RecordingDuration\n" ;
 echo "ServiceNR=".value("n",substr($tRECHeader,10,2))."\n" ;
 echo "ServiceType=".value("n",substr($tRECHeader,12,2))."\n" ;
 $size=42;
 $tRECServiceInfo = substr($header,$p,$size) ;
 $p += $size ;
 echo "\n------ tRECServiceInfo$version($size) -----\n" ;
 echo "TunerInfo=".ord(substr($tRECServiceInfo,0,1))."\n" ;
 echo "TunerInfo=".bin2hex(substr($tRECServiceInfo,0,1))."\n" ;
 echo "ServiceID=".bin2hex(substr($tRECServiceInfo,4,2))."\n" ;
 echo "ServiceID=".value("n",substr($tRECServiceInfo,4,2))."\n" ;


Note 2 different ways of expressing ServiceID, looks like Endianism alternates. But appears to be very similar to the definitions in

http://forum.toppy.org.uk/forum/viewtopic.php?t=381

so the c-code in rec2ts may be good for you?

http://www.toppy.org.uk/~offdigital/rec2ts_v0.02.zip
View user's profile Send private message
iron
Posted: Sun Mar 06, 2011 3:00 pm Reply with quote
Regular contributor Joined: 03 Jun 2005 Posts: 91 Location: Tunbridge Wells, UK
Bob,
My interpretation of the docs is that the service id is in the toppy model independent section of the rec header, www.topfield.cc/files/Firebird/TF_Internal_Info.pdf . It should be ok to use a hard coded offset of 0x12 to get the value from a rec file.

Alan.

_________________
Model: TF5800PVR - Silver Firmware: Recommended_5800; TAPS: UK Timer 1.2, USB Accelerator 1.0, eit_sub, seccacheUK; cables: 10m TF to PC only, 2 metres both ways!
View user's profile Send private message
R2-D2
Posted: Sun Mar 06, 2011 4:30 pm Reply with quote
Frequent contributor Joined: 18 Dec 2006 Posts: 12149
BobD wrote:
Switching to storing svcIDs in the saved MEI files and then matching these up with the svcIDs already saved (I think) in the .rec header would be more reliable.

Not sure how static those are meant to be. I think it's quite possible for the Service ID to vary (for the same channel) between regions, and so between different transmitters in the same area. After a rejig and, say, a move to a different mux it's also possible that a channel will get a different ID. I don't think they will change other than that though (unlike the channel name!).

_________________
Troubleshooting -- User Manual -- Dark Side of the Matrix: Firmwares and Patches
View user's profile Send private message Visit poster's website
BobD
Posted: Sun Mar 06, 2011 4:55 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4189 Location: Nottingham
Thanks all for the very useful replies. EMJB has said that in his experience so far the svcIDs have been more reliable in line up changes than either channel name or svcNum.

So it seems to me that the best way of handling this is probably to match recordings to saved mei information on channel name (as currently), and then if that fails, see if there is a match based on saved svcID. If there is, then that svcID can perhaps be used to work out the new channel.

This may well result in cases where a recording gets assigned to the wrong new channel name (and logo), but it should keep all the extra RT info and merge info correctly.

Of course, one additional method may be to keep the old (and no longer available) channel name for the recording, and use the old logo if it still exists in the logo files. However, that would take a bit more work, and would perhaps involving loading all logos from the logo file, rather than just those that correspond to channels on the toppy at the time of loading.

I think this is an interim solution anyway, in that the idea is just to preserve the MS info (merges, RT data etc) for long enough for the user to view recordings made pre channel changes, and then delete them. So once they have all been viewed and deleted the problem goes away until the next line up change.

There may also be some issues with MEIs matching Searches (which is part of the mechanism that MS uses to do Series Links etc), but I don't think that using svcIDs will cause any more problems than any other method in this regard.

Also, since each toppy will be recording everything off the same set of transmitters (rather than moving around the country, except occasionally when the user moves) it should again not cause too many problems if the same svcID is used on different transmitters would it?

Since this method will only be used in cases where the channel name has changed I think it will be safe. Probably. Smile

_________________
FW: ChunkyWizard Recommended
TAPs:
MyStuff (always one version ahead of everyone else!), and recommended support TAPS
MyStuff skins, manual and latest version: http://www.BobDsMyStuff.co.uk
Known bugs & forthcoming fixes: http://www.BobDsMyStuff.co.uk/Bugs.shtml
Changes coming in the next version: http://www.BobDsMyStuff.co.uk/NextVersion.shtml
View user's profile Send private message Visit poster's website
Geoff Bacon
Posted: Sun Mar 06, 2011 5:05 pm Reply with quote
Frequent contributor Joined: 11 Jan 2007 Posts: 2980 Location: Bristol ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ Windows XP, USB
Quote:
I think this is an interim solution anyway, in that the idea is just to preserve the MS info (merges, RT data etc) for long enough for the user to view recordings made pre channel changes, and then delete them. So once they have all been viewed and deleted the problem goes away until the next line up change.


While this covers most recordings, you can't rely on it as the user may keep something longterm e.g. films



Would it be possible to use a single logo for any orphan channels?

Geoff

_________________
TopManager program
TF5800, IA On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzHsPfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; QuickJump 1.72; MyInfo B5.6; Font Manager 1.0d; EPG2MEI v0.96; CrashTrace v0.4; EIT Sub (Game) v0.6; Extend v1.7; WSSkiller V2.12d; SecCache (UK) v0.4; MyStuff 6.5;
Sig generated by MyInfo on 6/9/13
™
View user's profile Send private message Visit poster's website
R2-D2
Posted: Sun Mar 06, 2011 6:02 pm Reply with quote
Frequent contributor Joined: 18 Dec 2006 Posts: 12149
BobD wrote:
EMJB has said that in his experience so far the svcIDs have been more reliable in line up changes than either channel name or svcNum.

That's interesting. I wonder if the variations are restricted to a certain range? And so perhaps we might be able to construct a list (for UK Freeview) as a fallback? We'd need to collect data from around the country, although maybe EMJB already has some.

_________________
Troubleshooting -- User Manual -- Dark Side of the Matrix: Firmwares and Patches
View user's profile Send private message Visit poster's website
HydeTheDarkerSide
Posted: Sun Mar 06, 2011 6:13 pm Reply with quote
Site Admin Joined: 11 May 2005 Posts: 5952 Location: Hannington Transmitter : Sony KDL 40Z5800
BobD wrote:
...Also, since each toppy will be recording everything off the same set of transmitters (rather than moving around the country, except occasionally when the user moves) it should again not cause too many problems if the same svcID is used on different transmitters would it?

Since this method will only be used in cases where the channel name has changed I think it will be safe. Probably. Smile
Excepting that some of us are sad enough to take our toppy on holiday Shocked Okay would need a channel name change too, but our toppy does get moved around the country. Rural Retreats think it odd when we not only ask for a real fire but that the property we wish to rent receives Freeview too Razz

_________________
Hyde.
2x TF5800 All controlled with Harmony Ultimate , TS On, F/W: MS6 Recommended F/W 12/9/2009 -RSy+BmC0CbCfCtDsEgEmEvFsGIMPePsR0ScUUuWfXZ
TAPs: PcControl B1.3; EPG2MEI v0.96; Font Manager 1.0d; Extend v1.7; SecCache (UK) v0.4; EIT Sub (Game) v0.6; MyInfo B5.6; MyStuff 6.5 RC2;
MyStuff Links: http://www.toppy.org.uk/~mystuff/index.shtml
Sig generated by MyInfo on 11/10/13
View user's profile Send private message Visit poster's website
EMJB
Posted: Sun Mar 06, 2011 6:55 pm Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3463 Location: Maldon Essex
R2-D2 wrote:
I think it's quite possible for the Service ID to vary (for the same channel) between regions, and so between different transmitters in the same area.
Am 99% sure that it does vary between regions for regionalised channels (BBC1/2 & ITV1), but not for others.

EMJB
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum