Proper CableCARD/HDHomeRun Prime support » tvheadend_cablecard-4.2.patch
src/input/mpegts/dvb.h | ||
---|---|---|
16 | 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
*/ |
18 | 18 | |
19 |
/*
|
|
19 |
/* |
|
20 | 20 |
* Based on: |
21 | 21 |
* |
22 | 22 |
* ITU-T Recommendation H.222.0 / ISO standard 13818-1 |
... | ... | |
406 | 406 |
DVB_TYPE_S, /* satellite */ |
407 | 407 |
DVB_TYPE_ATSC_T, /* terrestrial - north america */ |
408 | 408 |
DVB_TYPE_ATSC_C, /* cable - north america */ |
409 |
DVB_TYPE_CABLECARD, /* CableCARD - North America */ |
|
409 | 410 |
DVB_TYPE_ISDB_T, /* terrestrial - japan, brazil */ |
410 | 411 |
DVB_TYPE_ISDB_C, /* cable - japan, brazil */ |
411 | 412 |
DVB_TYPE_ISDB_S, /* satellite - japan, brazil */ |
... | ... | |
599 | 600 |
} layers[3]; |
600 | 601 |
} dvb_isdbt_config_t; |
601 | 602 | |
603 |
typedef struct dvb_fe_vchan { |
|
604 |
uint32_t num; |
|
605 |
uint16_t minor; |
|
606 |
char *name; |
|
607 |
} dvb_fe_vchan_t; |
|
608 | ||
602 | 609 |
typedef struct dvb_mux_conf |
603 | 610 |
{ |
604 | 611 |
dvb_fe_type_t dmc_fe_type; |
... | ... | |
617 | 624 |
dvb_ofdm_config_t dmc_fe_ofdm; |
618 | 625 |
dvb_isdbt_config_t dmc_fe_isdbt; |
619 | 626 |
} u; |
627 |
dvb_fe_vchan_t dmc_fe_vchan; |
|
620 | 628 | |
621 | 629 |
// For scan file configurations |
622 | 630 |
LIST_ENTRY(dvb_mux_conf) dmc_link; |
623 |
|
|
631 | ||
624 | 632 |
} dvb_mux_conf_t; |
625 | 633 | |
626 | 634 |
/* conversion routines */ |
src/input/mpegts/dvb_support.c | ||
---|---|---|
252 | 252 | |
253 | 253 |
int |
254 | 254 |
dvb_get_string |
255 |
(char *dst, size_t dstlen, const uint8_t *src, size_t srclen,
|
|
255 |
(char *dst, size_t dstlen, const uint8_t *src, size_t srclen, |
|
256 | 256 |
const char *dvb_charset, dvb_string_conv_t *conv) |
257 | 257 |
{ |
258 | 258 |
int ic = -1; |
... | ... | |
302 | 302 |
ic = convert_iso_8859[src[2]]; |
303 | 303 |
src+=3; srclen-=3; |
304 | 304 |
break; |
305 |
|
|
305 | ||
306 | 306 |
case 0x11: |
307 | 307 |
ic = convert_ucs2; |
308 | 308 |
src++; srclen--; |
... | ... | |
376 | 376 | |
377 | 377 | |
378 | 378 |
int |
379 |
dvb_get_string_with_len(char *dst, size_t dstlen,
|
|
379 |
dvb_get_string_with_len(char *dst, size_t dstlen, |
|
380 | 380 |
const uint8_t *buf, size_t buflen, const char *dvb_charset, |
381 | 381 |
dvb_string_conv_t *conv) |
382 | 382 |
{ |
... | ... | |
683 | 683 |
{ "DVBC/ANNEX_A", DVB_SYS_DVBC_ANNEX_A }, |
684 | 684 |
{ "DVBC_ANNEX_A", DVB_SYS_DVBC_ANNEX_A }, |
685 | 685 |
{ "ATSC-C", DVB_SYS_DVBC_ANNEX_B }, |
686 |
{ "CableCARD", DVB_SYS_DVBC_ANNEX_B }, |
|
686 | 687 |
{ "DVBC/ANNEX_B", DVB_SYS_DVBC_ANNEX_B }, |
687 | 688 |
{ "DVBC_ANNEX_B", DVB_SYS_DVBC_ANNEX_B }, |
688 | 689 |
{ "DVB-C/ANNEX-C",DVB_SYS_DVBC_ANNEX_C }, |
... | ... | |
738 | 739 |
case DVB_SYS_DVBC_ANNEX_B: |
739 | 740 |
if (ln && idnode_is_instance(&ln->mn_id, &dvb_network_dvbc_class)) |
740 | 741 |
return DVB_TYPE_C; |
742 |
if (ln && idnode_is_instance(&ln->mn_id, &dvb_network_cablecard_class)) |
|
743 |
return DVB_TYPE_CABLECARD; |
|
741 | 744 |
else |
742 | 745 |
return DVB_TYPE_ATSC_C; |
743 | 746 |
case DVB_SYS_ISDBT: |
... | ... | |
944 | 947 |
dvb_str2val(pol); |
945 | 948 | |
946 | 949 |
const static struct strtab typetab[] = { |
947 |
{"DVB-T", DVB_TYPE_T}, |
|
948 |
{"DVB-C", DVB_TYPE_C}, |
|
949 |
{"DVB-S", DVB_TYPE_S}, |
|
950 |
{"ATSC-T", DVB_TYPE_ATSC_T}, |
|
951 |
{"ATSC-C", DVB_TYPE_ATSC_C}, |
|
952 |
{"ISDB-T", DVB_TYPE_ISDB_T}, |
|
953 |
{"ISDB-C", DVB_TYPE_ISDB_C}, |
|
954 |
{"ISDB-S", DVB_TYPE_ISDB_S}, |
|
955 |
{"DAB", DVB_TYPE_DAB}, |
|
956 |
{"DVBT", DVB_TYPE_T}, |
|
957 |
{"DVBC", DVB_TYPE_C}, |
|
958 |
{"DVBS", DVB_TYPE_S}, |
|
959 |
{"ATSC", DVB_TYPE_ATSC_T}, |
|
960 |
{"ATSCT", DVB_TYPE_ATSC_T}, |
|
961 |
{"ATSCC", DVB_TYPE_ATSC_C}, |
|
962 |
{"ISDBT", DVB_TYPE_ISDB_T}, |
|
963 |
{"ISDBC", DVB_TYPE_ISDB_C}, |
|
964 |
{"ISDBS", DVB_TYPE_ISDB_S} |
|
950 |
{"DVB-T", DVB_TYPE_T}, |
|
951 |
{"DVB-C", DVB_TYPE_C}, |
|
952 |
{"DVB-S", DVB_TYPE_S}, |
|
953 |
{"ATSC-T", DVB_TYPE_ATSC_T}, |
|
954 |
{"ATSC-C", DVB_TYPE_ATSC_C}, |
|
955 |
{"CableCARD", DVB_TYPE_CABLECARD}, |
|
956 |
{"ISDB-T", DVB_TYPE_ISDB_T}, |
|
957 |
{"ISDB-C", DVB_TYPE_ISDB_C}, |
|
958 |
{"ISDB-S", DVB_TYPE_ISDB_S}, |
|
959 |
{"DAB", DVB_TYPE_DAB}, |
|
960 |
{"DVBT", DVB_TYPE_T}, |
|
961 |
{"DVBC", DVB_TYPE_C}, |
|
962 |
{"DVBS", DVB_TYPE_S}, |
|
963 |
{"ATSC", DVB_TYPE_ATSC_T}, |
|
964 |
{"ATSCT", DVB_TYPE_ATSC_T}, |
|
965 |
{"ATSCC", DVB_TYPE_ATSC_C}, |
|
966 |
{"ISDBT", DVB_TYPE_ISDB_T}, |
|
967 |
{"ISDBC", DVB_TYPE_ISDB_C}, |
|
968 |
{"ISDBS", DVB_TYPE_ISDB_S} |
|
965 | 969 |
}; |
966 | 970 |
dvb_str2val(type); |
967 | 971 | |
... | ... | |
1079 | 1083 |
dvb_qam2str(dmc->dmc_fe_modulation)); |
1080 | 1084 |
} |
1081 | 1085 | |
1086 |
static int |
|
1087 |
dvb_mux_conf_str_cablecard(dvb_mux_conf_t *dmc, char *buf, size_t bufsize) |
|
1088 |
{ |
|
1089 |
if (!dmc->dmc_fe_vchan.minor) |
|
1090 |
return snprintf(buf, bufsize, "%s channel %u", |
|
1091 |
dvb_type2str(dmc->dmc_fe_type), |
|
1092 |
dmc->dmc_fe_vchan.num); |
|
1093 |
else |
|
1094 |
return snprintf(buf, bufsize, "%s channel %u.%u", |
|
1095 |
dvb_type2str(dmc->dmc_fe_type), |
|
1096 |
dmc->dmc_fe_vchan.num, |
|
1097 |
dmc->dmc_fe_vchan.minor); |
|
1098 |
} |
|
1099 | ||
1082 | 1100 |
static int |
1083 | 1101 |
dvb_mux_conf_str_isdb_t ( dvb_mux_conf_t *dmc, char *buf, size_t bufsize ) |
1084 | 1102 |
{ |
... | ... | |
1122 | 1140 |
return dvb_mux_conf_str_dvbs(dmc, buf, bufsize); |
1123 | 1141 |
case DVB_TYPE_ATSC_T: |
1124 | 1142 |
return dvb_mux_conf_str_atsc_t(dmc, buf, bufsize); |
1143 |
case DVB_TYPE_CABLECARD: |
|
1144 |
return dvb_mux_conf_str_cablecard(dmc, buf, bufsize); |
|
1125 | 1145 |
case DVB_TYPE_ISDB_T: |
1126 | 1146 |
return dvb_mux_conf_str_isdb_t(dmc, buf, bufsize); |
1127 | 1147 |
default: |
src/input/mpegts/mpegts_dvb.h | ||
---|---|---|
50 | 50 |
extern const idclass_t dvb_network_dvbs_class; |
51 | 51 |
extern const idclass_t dvb_network_atsc_t_class; |
52 | 52 |
extern const idclass_t dvb_network_atsc_c_class; |
53 |
extern const idclass_t dvb_network_cablecard_class; |
|
53 | 54 |
extern const idclass_t dvb_network_isdb_t_class; |
54 | 55 |
extern const idclass_t dvb_network_isdb_c_class; |
55 | 56 |
extern const idclass_t dvb_network_isdb_s_class; |
... | ... | |
87 | 88 |
extern const idclass_t dvb_mux_dvbs_class; |
88 | 89 |
extern const idclass_t dvb_mux_atsc_t_class; |
89 | 90 |
extern const idclass_t dvb_mux_atsc_c_class; |
91 |
extern const idclass_t dvb_mux_cablecard_class; |
|
90 | 92 |
extern const idclass_t dvb_mux_isdb_t_class; |
91 | 93 |
extern const idclass_t dvb_mux_isdb_c_class; |
92 | 94 |
extern const idclass_t dvb_mux_isdb_s_class; |
src/input/mpegts/mpegts_mux_dvb.c | ||
---|---|---|
129 | 129 |
return 0; |
130 | 130 |
} |
131 | 131 | |
132 |
static const void * |
|
133 |
dvb_mux_class_vchan_get(void *o) |
|
134 |
{ |
|
135 |
dvb_mux_t *lm = (dvb_mux_t *)o; |
|
136 | ||
137 |
if (!lm->lm_tuning.dmc_fe_vchan.minor) |
|
138 |
snprintf(prop_sbuf, PROP_SBUF_LEN, "%u", |
|
139 |
lm->lm_tuning.dmc_fe_vchan.num); |
|
140 |
else |
|
141 |
snprintf(prop_sbuf, PROP_SBUF_LEN, "%u.%u", |
|
142 |
lm->lm_tuning.dmc_fe_vchan.num, |
|
143 |
lm->lm_tuning.dmc_fe_vchan.minor); |
|
144 |
return &prop_sbuf_ptr; |
|
145 |
} |
|
146 | ||
147 |
static int |
|
148 |
dvb_mux_class_vchan_set(void *o, const void *v) |
|
149 |
{ |
|
150 |
dvb_mux_t *lm = (dvb_mux_t *)o; |
|
151 |
int r; |
|
152 | ||
153 |
r = sscanf(v, "%u%*[.-]%hu", |
|
154 |
&lm->lm_tuning.dmc_fe_vchan.num, |
|
155 |
&lm->lm_tuning.dmc_fe_vchan.minor); |
|
156 |
switch (r) { |
|
157 |
case 0: |
|
158 |
return 1; |
|
159 |
case 1: |
|
160 |
lm->lm_tuning.dmc_fe_vchan.minor = 0; |
|
161 |
} |
|
162 |
return 0; |
|
163 |
} |
|
164 | ||
132 | 165 |
const idclass_t dvb_mux_class = |
133 | 166 |
{ |
134 | 167 |
.ic_super = &mpegts_mux_class, |
... | ... | |
614 | 647 |
} |
615 | 648 |
}; |
616 | 649 | |
650 |
/* |
|
651 |
* CableCARD |
|
652 |
*/ |
|
653 |
const idclass_t dvb_mux_cablecard_class = |
|
654 |
{ |
|
655 |
.ic_super = &dvb_mux_class, |
|
656 |
.ic_class = "dvb_mux_cablecard", |
|
657 |
.ic_caption = N_("CableCARD multiplex"), |
|
658 |
.ic_properties = (const property_t[]){ |
|
659 |
{ |
|
660 |
.type = PT_STR, |
|
661 |
.id = "vchan", |
|
662 |
.name = N_("Channel"), |
|
663 |
.desc = N_("The channel on the cable provider's network."), |
|
664 |
.get = dvb_mux_class_vchan_get, |
|
665 |
.set = dvb_mux_class_vchan_set, |
|
666 |
}, |
|
667 |
{ |
|
668 |
.type = PT_U32, |
|
669 |
.id = "frequency", |
|
670 |
.name = N_("Frequency (Hz)"), |
|
671 |
.desc = N_("The frequency of the mux (in Hertz)."), |
|
672 |
.off = offsetof(dvb_mux_t, lm_tuning.dmc_fe_freq), |
|
673 |
.opts = PO_RDONLY, |
|
674 |
}, |
|
675 |
{ |
|
676 |
.type = PT_STR, |
|
677 |
.id = "vchan_name", |
|
678 |
.name = N_("Callsign"), |
|
679 |
.desc = N_("The channel's name or callsign as set by the cable provider."), |
|
680 |
.off = offsetof(dvb_mux_t, lm_tuning.dmc_fe_vchan.name), |
|
681 |
.opts = PO_RDONLY, |
|
682 |
}, |
|
683 |
{} |
|
684 |
} |
|
685 |
}; |
|
686 | ||
617 | 687 |
/* |
618 | 688 |
* ISDB-T |
619 | 689 |
*/ |
... | ... | |
913 | 983 |
dvb_network_t *ln = (dvb_network_t*)mm->mm_network; |
914 | 984 |
uint32_t freq = lm->lm_tuning.dmc_fe_freq, freq2; |
915 | 985 |
char extra[8], buf2[5], *p; |
916 |
if (ln->ln_type == DVB_TYPE_S) { |
|
917 |
const char *s = dvb_pol2str(lm->lm_tuning.u.dmc_fe_qpsk.polarisation); |
|
918 |
if (s) extra[0] = *s; |
|
919 |
extra[1] = '\0'; |
|
986 | ||
987 |
if (lm->lm_tuning.dmc_fe_type == DVB_TYPE_CABLECARD) { |
|
988 |
if (!lm->lm_tuning.dmc_fe_vchan.minor) |
|
989 |
snprintf(buf, len, "%u", lm->lm_tuning.dmc_fe_vchan.num); |
|
990 |
else |
|
991 |
snprintf(buf, len, "%u.%u", |
|
992 |
lm->lm_tuning.dmc_fe_vchan.num, |
|
993 |
lm->lm_tuning.dmc_fe_vchan.minor); |
|
920 | 994 |
} else { |
995 |
if (ln->ln_type == DVB_TYPE_S) { |
|
996 |
const char *s = dvb_pol2str(lm->lm_tuning.u.dmc_fe_qpsk.polarisation); |
|
997 |
if (s) extra[0] = *s; |
|
998 |
extra[1] = '\0'; |
|
999 |
} else { |
|
1000 |
freq /= 1000; |
|
1001 |
strcpy(extra, "MHz"); |
|
1002 |
} |
|
1003 |
freq2 = freq % 1000; |
|
921 | 1004 |
freq /= 1000; |
922 |
strcpy(extra, "MHz"); |
|
923 |
} |
|
924 |
freq2 = freq % 1000; |
|
925 |
freq /= 1000; |
|
926 |
snprintf(buf2, sizeof(buf2), "%03d", freq2); |
|
927 |
p = buf2 + 2; |
|
928 |
while (freq2 && (freq2 % 10) == 0) { |
|
929 |
freq2 /= 10; |
|
930 |
*(p--) = '\0'; |
|
1005 |
snprintf(buf2, sizeof(buf2), "%03d", freq2); |
|
1006 |
p = buf2 + 2; |
|
1007 |
while (freq2 && (freq2 % 10) == 0) { |
|
1008 |
freq2 /= 10; |
|
1009 |
*(p--) = '\0'; |
|
1010 |
} |
|
1011 |
if (freq2) |
|
1012 |
snprintf(buf, len, "%d.%s%s", freq, buf2, extra); |
|
1013 |
else |
|
1014 |
snprintf(buf, len, "%d%s", freq, extra); |
|
931 | 1015 |
} |
932 |
if (freq2) |
|
933 |
snprintf(buf, len, "%d.%s%s", freq, buf2, extra); |
|
934 |
else |
|
935 |
snprintf(buf, len, "%d%s", freq, extra); |
|
936 | 1016 |
} |
937 | 1017 | |
938 | 1018 |
static void |
... | ... | |
997 | 1077 |
} else if (ln->ln_type == DVB_TYPE_ATSC_C) { |
998 | 1078 |
idc = &dvb_mux_atsc_c_class; |
999 | 1079 |
delsys = DVB_SYS_DVBC_ANNEX_B; |
1080 |
} else if (ln->ln_type == DVB_TYPE_CABLECARD) { |
|
1081 |
idc = &dvb_mux_cablecard_class; |
|
1082 |
delsys = DVB_SYS_DVBC_ANNEX_B; |
|
1000 | 1083 |
} else if (ln->ln_type == DVB_TYPE_ISDB_T) { |
1001 | 1084 |
idc = &dvb_mux_isdb_t_class; |
1002 | 1085 |
delsys = DVB_SYS_ISDBT; |
src/input/mpegts/mpegts_network_dvb.c | ||
---|---|---|
47 | 47 |
char ubuf[UUID_HEX_SIZE]; |
48 | 48 | |
49 | 49 |
/* remove config */ |
50 |
hts_settings_remove("input/dvb/networks/%s",
|
|
50 |
hts_settings_remove("input/dvb/networks/%s", |
|
51 | 51 |
idnode_uuid_as_str(in, ubuf)); |
52 | 52 | |
53 | 53 |
/* Parent delete */ |
... | ... | |
355 | 355 |
} |
356 | 356 |
}; |
357 | 357 | |
358 |
const idclass_t dvb_network_cablecard_class = |
|
359 |
{ |
|
360 |
.ic_super = &dvb_network_class, |
|
361 |
.ic_class = "dvb_network_cablecard", |
|
362 |
.ic_caption = N_("CableCARD Network"), |
|
363 |
.ic_properties = (const property_t[]){ |
|
364 |
{} |
|
365 |
} |
|
366 |
}; |
|
367 | ||
358 | 368 |
const idclass_t dvb_network_isdb_t_class = |
359 | 369 |
{ |
360 | 370 |
.ic_super = &dvb_network_class, |
... | ... | |
600 | 610 |
return &dvb_mux_atsc_t_class; |
601 | 611 |
if (idnode_is_instance(&mn->mn_id, &dvb_network_atsc_c_class)) |
602 | 612 |
return &dvb_mux_atsc_c_class; |
613 |
if (idnode_is_instance(&mn->mn_id, &dvb_network_cablecard_class)) |
|
614 |
return &dvb_mux_cablecard_class; |
|
603 | 615 |
if (idnode_is_instance(&mn->mn_id, &dvb_network_isdb_t_class)) |
604 | 616 |
return &dvb_mux_isdb_t_class; |
605 | 617 |
if (idnode_is_instance(&mn->mn_id, &dvb_network_isdb_c_class)) |
... | ... | |
795 | 807 |
dvb_network_create_service |
796 | 808 |
( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid ) |
797 | 809 |
{ |
798 |
return mpegts_service_create1(NULL, mm, sid, pmt_pid, NULL); |
|
810 |
dvb_mux_t *lm = (dvb_mux_t *)mm; |
|
811 |
mpegts_service_t *s; |
|
812 | ||
813 |
s = mpegts_service_create1(NULL, mm, sid, pmt_pid, NULL); |
|
814 | ||
815 |
/* Set service values from mux if CableCARD */ |
|
816 |
if (lm->lm_tuning.dmc_fe_type == DVB_TYPE_CABLECARD) { |
|
817 |
mpegts_network_t *ln = mm->mm_network; |
|
818 |
if (!s->s_dvb_provider && lm->mm_provider_network_name) |
|
819 |
s->s_dvb_provider = strdup(lm->mm_provider_network_name); |
|
820 |
if (!s->s_dvb_provider && ln->mn_provider_network_name) |
|
821 |
s->s_dvb_provider = strdup(ln->mn_provider_network_name); |
|
822 |
if (!s->s_dvb_channel_num) |
|
823 |
s->s_dvb_channel_num = lm->lm_tuning.dmc_fe_vchan.num; |
|
824 |
if (!s->s_dvb_channel_minor && lm->lm_tuning.dmc_fe_vchan.minor) |
|
825 |
s->s_dvb_channel_minor = lm->lm_tuning.dmc_fe_vchan.minor; |
|
826 |
if (!s->s_dvb_svcname && lm->lm_tuning.dmc_fe_vchan.name) |
|
827 |
s->s_dvb_svcname = strdup(lm->lm_tuning.dmc_fe_vchan.name); |
|
828 |
} |
|
829 | ||
830 |
return s; |
|
799 | 831 |
} |
800 | 832 | |
801 | 833 |
static mpegts_mux_t * |
... | ... | |
829 | 861 |
if (!(ln = (dvb_network_t*)mpegts_network_create0((void*)ln, |
830 | 862 |
idc, uuid, NULL, conf))) |
831 | 863 |
return NULL; |
832 |
|
|
864 | ||
833 | 865 |
/* Callbacks */ |
834 | 866 |
ln->mn_create_mux = dvb_network_create_mux; |
835 | 867 |
ln->mn_create_service = dvb_network_create_service; |
... | ... | |
872 | 904 |
&dvb_network_dvbs_class, |
873 | 905 |
&dvb_network_atsc_t_class, |
874 | 906 |
&dvb_network_atsc_c_class, |
907 |
&dvb_network_cablecard_class, |
|
875 | 908 |
&dvb_network_isdb_t_class, |
876 | 909 |
&dvb_network_isdb_c_class, |
877 | 910 |
&dvb_network_isdb_s_class, |
... | ... | |
886 | 919 |
&dvb_mux_dvbs_class, |
887 | 920 |
&dvb_mux_atsc_t_class, |
888 | 921 |
&dvb_mux_atsc_c_class, |
922 |
&dvb_mux_cablecard_class, |
|
889 | 923 |
&dvb_mux_isdb_t_class, |
890 | 924 |
&dvb_mux_isdb_c_class, |
891 | 925 |
&dvb_mux_isdb_s_class, |
... | ... | |
912 | 946 |
for (i = 0; i < ARRAY_SIZE(dvb_network_classes); i++) |
913 | 947 |
mpegts_network_register_builder(dvb_network_classes[i], |
914 | 948 |
dvb_network_builder); |
915 |
|
|
949 | ||
916 | 950 |
/* Load settings */ |
917 | 951 |
if (!(c = hts_settings_load_r(1, "input/dvb/networks"))) |
918 | 952 |
return; |
... | ... | |
965 | 999 |
return &dvb_network_atsc_t_class; |
966 | 1000 |
else if (type == DVB_TYPE_ATSC_C) |
967 | 1001 |
return &dvb_network_atsc_c_class; |
1002 |
else if (type == DVB_TYPE_CABLECARD) |
|
1003 |
return &dvb_network_cablecard_class; |
|
968 | 1004 |
else if (type == DVB_TYPE_ISDB_T) |
969 | 1005 |
return &dvb_network_isdb_t_class; |
970 | 1006 |
else if (type == DVB_TYPE_ISDB_C) |
... | ... | |
989 | 1025 |
return DVB_TYPE_ATSC_T; |
990 | 1026 |
else if (idc == &dvb_network_atsc_c_class) |
991 | 1027 |
return DVB_TYPE_ATSC_C; |
1028 |
else if (idc == &dvb_network_cablecard_class) |
|
1029 |
return DVB_TYPE_CABLECARD; |
|
992 | 1030 |
else if (idc == &dvb_network_isdb_t_class) |
993 | 1031 |
return DVB_TYPE_ISDB_T; |
994 | 1032 |
else if (idc == &dvb_network_isdb_c_class) |
src/input/mpegts/tvhdhomerun/tvhdhomerun.c | ||
---|---|---|
115 | 115 |
htsmsg_add_str(m, NULL, "DVB-C"); |
116 | 116 |
htsmsg_add_str(m, NULL, "ATSC-T"); |
117 | 117 |
htsmsg_add_str(m, NULL, "ATSC-C"); |
118 |
htsmsg_add_str(m, NULL, "CableCARD"); |
|
118 | 119 |
return m; |
119 | 120 |
} |
120 | 121 | |
... | ... | |
316 | 317 |
override_type = "ATSC-T"; |
317 | 318 |
type = dvb_str2type(override_type); |
318 | 319 |
if ( ! ( type == DVB_TYPE_C || type == DVB_TYPE_T || |
319 |
type == DVB_TYPE_ATSC_T || type == DVB_TYPE_ATSC_C ) ) { |
|
320 |
type == DVB_TYPE_ATSC_T || type == DVB_TYPE_ATSC_C || |
|
321 |
type == DVB_TYPE_CABLECARD ) ) { |
|
320 | 322 |
type = DVB_TYPE_C; |
321 | 323 |
} |
322 | 324 |
} |
323 | 325 |
} else { |
324 | 326 |
if (strstr(hd->hd_info.deviceModel, "_atsc")) |
325 | 327 |
type = DVB_TYPE_ATSC_T; |
328 |
if (strstr(hd->hd_info.deviceModel, "_cablecard")) |
|
329 |
type = DVB_TYPE_CABLECARD; |
|
326 | 330 |
} |
327 | 331 | |
328 | 332 |
hd->hd_override_type = strdup(dvb_type2str(type)); |
... | ... | |
453 | 457 |
idclass_register(&tvhdhomerun_frontend_dvbc_class); |
454 | 458 |
idclass_register(&tvhdhomerun_frontend_atsc_t_class); |
455 | 459 |
idclass_register(&tvhdhomerun_frontend_atsc_c_class); |
460 |
idclass_register(&tvhdhomerun_frontend_cablecard_class); |
|
456 | 461 |
TAILQ_INIT(&tvhdhomerun_discoveries); |
457 | 462 |
pthread_mutex_init(&tvhdhomerun_discovery_lock, NULL); |
458 | 463 |
tvh_cond_init(&tvhdhomerun_discovery_cond); |
src/input/mpegts/tvhdhomerun/tvhdhomerun.h | ||
---|---|---|
25 | 25 |
extern const idclass_t tvhdhomerun_frontend_dvbc_class; |
26 | 26 |
extern const idclass_t tvhdhomerun_frontend_atsc_t_class; |
27 | 27 |
extern const idclass_t tvhdhomerun_frontend_atsc_c_class; |
28 |
extern const idclass_t tvhdhomerun_frontend_cablecard_class; |
|
28 | 29 | |
29 | 30 |
void tvhdhomerun_init( void ); |
30 | 31 |
void tvhdhomerun_done( void ); |
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c | ||
---|---|---|
254 | 254 |
tvhdebug(LS_TVHDHOMERUN, "locked"); |
255 | 255 |
hfe->hf_locked = 1; |
256 | 256 | |
257 |
/* Get CableCARD variables */ |
|
258 |
dvb_mux_t *lm = (dvb_mux_t *)mm; |
|
259 |
struct hdhomerun_tuner_vstatus_t tuner_vstatus; |
|
260 |
char *tuner_vstatus_str; |
|
261 |
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex); |
|
262 |
res = hdhomerun_device_get_tuner_vstatus(hfe->hf_hdhomerun_tuner, |
|
263 |
&tuner_vstatus_str, &tuner_vstatus); |
|
264 |
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex); |
|
265 |
if (res < 1) |
|
266 |
tvhwarn(LS_TVHDHOMERUN, "tuner_vstatus (%d)", res); |
|
267 |
lm->lm_tuning.dmc_fe_vchan.name = strdup(tuner_vstatus.name); |
|
268 |
sscanf(strstr(tuner_status.channel, ":"), ":%u", &lm->lm_tuning.dmc_fe_freq); |
|
269 | ||
257 | 270 |
/* start input thread */ |
258 | 271 |
tvh_pipe(O_NONBLOCK, &hfe->hf_input_thread_pipe); |
259 | 272 |
pthread_mutex_lock(&hfe->hf_input_thread_mutex); |
... | ... | |
308 | 321 |
char buf[1024]; |
309 | 322 |
int res; |
310 | 323 | |
324 |
if (hfe->hf_type == DVB_TYPE_CABLECARD) |
|
325 |
return; |
|
326 | ||
311 | 327 |
/* a full mux subscription should specificly set the filter */ |
312 | 328 |
if (pid == MPEGTS_FULLMUX_PID) { |
313 | 329 |
tvhdebug(LS_TVHDHOMERUN, "setting PID filter full mux"); |
... | ... | |
413 | 429 |
break; |
414 | 430 |
} |
415 | 431 |
break; |
432 |
case DVB_TYPE_CABLECARD: |
|
433 |
if (!dmc->dmc_fe_vchan.minor) |
|
434 |
snprintf(channel_buf, sizeof(channel_buf), "%u", dmc->dmc_fe_vchan.num); |
|
435 |
else |
|
436 |
snprintf(channel_buf, sizeof(channel_buf), "%u.%u", |
|
437 |
dmc->dmc_fe_vchan.num, |
|
438 |
dmc->dmc_fe_vchan.minor); |
|
439 |
break; |
|
416 | 440 |
default: |
417 | 441 |
snprintf(channel_buf, sizeof(channel_buf), "auto:%u", dmc->dmc_fe_freq); |
418 | 442 |
break; |
... | ... | |
427 | 451 |
tvherror(LS_TVHDHOMERUN, "failed to acquire lockkey: %s", perror); |
428 | 452 |
return SM_CODE_TUNING_FAILED; |
429 | 453 |
} |
430 |
res = hdhomerun_device_set_tuner_channel(hfe->hf_hdhomerun_tuner, channel_buf); |
|
454 |
if (hfe->hf_type == DVB_TYPE_CABLECARD) |
|
455 |
res = hdhomerun_device_set_tuner_vchannel(hfe->hf_hdhomerun_tuner, channel_buf); |
|
456 |
else |
|
457 |
res = hdhomerun_device_set_tuner_channel(hfe->hf_hdhomerun_tuner, channel_buf); |
|
431 | 458 |
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex); |
432 | 459 |
if(res < 1) { |
433 | 460 |
tvherror(LS_TVHDHOMERUN, "failed to tune to %s", channel_buf); |
... | ... | |
459 | 486 |
res = tvhdhomerun_frontend_tune(hfe, mmi); |
460 | 487 | |
461 | 488 |
/* reset the pfilters */ |
462 |
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex); |
|
463 |
r = hdhomerun_device_set_tuner_filter(hfe->hf_hdhomerun_tuner, "0x0000"); |
|
464 |
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex); |
|
465 |
if(r < 1) |
|
466 |
tvherror(LS_TVHDHOMERUN, "failed to reset pfilter: %d", r); |
|
489 |
if (hfe->hf_type != DVB_TYPE_CABLECARD) { |
|
490 |
pthread_mutex_lock(&hfe->hf_hdhomerun_device_mutex); |
|
491 |
r = hdhomerun_device_set_tuner_filter(hfe->hf_hdhomerun_tuner, "0x0000"); |
|
492 |
pthread_mutex_unlock(&hfe->hf_hdhomerun_device_mutex); |
|
493 |
if(r < 1) |
|
494 |
tvherror(LS_TVHDHOMERUN, "failed to reset pfilter: %d", r); |
|
495 |
} |
|
467 | 496 | |
468 | 497 |
return res; |
469 | 498 |
} |
... | ... | |
616 | 645 |
} |
617 | 646 |
}; |
618 | 647 | |
648 |
const idclass_t tvhdhomerun_frontend_cablecard_class = |
|
649 |
{ |
|
650 |
.ic_super = &tvhdhomerun_frontend_class, |
|
651 |
.ic_class = "tvhdhomerun_frontend_cablecard", |
|
652 |
.ic_caption = N_("HDHomeRun CableCARD frontend"), |
|
653 |
.ic_properties = (const property_t[]){ |
|
654 |
{} |
|
655 |
} |
|
656 |
}; |
|
657 | ||
619 | 658 |
static mpegts_network_t * |
620 | 659 |
tvhdhomerun_frontend_wizard_network ( tvhdhomerun_frontend_t *hfe ) |
621 | 660 |
{ |
... | ... | |
704 | 743 |
idc = &tvhdhomerun_frontend_atsc_t_class; |
705 | 744 |
else if (type == DVB_TYPE_ATSC_C) |
706 | 745 |
idc = &tvhdhomerun_frontend_atsc_c_class; |
746 |
else if (type == DVB_TYPE_CABLECARD) |
|
747 |
idc = &tvhdhomerun_frontend_cablecard_class; |
|
707 | 748 |
else { |
708 | 749 |
tvherror(LS_TVHDHOMERUN, "unknown FE type %d", type); |
709 | 750 |
return NULL; |
- « Previous
- 1
- 2
- Next »