[Redbutton-devel] SF.net SVN: redbutton: [303] redbutton-download/trunk/channels.c
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-05-01 10:15:33
|
Revision: 303
http://svn.sourceforge.net/redbutton/?rev=303&view=rev
Author: skilvington
Date: 2007-05-01 03:15:32 -0700 (Tue, 01 May 2007)
Log Message:
-----------
allow ATSC cards to retune (untested)
Modified Paths:
--------------
redbutton-download/trunk/channels.c
Modified: redbutton-download/trunk/channels.c
===================================================================
--- redbutton-download/trunk/channels.c 2007-05-01 10:06:37 UTC (rev 302)
+++ redbutton-download/trunk/channels.c 2007-05-01 10:15:32 UTC (rev 303)
@@ -412,11 +412,40 @@
return false;
}
+/*
+ * ATSC channels.conf format is:
+ * name:frequency:modulation:vpid:apid:service_id
+ * eg:
+ * Jazz-TV:647000000:QAM_256:49:52:3
+ */
+
static bool
get_atsc_tune_params(uint16_t service_id, struct dvb_frontend_parameters *out)
{
-printf("TODO: tune ATSC card to service_id %u\n", service_id);
-return false;
+ char line[1024];
+ unsigned int freq;
+ char mod[32];
+ unsigned int id;
+ int len;
+
+ while(!feof(_channels))
+ {
+ if(fgets(line, sizeof(line), _channels) == NULL
+ || sscanf(line, "%*[^:]:%u:%32[^:]:%*[^:]:%*[^:]:%u", &freq, mod, &id) != 3
+ || id != service_id)
+ continue;
+ /* chop off trailing \n */
+ len = strlen(line) - 1;
+ while(len >= 0 && line[len] == '\n')
+ line[len--] = '\0';
+ verbose("%s", line);
+ out->frequency = freq;
+ /* out->inversion is not set by azap */
+ out->u.vsb.modulation = str2enum(mod, qam_list, LIST_SIZE(qam_list));
+ return true;
+ }
+
+ return false;
}
/* DISEQC code from dvbtune, written by Dave Chapman */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|