Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: channels.conf syntax?



On Mon, 17 Nov 2003, Chris Samuel wrote:

> > Anyway, the main problem is that there are too many different formats.
> > It would be nice to agree on a standard format and have a simple library
> > to support it. I would like to know how other DVB software authors think
> > about that.
> 
> I'm not an author, just a user, but I'd strongly suggest considering
> using XML as a format. It's vaguely readable by humans, well supported
> and extensible.

FWIW I used XML for the equivalent of channels.conf in iTele on the Mac. 
It was the obvious thing to do since everything like this is in XML on OS 
X, and Apple has nice libraries for reading and writing it.

As Jamie said, it's very hierarchial, so I put information at the highest
level it can go. But when I read it out, I don't care what level it's at,
I just start at the deepest one and work my way up until I find the
parameter I'm looking for. In that way you can put common settings up high
but still override them at a lower level for certain cases if you need to.

Also I separated out the static regional tuning parameters from the
user/station settings. The station settings are stored as preferences
using Apple's APIs for Preferences (also ends up as XML). These tend to
change quite frequently (esp in Australia) so it makes no sense to try to
distribute a file to keep up with them - rather they are updated each time
the user tunes to a program on that frequnecy.

The user prefs are generated for the first time (and later if the user
chooses to look for new 'channels') by scanning all the entries defined in
the static file. Since the prefs are auto-generated in this way, there is
no advantage to maintaining the hierarchy from the static file and so it
is flattened into a list of 'hardware' settings. The program IDs and names
are stored as an array within the entry for its frequency.  Similarly, the
stream element info is stored as an array within its program entry.

In Mac OS X, the kernel actually has utilities (yes, in C++!) for doing
stuff with XML, and it is easy to pass an block of XML to a driver in a
system call. So as far as extracting data from XML to send to drivers,
that is actually left to the drivers themselves to look for parameters
they are interested in.

This has a number of advantages. Firstly, the userspace software doesn't
have to know about or understand all the parameters that the drivers need,
all it has to do is pass them a block of XML. You can add parameters that
special drivers need, or switch between terrestrial/satellite/cable
settings without the userspace software knowing how to fill in all those
structures. Also, the absence of a parameter can be interpreted as 'do
your best', very much like XXX_AUTO in linux-dvb.

The contents of the static file are derived from the legal broadcasting
requirements for each region (I haven't got to satellites yet, maybe this
wouldn't work for them), so that it is reasonably static. So for Australia
there's a list of channels that can have digital broadcasts on them, i.e.
7MHz spacing of VHF 6-12, followed by UHF 28-68 (or whatever it is).
Common parameters like '<BandwidthMHz> 7' go into the top level of the XML
file, and parameters specific to a channel like '<FrequencyHz> 177500000'
go into the XML node for each channel.

The one parameter that iTele does know about is frequency, and if present
it can also scan around a centre frequency, so at the top level of the
static XML file is:
<ScanRange> 150000 </ScanRange>
<ScanStep>  150000 </ScanStep>
Which means to scan the range +/- 150kHz around each frequency (unless
overridden by a specific channel definition) in steps of 150kHZ. i.e. for
VHF channel 6 it tries 177350000, 177500000 and 177650000 when attempting
to tune it. If it finds one with signal it stops looking on that channel
(and that is the one that ends up being written into the prefs).

> Just my 2p worth.
> 
> Chris

I hope that was useful.

If you're interested the current version of the list is found at
iTele.app/Resources/tunerLocationParams.plist inside the latest iTele
package from www.defyne.org/dvb/. You may need a Mac to mount the disk
image ... sorry about that, in the middle of setting up a live CVS
repository right now. Also in the next version I'm going to make it update
the file from the web (one call in Mac OS X ...
NSDictionary * myDict = [NSDictionary dictionaryWithContentsOfURL:[NSURL 
    URLWithString:@"http://www.defyne.org/dvb/locationTunerParams.plist";]] 
... weird Objective-C but hey :)


{P^/

btw XML is just illustrative. Apple uses a format along the lines of:
<dict>
  <key> BandwidthMHz </key>
  <number> 7 </number>
...
</dict>



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index