Skip to contentSkip to conversation

cec-follower: create analog channel frequencies

PATCH New c0d1n61at3 at gmail.com (Jiunn Chang) 3 participants 6 messages Sep 16, 2019 – Sep 19, 2019 Media (V4L/DVB)

lore
Share & tools
lore

c0d1n61at3 at gmail.com (Jiunn Chang)

#0 lore raw

PATCH 1/1 cec-follower: create analog channel frequencies

This frequency table will allow proper testing of tuner control. There are three frequencies per analog broadcast type and broadcast system, so tuner increment and decrement can be tested.

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>
---
 utils/cec-follower/cec-tuner.cpp | 77 ++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
utils/cec-follower/cec-tuner.cpp +77 -0
index 5e794d71..e0d58e6c 100644
@@ -7,6 +7,83 @@
 
 #include "cec-follower.h"
 
+/*
+ * This table contains analog television channel frequencies in KHz.  There are
+ * a total of three frequencies per analog broadcast type and broadcast system.
+ *
+ * CEC 17 and CEC Table 31 of the 1.4 specification lists the available analog
+ * broadcast types and broadcast systems.
+ *
+ * The table is indexed by [ana_bcast_type][bcast_system][i].
+ *
+ */
+static unsigned int analog_freqs_khz[3][9][3] =
+{
+	// cable
+	{
+		// pal-bg
+		{471250, 479250, 487250},
+		// secam-lq
+		{615250, 623250, 631250},
+		// pal-m
+		{501250, 507250, 513250},
+		// ntsc-m
+		{519250, 525250, 531250},
+		// pal-i
+		{45750, 53750, 61750},
+		// secam-dk
+		{759250, 767250, 775250},
+		// secam-bg
+		{495250, 503250, 511250},
+		// secam-l
+		{639250, 647250, 655250},
+		// pal-dk
+		{783250, 791250, 799250}
+	},
+	// satellite
+	{
+		// pal-bg
+		{519250, 527250, 535250},
+		// secam-lq
+		{663250, 671250, 679250},
+		// pal-m
+		{537250, 543250, 549250},
+		// ntsc-m
+		{555250, 561250, 567250},
+		// pal-i
+		{175250, 183250, 191250},
+		// secam-dk
+		{807250, 815250, 823250},
+		// secam-bg
+		{543250, 551250, 559250},
+		// secam-l
+		{687250, 695250, 703250},
+		// pal-dk
+		{831250, 839250, 847250}
+	},
+	// terrestrial
+	{
+		// pal-bg
+		{567250, 575250, 583250},
+		// secam-lq
+		{711250, 719250, 727250},
+		// pal-m
+		{573250, 579250, 585250},
+		// ntsc-m
+		{591250, 597250, 603250},
+		// pal-i
+		{199250, 207250, 215250},
+		// secam-dk
+		{145250, 153250, 161250},
+		// secam-bg
+		{591250, 599250, 607250},
+		// secam-l
+		{735250, 743250, 751250},
+		// pal-dk
+		{169250, 177250, 185250}
+	}
+};
+
 void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, unsigned me)
 {
 	switch (msg.msg[1]) {
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 cec-follower: create analog channel frequencies

Quoted 16 lines · Jiunn Chang

This frequency table will allow proper testing of tuner control. There are three frequencies per analog broadcast type and broadcast system, so tuner increment and decrement can be tested.

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>
---
 utils/cec-follower/cec-tuner.cpp | 77 ++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
utils/cec-follower/cec-tuner.cpp +0 -0
index 5e794d71..e0d58e6c 100644
@@ -7,6 +7,83 @@
 
 #include "cec-follower.h"

utils/cec-follower/cec-tuner.cpp line 18

Quoted 10 lines
utils/cec-follower/cec-tuner.cpp +9 -0
 
+/*
+ * This table contains analog television channel frequencies in KHz.  There are
+ * a total of three frequencies per analog broadcast type and broadcast system.
+ *
+ * CEC 17 and CEC Table 31 of the 1.4 specification lists the available analog
+ * broadcast types and broadcast systems.
+ *
+ * The table is indexed by [ana_bcast_type][bcast_system][i].
+ *

No need for this empty comment line.

These frequencies are based on data from a wikipedia page, right?

It's useful to add a link to that page in this comment.

utils/cec-follower/cec-tuner.cpp line 25

Quoted 7 lines
utils/cec-follower/cec-tuner.cpp +7 -0
+ */
+static unsigned int analog_freqs_khz[3][9][3] =
+{
+	// cable
+	{
+		// pal-bg
+		{471250, 479250, 487250},

Add a space after { and before } in this table.

Quoted 55 lines
utils/cec-follower/cec-tuner.cpp +54 -0
+		// secam-lq
+		{615250, 623250, 631250},
+		// pal-m
+		{501250, 507250, 513250},
+		// ntsc-m
+		{519250, 525250, 531250},
+		// pal-i
+		{45750, 53750, 61750},
+		// secam-dk
+		{759250, 767250, 775250},
+		// secam-bg
+		{495250, 503250, 511250},
+		// secam-l
+		{639250, 647250, 655250},
+		// pal-dk
+		{783250, 791250, 799250}
+	},
+	// satellite
+	{
+		// pal-bg
+		{519250, 527250, 535250},
+		// secam-lq
+		{663250, 671250, 679250},
+		// pal-m
+		{537250, 543250, 549250},
+		// ntsc-m
+		{555250, 561250, 567250},
+		// pal-i
+		{175250, 183250, 191250},
+		// secam-dk
+		{807250, 815250, 823250},
+		// secam-bg
+		{543250, 551250, 559250},
+		// secam-l
+		{687250, 695250, 703250},
+		// pal-dk
+		{831250, 839250, 847250}
+	},
+	// terrestrial
+	{
+		// pal-bg
+		{567250, 575250, 583250},
+		// secam-lq
+		{711250, 719250, 727250},
+		// pal-m
+		{573250, 579250, 585250},
+		// ntsc-m
+		{591250, 597250, 603250},
+		// pal-i
+		{199250, 207250, 215250},
+		// secam-dk
+		{145250, 153250, 161250},
+		// secam-bg
+		{591250, 599250, 607250},

utils/cec-follower/cec-tuner.cpp line 89

Quoted 10 lines
utils/cec-follower/cec-tuner.cpp +7 -0
+		// secam-l
+		{735250, 743250, 751250},
+		// pal-dk
+		{169250, 177250, 185250}
+	}
+};
+
 void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, unsigned me)
 {
 	switch (msg.msg[1]) {

Regards,

Hans

#2 lore raw

PATCH v2 1/1 cec-follower: create analog channel frequencies

In reply to c0d1n61at3 at gmail.com (Jiunn Chang)

This frequency table will allow proper testing of tuner control. There are three frequencies per analog broadcast type and broadcast system, so tuner increment and decrement can be tested.

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>

---

Changes since v1:
- Add Wikipedia link for analog channel frequencies
- Add spaces between { and }

Quoted 1 line

8---------------------------------------------------------------------------8<

 utils/cec-follower/cec-tuner.cpp | 80 ++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
utils/cec-follower/cec-tuner.cpp +80 -0
index 5e794d71..912adcb9 100644
@@ -7,6 +7,86 @@
 
 #include "cec-follower.h"
 
+/*
+ * This table contains analog television channel frequencies in KHz.  There are
+ * a total of three frequencies per analog broadcast type and broadcast system.
+ *
+ * CEC 17 and CEC Table 31 of the 1.4 specification lists the available analog
+ * broadcast types and broadcast systems.
+ *
+ * The table is indexed by [ana_bcast_type][bcast_system][i].
+ *
+ * Analog channel frequencies are from Wikipedia:
+ *
+ * https://en.wikipedia.org/wiki/Television_channel_frequencies
+ */
+static unsigned int analog_freqs_khz[3][9][3] =
+{
+	// cable
+	{
+		// pal-bg
+		{ 471250, 479250, 487250 },
+		// secam-lq
+		{ 615250, 623250, 631250 },
+		// pal-m
+		{ 501250, 507250, 513250 },
+		// ntsc-m
+		{ 519250, 525250, 531250 },
+		// pal-i
+		{ 45750, 53750, 61750 },
+		// secam-dk
+		{ 759250, 767250, 775250 },
+		// secam-bg
+		{ 495250, 503250, 511250 },
+		// secam-l
+		{ 639250, 647250, 655250 },
+		// pal-dk
+		{ 783250, 791250, 799250 }
+	},
+	// satellite
+	{
+		// pal-bg
+		{ 519250, 527250, 535250 },
+		// secam-lq
+		{ 663250, 671250, 679250 },
+		// pal-m
+		{ 537250, 543250, 549250 },
+		// ntsc-m
+		{ 555250, 561250, 567250 },
+		// pal-i
+		{ 175250, 183250, 191250 },
+		// secam-dk
+		{ 807250, 815250, 823250 },
+		// secam-bg
+		{ 543250, 551250, 559250 },
+		// secam-l
+		{ 687250, 695250, 703250 },
+		// pal-dk
+		{ 831250, 839250, 847250 }
+	},
+	// terrestrial
+	{
+		// pal-bg
+		{ 567250, 575250, 583250 },
+		// secam-lq
+		{ 711250, 719250, 727250 },
+		// pal-m
+		{ 573250, 579250, 585250 },
+		// ntsc-m
+		{ 591250, 597250, 603250 },
+		// pal-i
+		{ 199250, 207250, 215250 },
+		// secam-dk
+		{ 145250, 153250, 161250 },
+		// secam-bg
+		{ 591250, 599250, 607250 },
+		// secam-l
+		{ 735250, 743250, 751250 },
+		// pal-dk
+		{ 169250, 177250, 185250 }
+	}
+};
+
 void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, unsigned me)
 {
 	switch (msg.msg[1]) {
Signature · 1 line
2.23.0
#3 lore raw

PATCH v2 1/1 cec-follower: create analog channel frequencies

Quoted 4 lines · Jiunn Chang

This frequency table will allow proper testing of tuner control. There are three frequencies per analog broadcast type and broadcast system, so tuner increment and decrement can be tested.

Quoted 8 lines
Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>

---

Changes since v1:
- Add Wikipedia link for analog channel frequencies
- Add spaces between { and }

Quoted 1 line

8---------------------------------------------------------------------------8<

For future reference: just use --- instead of this line.

The patch looks good, I'll wait for the next patch that will use this before merging this patch (otherwise I'd be merging dead code!).

Regards,

Hans

Quoted 96 lines
 utils/cec-follower/cec-tuner.cpp | 80 ++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
utils/cec-follower/cec-tuner.cpp +80 -0
index 5e794d71..912adcb9 100644
@@ -7,6 +7,86 @@
 
 #include "cec-follower.h"
 
+/*
+ * This table contains analog television channel frequencies in KHz.  There are
+ * a total of three frequencies per analog broadcast type and broadcast system.
+ *
+ * CEC 17 and CEC Table 31 of the 1.4 specification lists the available analog
+ * broadcast types and broadcast systems.
+ *
+ * The table is indexed by [ana_bcast_type][bcast_system][i].
+ *
+ * Analog channel frequencies are from Wikipedia:
+ *
+ * https://en.wikipedia.org/wiki/Television_channel_frequencies
+ */
+static unsigned int analog_freqs_khz[3][9][3] =
+{
+	// cable
+	{
+		// pal-bg
+		{ 471250, 479250, 487250 },
+		// secam-lq
+		{ 615250, 623250, 631250 },
+		// pal-m
+		{ 501250, 507250, 513250 },
+		// ntsc-m
+		{ 519250, 525250, 531250 },
+		// pal-i
+		{ 45750, 53750, 61750 },
+		// secam-dk
+		{ 759250, 767250, 775250 },
+		// secam-bg
+		{ 495250, 503250, 511250 },
+		// secam-l
+		{ 639250, 647250, 655250 },
+		// pal-dk
+		{ 783250, 791250, 799250 }
+	},
+	// satellite
+	{
+		// pal-bg
+		{ 519250, 527250, 535250 },
+		// secam-lq
+		{ 663250, 671250, 679250 },
+		// pal-m
+		{ 537250, 543250, 549250 },
+		// ntsc-m
+		{ 555250, 561250, 567250 },
+		// pal-i
+		{ 175250, 183250, 191250 },
+		// secam-dk
+		{ 807250, 815250, 823250 },
+		// secam-bg
+		{ 543250, 551250, 559250 },
+		// secam-l
+		{ 687250, 695250, 703250 },
+		// pal-dk
+		{ 831250, 839250, 847250 }
+	},
+	// terrestrial
+	{
+		// pal-bg
+		{ 567250, 575250, 583250 },
+		// secam-lq
+		{ 711250, 719250, 727250 },
+		// pal-m
+		{ 573250, 579250, 585250 },
+		// ntsc-m
+		{ 591250, 597250, 603250 },
+		// pal-i
+		{ 199250, 207250, 215250 },
+		// secam-dk
+		{ 145250, 153250, 161250 },
+		// secam-bg
+		{ 591250, 599250, 607250 },
+		// secam-l
+		{ 735250, 743250, 751250 },
+		// pal-dk
+		{ 169250, 177250, 185250 }
+	}
+};
+
 void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, unsigned me)
 {
 	switch (msg.msg[1]) {
#4 lore raw

PATCH v3 1/1 cec-follower: create analog channel frequencies

In reply to c0d1n61at3 at gmail.com (Jiunn Chang)

This frequency table will allow proper testing of tuner control. There are three frequencies per analog broadcast type and broadcast system, so tuner increment and decrement can be tested.

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>

---

Changes since v1:
- Add Wikipedia link for analog channel frequencies
- Add spaces between { and }

Changes since v2:
- Refactor lines numbers since a fix patch was needed for cec-tuner.cpp

---
 utils/cec-follower/cec-tuner.cpp | 80 ++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
utils/cec-follower/cec-tuner.cpp +80 -0
index bb727ae7..2303e6bb 100644
@@ -7,6 +7,86 @@
 
 #include "cec-follower.h"
 
+/*
+ * This table contains analog television channel frequencies in KHz.  There are
+ * a total of three frequencies per analog broadcast type and broadcast system.
+ *
+ * CEC 17 and CEC Table 31 of the 1.4 specification lists the available analog
+ * broadcast types and broadcast systems.
+ *
+ * The table is indexed by [ana_bcast_type][bcast_system][i].
+ *
+ * Analog channel frequencies are from Wikipedia:
+ *
+ * https://en.wikipedia.org/wiki/Television_channel_frequencies
+ */
+static unsigned int analog_freqs_khz[3][9][3] =
+{
+	// cable
+	{
+		// pal-bg
+		{ 471250, 479250, 487250 },
+		// secam-lq
+		{ 615250, 623250, 631250 },
+		// pal-m
+		{ 501250, 507250, 513250 },
+		// ntsc-m
+		{ 519250, 525250, 531250 },
+		// pal-i
+		{ 45750, 53750, 61750 },
+		// secam-dk
+		{ 759250, 767250, 775250 },
+		// secam-bg
+		{ 495250, 503250, 511250 },
+		// secam-l
+		{ 639250, 647250, 655250 },
+		// pal-dk
+		{ 783250, 791250, 799250 }
+	},
+	// satellite
+	{
+		// pal-bg
+		{ 519250, 527250, 535250 },
+		// secam-lq
+		{ 663250, 671250, 679250 },
+		// pal-m
+		{ 537250, 543250, 549250 },
+		// ntsc-m
+		{ 555250, 561250, 567250 },
+		// pal-i
+		{ 175250, 183250, 191250 },
+		// secam-dk
+		{ 807250, 815250, 823250 },
+		// secam-bg
+		{ 543250, 551250, 559250 },
+		// secam-l
+		{ 687250, 695250, 703250 },
+		// pal-dk
+		{ 831250, 839250, 847250 }
+	},
+	// terrestrial
+	{
+		// pal-bg
+		{ 567250, 575250, 583250 },
+		// secam-lq
+		{ 711250, 719250, 727250 },
+		// pal-m
+		{ 573250, 579250, 585250 },
+		// ntsc-m
+		{ 591250, 597250, 603250 },
+		// pal-i
+		{ 199250, 207250, 215250 },
+		// secam-dk
+		{ 145250, 153250, 161250 },
+		// secam-bg
+		{ 591250, 599250, 607250 },
+		// secam-l
+		{ 735250, 743250, 751250 },
+		// pal-dk
+		{ 169250, 177250, 185250 }
+	}
+};
+
 static void reply_feature_abort(struct node *node, struct cec_msg *msg, __u8 reason = CEC_OP_ABORT_UNRECOGNIZED_OP)
 {
 	unsigned la = cec_msg_initiator(msg);
Signature · 1 line
2.23.0
#5 lore raw

PATCH v4 1/1 cec-follower: create analog channel frequencies

This frequency table will allow proper testing of tuner control. There are three frequencies per analog broadcast type and broadcast system, so tuner increment and decrement can be tested.

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>

---

Changes made since v1:
- Add Wikipedia link for analog channel frequencies
- Add spaces between { and }

Changes made since v2:
- Add reply_feature_abort() to cec-tuner.cpp
- Refactor lines numbers since a fix patch was needed for cec-tuner.cpp

Changes made since v3:
- Remove reply_feature_abort() from cec-tuner.cpp
- Add macro for NUM_ANALOG_FREQS
- Refactor lines numbers since a fix patch was needed for cec-tuner.cpp

---
 utils/cec-follower/cec-tuner.cpp | 82 ++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)
utils/cec-follower/cec-tuner.cpp +82 -0
index a1e349bd..bdeda342 100644
@@ -7,6 +7,88 @@
 
 #include "cec-follower.h"
 
+#define NUM_ANALOG_FREQS	3
+
+/*
+ * This table contains analog television channel frequencies in KHz.  There are
+ * a total of three frequencies per analog broadcast type and broadcast system.
+ *
+ * CEC 17 and CEC Table 31 of the 1.4 specification lists the available analog
+ * broadcast types and broadcast systems.
+ *
+ * The table is indexed by [ana_bcast_type][bcast_system][NUM_ANALOG_FREQS].
+ *
+ * Analog channel frequencies are from Wikipedia:
+ *
+ * https://en.wikipedia.org/wiki/Television_channel_frequencies
+ */
+static unsigned int analog_freqs_khz[3][9][NUM_ANALOG_FREQS] =
+{
+	// cable
+	{
+		// pal-bg
+		{ 471250, 479250, 487250 },
+		// secam-lq
+		{ 615250, 623250, 631250 },
+		// pal-m
+		{ 501250, 507250, 513250 },
+		// ntsc-m
+		{ 519250, 525250, 531250 },
+		// pal-i
+		{ 45750, 53750, 61750 },
+		// secam-dk
+		{ 759250, 767250, 775250 },
+		// secam-bg
+		{ 495250, 503250, 511250 },
+		// secam-l
+		{ 639250, 647250, 655250 },
+		// pal-dk
+		{ 783250, 791250, 799250 }
+	},
+	// satellite
+	{
+		// pal-bg
+		{ 519250, 527250, 535250 },
+		// secam-lq
+		{ 663250, 671250, 679250 },
+		// pal-m
+		{ 537250, 543250, 549250 },
+		// ntsc-m
+		{ 555250, 561250, 567250 },
+		// pal-i
+		{ 175250, 183250, 191250 },
+		// secam-dk
+		{ 807250, 815250, 823250 },
+		// secam-bg
+		{ 543250, 551250, 559250 },
+		// secam-l
+		{ 687250, 695250, 703250 },
+		// pal-dk
+		{ 831250, 839250, 847250 }
+	},
+	// terrestrial
+	{
+		// pal-bg
+		{ 567250, 575250, 583250 },
+		// secam-lq
+		{ 711250, 719250, 727250 },
+		// pal-m
+		{ 573250, 579250, 585250 },
+		// ntsc-m
+		{ 591250, 597250, 603250 },
+		// pal-i
+		{ 199250, 207250, 215250 },
+		// secam-dk
+		{ 145250, 153250, 161250 },
+		// secam-bg
+		{ 591250, 599250, 607250 },
+		// secam-l
+		{ 735250, 743250, 751250 },
+		// pal-dk
+		{ 169250, 177250, 185250 }
+	}
+};
+
 void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, unsigned me)
 {
 	bool is_bcast = cec_msg_is_broadcast(&msg);
Signature · 1 line
2.23.0