Ticket #5403: mythtv_multiproto.5.patch
File mythtv_multiproto.5.patch, 26.0 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/dtvconfparserhelpers.h
33 33 #define _DTVCONFPARSERHELPERS_H_ 34 34 35 35 #include <qstring.h> 36 #include "dvbtypes.h" 36 37 37 38 // The following are a set of helper classes to allow easy translation 38 39 // between the different string representations of various tuning params. … … 191 192 static const DTVParamHelperStruct confTable[]; 192 193 static const DTVParamHelperStruct vdrTable[]; 193 194 static const DTVParamHelperStruct parseTable[]; 195 #ifdef DVB_API_MULTIPROTO 196 static const uint kDBStrCnt = 15; 197 #else 194 198 static const uint kDBStrCnt = 10; 199 #endif 195 200 static const char *dbStr[kDBStrCnt]; 196 201 197 202 public: 198 203 enum 199 204 { 205 #ifdef DVB_API_MULTIPROTO 200 206 kFECNone, 207 kFEC_1_4, 208 kFEC_1_3, 209 kFEC_2_5, 201 210 kFEC_1_2, 211 kFEC_3_5, 202 212 kFEC_2_3, 203 213 kFEC_3_4, 204 214 kFEC_4_5, … … 206 216 kFEC_6_7, 207 217 kFEC_7_8, 208 218 kFEC_8_9, 219 kFEC_9_10, 209 220 kFECAuto, 221 #else 222 kFECNone, 223 kFEC_1_2, 224 kFEC_2_3, 225 kFEC_3_4, 226 kFEC_4_5, 227 kFEC_5_6, 228 kFEC_6_7, 229 kFEC_7_8, 230 kFEC_8_9, 231 kFECAuto, 232 #endif 210 233 }; 211 234 212 235 DTVCodeRate(int _default = kFECAuto) : DTVParamHelper(_default) { } -
libs/libmythtv/dtvconfparserhelpers.cpp
145 145 146 146 const DTVParamHelperStruct DTVCodeRate::confTable[] = 147 147 { 148 #ifdef DVB_API_MULTIPROTO 149 { "DVBFE_FEC_AUTO", kFECAuto }, 150 { "DVBFE_FEC_1_4", kFEC_1_4 }, 151 { "DVBFE_FEC_1_3", kFEC_1_3 }, 152 { "DVBFE_FEC_2_5", kFEC_2_5 }, 153 { "DVBFE_FEC_1_2", kFEC_1_2 }, 154 { "DVBFE_FEC_3_5", kFEC_3_5 }, 155 { "DVBFE_FEC_2_3", kFEC_2_3 }, 156 { "DVBFE_FEC_3_4", kFEC_3_4 }, 157 { "DVBFE_FEC_4_5", kFEC_4_5 }, 158 { "DVBFE_FEC_5_6", kFEC_5_6 }, 159 { "DVBFE_FEC_6_7", kFEC_6_7 }, 160 { "DVBFE_FEC_7_8", kFEC_7_8 }, 161 { "DVBFE_FEC_8_9", kFEC_8_9 }, 162 { "DVBFE_FEC_9_10", kFEC_9_10 }, 163 { "DVBFE_FEC_NONE", kFECNone }, 164 { NULL, kFECAuto }, 165 #else 148 166 { "FEC_AUTO", kFECAuto }, 149 167 { "FEC_1_2", kFEC_1_2 }, 150 168 { "FEC_2_3", kFEC_2_3 }, … … 156 174 { "FEC_8_9", kFEC_8_9 }, 157 175 { "FEC_NONE", kFECNone }, 158 176 { NULL, kFECAuto }, 177 #endif 159 178 }; 160 179 161 180 const DTVParamHelperStruct DTVCodeRate::vdrTable[] = 162 181 { 163 182 { "999", kFECAuto }, 183 { "14", kFEC_1_4 }, 184 { "13", kFEC_1_3 }, 185 { "25", kFEC_2_5 }, 164 186 { "12", kFEC_1_2 }, 187 { "35", kFEC_3_5 }, 165 188 { "23", kFEC_2_3 }, 166 189 { "34", kFEC_3_4 }, 167 190 { "45", kFEC_4_5 }, … … 169 192 { "67", kFEC_6_7 }, 170 193 { "78", kFEC_7_8 }, 171 194 { "89", kFEC_8_9 }, 195 { "910", kFEC_9_10 }, 172 196 { "0", kFECNone }, 173 197 { NULL, kFECAuto } 174 198 }; … … 176 200 const DTVParamHelperStruct DTVCodeRate::parseTable[] = 177 201 { 178 202 { "auto", kFECAuto }, 203 { "1/4", kFEC_1_4 }, 204 { "1/3", kFEC_1_3 }, 205 { "2/5", kFEC_2_5 }, 179 206 { "1/2", kFEC_1_2 }, 207 { "3/5", kFEC_3_5 }, 180 208 { "2/3", kFEC_2_3 }, 181 209 { "3/4", kFEC_3_4 }, 182 210 { "4/5", kFEC_4_5 }, … … 184 212 { "6/7", kFEC_6_7 }, 185 213 { "7/8", kFEC_7_8 }, 186 214 { "8/9", kFEC_8_9 }, 215 { "9/10", kFEC_9_10}, 187 216 { "none", kFECNone }, 188 217 { NULL, kFECAuto } 189 218 }; … … 191 220 const char *DTVCodeRate::dbStr[DTVCodeRate::kDBStrCnt] = 192 221 { 193 222 "none", ///< kFECNone 223 "1/4", ///< kFEC_1_4 224 "1/3", ///< kFEC_1_3 225 "2/5", ///< kFEC_2_5 194 226 "1/2", ///< kFEC_1_2 227 "3/5", ///< kFEC_3_5 195 228 "2/3", ///< kFEC_2_3 196 229 "3/4", ///< kFEC_3_4 197 230 "4/5", ///< kFEC_4_5 … … 199 232 "6/7", ///< kFEC_6_7 200 233 "7/8", ///< kFEC_7_8 201 234 "8/9", ///< kFEC_8_9 202 "auto" ///< kFECAuto 235 "9/10", ///< kFEC_9_10 236 "auto", ///< kFECAuto 203 237 }; 204 238 205 239 const DTVParamHelperStruct DTVModulation::confTable[] = -
libs/libmythtv/dtvmultiplex.h
15 15 16 16 // MythTV headers 17 17 #include "dtvconfparserhelpers.h" 18 #include "dvbtypes.h" 18 19 19 20 class DTVMultiplex 20 21 { -
libs/libmythtv/scanwizardhelpers.h
536 536 addSelection("6/7"); 537 537 addSelection("7/8"); 538 538 addSelection("8/9"); 539 #ifdef DVB_API_MULTIPROTO 540 addSelection("1/4"); 541 addSelection("1/3"); 542 addSelection("2/5"); 543 addSelection("3/5"); 544 addSelection("9/10"); 545 #endif 539 546 } 540 547 }; 541 548 -
libs/libmythtv/dvbchannel.h
100 100 int GetChanID(void) const; 101 101 102 102 void CheckOptions(DTVMultiplex &t) const; 103 #ifdef DVB_API_MULTIPROTO 104 bool ReadTunerCapabilities(const DTVMultiplex &t); 105 #endif 103 106 bool CheckModulation(DTVModulation modulation) const; 104 107 bool CheckCodeRate(DTVCodeRate rate) const; 105 108 … … 117 120 QString frontend_name; 118 121 DTVTunerType card_type; 119 122 uint64_t capabilities; 120 uint64_t ext_modulations;123 uint64_t delivery; 121 124 uint64_t frequency_minimum; 122 125 uint64_t frequency_maximum; 123 126 uint symbol_rate_minimum; -
libs/libmythtv/dvbtypes.h
39 39 # define VSB_16 (fe_modulation)(QAM_AUTO+2) 40 40 #endif 41 41 42 #ifdef FE_GET_EXTENDED_INFO 43 #define dvb_fe_params dvb_frontend_parameters_new 44 #else 45 #define dvb_fe_params dvb_frontend_parameters 42 #if (DVB_API_VERSION >= 3 && DVB_API_VERSION_MINOR >= 3) 43 # define DVB_API_MULTIPROTO 46 44 #endif 47 45 48 46 class QString; -
libs/libmythtv/dvbchannel.cpp
1 /* 1 /* 2 2 * Class DVBChannel 3 3 * 4 4 * Copyright (C) Kenneth Aafloy 2003 … … 50 50 51 51 static void drain_dvb_events(int fd); 52 52 static bool wait_for_backend(int fd, int timeout_ms); 53 static struct dvb_f e_params dtvmultiplex_to_dvbparams(53 static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams( 54 54 DTVTunerType, const DTVMultiplex&); 55 55 static DTVMultiplex dvbparams_to_dtvmultiplex( 56 DTVTunerType, const dvb_fe_params&); 57 56 DTVTunerType, const dvb_frontend_parameters&); 57 #ifdef DVB_API_MULTIPROTO 58 static DTVMultiplex dvbparams_to_dtvmultiplex(const dvbfe_params&); 59 #endif 58 60 #define LOC QString("DVBChan(%1:%2): ").arg(GetCardID()).arg(cardnum) 59 61 #define LOC_WARN QString("DVBChan(%1:%2) Warning: ") \ 60 62 .arg(GetCardID()).arg(cardnum) 61 63 #define LOC_ERR QString("DVBChan(%1:%2) Error: ").arg(GetCardID()).arg(cardnum) 62 64 63 65 /** \class DVBChannel 64 * \brief Provides interface to the tuning hardware when using DVBdrivers66 * \brief Provides interface to the tuning hardware when drivers 65 67 * 66 68 * \bug Only supports single input cards. 67 69 */ … … 168 170 frontend_name = master->frontend_name; 169 171 card_type = master->card_type; 170 172 capabilities = master->capabilities; 171 ext_modulations = master->ext_modulations;173 delivery = master->delivery; 172 174 frequency_minimum = master->frequency_minimum; 173 175 frequency_maximum = master->frequency_maximum; 174 176 symbol_rate_minimum = master->symbol_rate_minimum; … … 198 200 return false; 199 201 } 200 202 203 VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.") 204 .arg(cardnum).arg(frontend_name)); 205 206 #ifdef DVB_API_MULTIPROTO 207 if (ioctl(fd_frontend, DVBFE_GET_DELSYS, &delivery) < 0) 208 { 209 VERBOSE(VB_IMPORTANT, LOC_ERR + 210 "Failed to get frontend delivery." + ENO); 211 212 close(fd_frontend); 213 fd_frontend = -1; 214 return false; 215 } 216 if (DVBFE_DELSYS_DVBS2 == (delivery & DVBFE_DELSYS_DVBS2)){ 217 card_type = DTVTunerType::kTunerTypeDVB_S2; 218 } else if (DVBFE_DELSYS_DVBS == (delivery & DVBFE_DELSYS_DVBS)){ 219 card_type = DTVTunerType::kTunerTypeQPSK; 220 } else { 221 VERBOSE(VB_IMPORTANT, LOC_ERR + 222 "Tuner does not support DVB-S/DVB-S2." + ENO); 223 close(fd_frontend); 224 fd_frontend = -1; 225 return false; 226 } 227 #else 201 228 dvb_frontend_info info; 202 229 bzero(&info, sizeof(info)); 203 230 if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0) … … 209 236 fd_frontend = -1; 210 237 return false; 211 238 } 212 213 #ifdef FE_GET_EXTENDED_INFO 214 if (info.caps & FE_HAS_EXTENDED_INFO) 215 { 216 bool ok = true; 217 dvb_fe_caps_extended extinfo; 218 bzero(&extinfo, sizeof(extinfo)); 219 if (ioctl(fd_frontend, FE_GET_EXTENDED_INFO, &extinfo) < 0) 220 { 221 VERBOSE(VB_IMPORTANT, LOC_ERR + 222 "Failed to get frontend extended information." + ENO); 223 224 ok = false; 225 } 226 227 if (ok && (extinfo.modulations & MOD_8PSK)) 228 { 229 if (ioctl(fd_frontend, FE_SET_STANDARD, FE_DVB_S2) < 0) 230 { 231 VERBOSE(VB_IMPORTANT, LOC_ERR + 232 "Failed to set frontend standard to DVB-S2." + ENO); 233 234 ok = false; 235 } 236 else if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0) 237 { 238 VERBOSE(VB_IMPORTANT, LOC_ERR + 239 "Failed to get frontend information." + ENO); 240 241 ok = false; 242 } 243 } 244 245 if (!ok) 246 { 247 close(fd_frontend); 248 fd_frontend = -1; 249 return false; 250 } 251 252 ext_modulations = extinfo.modulations; 253 } 254 #endif 255 239 card_type = info.type; 240 capabilities = info.caps; 256 241 frontend_name = info.name; 257 card_type = info.type;258 capabilities = info.caps;259 242 frequency_minimum = info.frequency_min; 260 243 frequency_maximum = info.frequency_max; 261 244 symbol_rate_minimum = info.symbol_rate_min; 262 245 symbol_rate_maximum = info.symbol_rate_max; 246 #endif 263 247 264 VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.")265 .arg(cardnum).arg(frontend_name));266 267 248 // Turn on the power to the LNB 268 249 if (card_type == DTVTunerType::kTunerTypeQPSK || 269 250 card_type == DTVTunerType::kTunerTypeDVB_S2) … … 312 293 if (!tuning.FillFromDB(card_type, mplexid)) 313 294 return false; 314 295 296 #ifdef DVB_API_MULTIPROTO 297 if (!ReadTunerCapabilities(tuning)){ 298 VERBOSE(VB_GENERAL, LOC_WARN + 299 "Unable to read tuner capabilities."); 300 } 301 #endif 315 302 CheckOptions(tuning); 316 303 317 304 return Tune(tuning, inputname); … … 402 389 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num); 403 390 404 391 // Try to fix any problems with the multiplex 392 #ifdef DVB_API_MULTIPROTO 393 if (!ReadTunerCapabilities(tuning)){ 394 VERBOSE(VB_GENERAL, LOC_WARN + 395 "Unable to read tuner capabilities."); 396 } 397 #endif 405 398 CheckOptions(tuning); 406 399 407 400 if (!Tune(tuning, inputid)) … … 463 456 */ 464 457 void DVBChannel::CheckOptions(DTVMultiplex &tuning) const 465 458 { 459 466 460 if ((tuning.inversion == DTVInversion::kInversionAuto) && 467 461 !(capabilities & FE_CAN_INVERSION_AUTO)) 468 462 { … … 593 587 { 594 588 const DTVModulation m = modulation; 595 589 const uint64_t c = capabilities; 596 597 #ifdef FE_GET_EXTENDED_INFO 598 if ((c & FE_HAS_EXTENDED_INFO) && 599 (DTVModulation::kModulation8PSK == m) && 600 (ext_modulations & DTVModulation::kModulation8PSK)) 601 { 602 return true; 603 } 604 #endif // FE_GET_EXTENDED_INFO 605 590 606 591 return 607 592 ((DTVModulation::kModulationQPSK == m) && (c & FE_CAN_QPSK)) || 608 593 ((DTVModulation::kModulationQAM16 == m) && (c & FE_CAN_QAM_16)) || … … 669 654 bool same_input) 670 655 { 671 656 QMutexLocker lock(&tune_lock); 672 673 657 if (master) 674 658 { 675 659 VERBOSE(VB_CHANNEL, LOC + "tuning on slave channel"); … … 678 662 } 679 663 680 664 bool reset = (force_reset || first_tune); 681 struct dvb_f e_params params = dtvmultiplex_to_dvbparams(card_type, tuning);665 struct dvb_frontend_parameters params = dtvmultiplex_to_dvbparams(card_type, tuning); 682 666 683 bool is_dvbs = (DTVTunerType::kTunerTypeQPSK == card_type || 684 DTVTunerType::kTunerTypeDVB_S2 == card_type); 685 667 bool is_dvbs = (DTVTunerType::kTunerTypeQPSK == card_type || DTVTunerType::kTunerTypeDVB_S2 == card_type); 668 686 669 bool has_diseqc = (diseqc_tree != NULL); 687 670 if (is_dvbs && !has_diseqc) 688 671 { … … 701 684 702 685 return false; 703 686 } 704 705 687 // Remove any events in queue before tuning. 706 688 drain_dvb_events(fd_frontend); 707 689 … … 711 693 // configure for new input 712 694 if (!same_input) 713 695 diseqc_settings.Load(inputid); 714 715 696 // execute diseqc commands 716 697 if (!diseqc_tree->Execute(diseqc_settings, tuning)) 717 698 { … … 719 700 "Failed to setup DiSEqC devices"); 720 701 return false; 721 702 } 722 723 703 // retrieve actual intermediate frequency 724 704 DiSEqCDevLNB *lnb = diseqc_tree->FindLNB(diseqc_settings); 725 705 if (!lnb) … … 752 732 // DVB-S is in kHz, other DVB is in Hz 753 733 int freq_mult = (is_dvbs) ? 1 : 1000; 754 734 QString suffix = (is_dvbs) ? "kHz" : "Hz"; 755 735 756 736 if (reset || !prev_tuning.IsEqual(card_type, tuning, 500 * freq_mult)) 757 737 { 758 738 VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning to %1%2") 759 739 .arg(params.frequency).arg(suffix)); 760 740 761 #ifdef FE_GET_EXTENDED_INFO 762 if (card_type == DTVTunerType::kTunerTypeDVB_S2) 763 { 764 if (ioctl(fd_frontend, FE_SET_FRONTEND2, ¶ms) < 0) 765 { 766 VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " + 767 "Setting Frontend(2) tuning parameters failed." + ENO); 768 return false; 769 } 741 #ifdef DVB_API_MULTIPROTO 742 if (card_type == DTVTunerType::kTunerTypeQPSK || card_type == DTVTunerType::kTunerTypeDVB_S2){ 743 struct dvbfe_params fe_params; 744 struct dvbfe_params fe_cur_params; 745 746 if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &fe_cur_params) < 0) 747 { 748 VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " + 749 "Getting frontend tuning parameters failed." + ENO); 750 return false; 751 } 752 753 fe_params.frequency = params.frequency; 754 fe_params.inversion = INVERSION_AUTO; 755 if (tuning.modulation == DTVModulation::kModulation8PSK){ 756 fe_params.delsys.dvbs2.symbol_rate = tuning.symbolrate; 757 fe_params.delsys.dvbs2.fec = DVBFE_FEC_AUTO; 758 fe_params.delsys.dvbs2.modulation = DVBFE_MOD_8PSK; 759 fe_params.delivery = DVBFE_DELSYS_DVBS2; 760 } else{ 761 fe_params.delsys.dvbs.symbol_rate = tuning.symbolrate; 762 fe_params.delsys.dvbs.fec = DVBFE_FEC_AUTO; 763 fe_params.delsys.dvbs.modulation = DVBFE_MOD_QPSK; 764 fe_params.delivery = DVBFE_DELSYS_DVBS; 765 } 766 767 if (fe_cur_params.delivery != fe_params.delivery){ 768 if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &fe_params.delivery) < 0){ 769 VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " + 770 "Setting Frontend delivery failed." + ENO); 771 return false; 770 772 } 771 else 772 #endif // FE_GET_EXTENDED_INFO 773 { 773 } 774 775 if (ioctl(fd_frontend, DVBFE_SET_PARAMS, &fe_params) < 0){ 776 VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " + 777 "Setting Frontend tuning parameters failed." + ENO); 778 return false; 779 } 780 781 } 782 else 783 #endif 774 784 if (ioctl(fd_frontend, FE_SET_FRONTEND, ¶ms) < 0) 775 785 { 776 786 VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " + 777 787 "Setting Frontend tuning parameters failed." + ENO); 778 788 return false; 779 789 } 780 }781 782 790 // Extra delay to add for broken DVB drivers 783 791 if (tuning_delay) 784 792 usleep(tuning_delay * 1000); … … 831 839 return false; 832 840 } 833 841 834 dvb_f e_params params;842 dvb_frontend_parameters params; 835 843 return ioctl(fd_frontend, FE_GET_FRONTEND, ¶ms) >= 0; 836 844 } 837 845 … … 845 853 bool DVBChannel::ProbeTuningParams(DTVMultiplex &tuning) const 846 854 { 847 855 QMutexLocker locker(&hw_lock); 856 uint mplex; 857 QString sistandard; 848 858 849 859 if (fd_frontend < 0) 850 860 { … … 864 874 return false; 865 875 } 866 876 867 dvb_fe_params params; 868 if (ioctl(fd_frontend, FE_GET_FRONTEND, ¶ms) < 0) 877 #ifdef DVB_API_MULTIPROTO 878 if (card_type == DTVTunerType::kTunerTypeQPSK || card_type == DTVTunerType::kTunerTypeDVB_S2){ 879 struct dvbfe_params params; 880 if (ioctl(fd_frontend, DVBFE_GET_PARAMS, ¶ms) < 0){ 881 VERBOSE(VB_IMPORTANT, LOC_ERR + 882 "Getting Frontend (multiproto) tuning parameters failed." + ENO); 883 884 return false; 885 } 886 mplex = tuning.mplex; 887 sistandard = QDeepCopy<QString>(tuning.sistandard); 888 tuning = dvbparams_to_dtvmultiplex(params); 889 } 890 else 891 #endif 869 892 { 893 struct dvb_frontend_parameters params; 894 if (ioctl(fd_frontend, FE_GET_FRONTEND, ¶ms) < 0){ 870 895 VERBOSE(VB_IMPORTANT, LOC_ERR + 871 896 "Getting Frontend tuning parameters failed." + ENO); 872 897 873 898 return false; 899 } 900 mplex = tuning.mplex; 901 sistandard = QDeepCopy<QString>(tuning.sistandard); 902 tuning = dvbparams_to_dtvmultiplex(card_type, params); 874 903 } 875 876 uint mplex = tuning.mplex;877 QString sistandard = QDeepCopy<QString>(tuning.sistandard);878 879 tuning = dvbparams_to_dtvmultiplex(card_type, params);880 881 904 tuning.mplex = mplex; 882 905 tuning.sistandard = sistandard; 883 906 … … 1069 1092 if (ioctl(fd, FE_READ_STATUS, &status) < 0) 1070 1093 { 1071 1094 VERBOSE(VB_IMPORTANT, QString("dvbchannel.cpp:wait_for_backend: " 1072 "Failed to get status, error: %1")1095 "Failed to , error: %1") 1073 1096 .arg(strerror(errno))); 1074 1097 return false; 1075 1098 } … … 1079 1102 return true; 1080 1103 } 1081 1104 1082 static struct dvb_f e_params dtvmultiplex_to_dvbparams(1105 static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams( 1083 1106 DTVTunerType tuner_type, const DTVMultiplex &tuning) 1084 1107 { 1085 dvb_f e_params params;1108 dvb_frontend_parameters params; 1086 1109 bzero(¶ms, sizeof(params)); 1087 1110 1088 1111 params.frequency = tuning.frequency; 1089 1112 params.inversion = (fe_spectral_inversion_t) (int) tuning.inversion; 1090 1113 1091 if (DTVTunerType::kTunerTypeQPSK == tuner_type )1114 if (DTVTunerType::kTunerTypeQPSK == tuner_type || tuner_type == DTVTunerType::kTunerTypeDVB_S2) 1092 1115 { 1093 1116 params.u.qpsk.symbol_rate = tuning.symbolrate; 1094 1117 params.u.qpsk.fec_inner = (fe_code_rate_t) (int) tuning.fec; 1095 1118 } 1096 1119 1097 if (DTVTunerType::kTunerTypeDVB_S2 == tuner_type)1098 {1099 #ifdef FE_GET_EXTENDED_INFO1100 params.u.qpsk2.symbol_rate = tuning.symbolrate;1101 params.u.qpsk2.fec_inner = (fe_code_rate_t) (int) tuning.fec;1102 params.u.qpsk2.modulation = (fe_modulation_t) (int) tuning.modulation;1103 #else // if !FE_GET_EXTENDED_INFO1104 VERBOSE(VB_IMPORTANT, "DVBChan Error, MythTV was compiled without "1105 "DVB-S2 headers being present so DVB-S2 tuning will fail.");1106 #endif // !FE_GET_EXTENDED_INFO1107 }1108 1109 1120 if (DTVTunerType::kTunerTypeQAM == tuner_type) 1110 1121 { 1111 1122 params.u.qam.symbol_rate = tuning.symbolrate; … … 1143 1154 } 1144 1155 1145 1156 static DTVMultiplex dvbparams_to_dtvmultiplex( 1146 DTVTunerType tuner_type, const dvb_f e_params ¶ms)1157 DTVTunerType tuner_type, const dvb_frontend_parameters ¶ms) 1147 1158 { 1148 1159 DTVMultiplex tuning; 1149 1160 1150 1161 tuning.frequency = params.frequency; 1151 1162 tuning.inversion = params.inversion; 1152 1163 1153 if ((DTVTunerType::kTunerTypeQPSK == tuner_type) || 1154 (DTVTunerType::kTunerTypeDVB_S2 == tuner_type)) 1164 if (DTVTunerType::kTunerTypeQPSK == tuner_type) 1155 1165 { 1156 1166 tuning.symbolrate = params.u.qpsk.symbol_rate; 1157 1167 tuning.fec = params.u.qpsk.fec_inner; … … 1184 1194 1185 1195 return tuning; 1186 1196 } 1197 1198 #ifdef DVB_API_MULTIPROTO 1199 1200 static DTVMultiplex dvbparams_to_dtvmultiplex(const dvbfe_params ¶ms){ 1201 1202 DTVMultiplex tuning; 1203 1204 tuning.frequency = params.frequency; 1205 tuning.inversion = params.inversion; 1206 1207 switch(params.delivery){ 1208 case DVBFE_DELSYS_DVBS: 1209 { 1210 tuning.symbolrate = params.delsys.dvbs.symbol_rate; 1211 tuning.fec = params.delsys.dvbs.fec; 1212 } 1213 break; 1214 case DVBFE_DELSYS_DVBS2: 1215 { 1216 tuning.symbolrate = params.delsys.dvbs2.symbol_rate; 1217 tuning.fec = params.delsys.dvbs2.fec; 1218 } 1219 break; 1220 } 1221 return tuning; 1222 } 1223 1224 bool DVBChannel::ReadTunerCapabilities(const DTVMultiplex &tuning){ 1225 1226 enum dvbfe_delsys d; 1227 switch(tuning.modulation){ 1228 case DTVModulation::kModulation8PSK: 1229 d = DVBFE_DELSYS_DVBS2; 1230 break; 1231 case DTVModulation::kModulationQPSK: 1232 d = DVBFE_DELSYS_DVBS; 1233 break; 1234 default: 1235 VERBOSE(VB_IMPORTANT, LOC_ERR + 1236 "Failed to determine frontend delivery."); 1237 return false; 1238 break; 1239 } 1240 1241 struct dvbfe_params params; 1242 if (ioctl(fd_frontend, DVBFE_GET_PARAMS, ¶ms) < 0) { 1243 if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &d) < 0){ 1244 VERBOSE(VB_IMPORTANT, LOC_ERR + 1245 "Failed to set frontend delivery." + ENO); 1246 return false; 1247 } 1248 if (ioctl(fd_frontend, DVBFE_GET_PARAMS, ¶ms) < 0) { 1249 VERBOSE(VB_IMPORTANT, LOC_ERR + 1250 QString("Failed to get frontend parameters for DVB-S/S2 frontend (%1) .").arg(fd_frontend) + ENO); 1251 return false; 1252 } 1253 } 1254 if (params.delivery != d){ 1255 if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &d) < 0){ 1256 VERBOSE(VB_IMPORTANT, LOC_ERR + 1257 "Failed to set frontend delivery." + ENO); 1258 return false; 1259 } 1260 } 1261 1262 struct dvbfe_info info; 1263 if (ioctl(fd_frontend, DVBFE_GET_INFO, &info) < 0){ 1264 VERBOSE(VB_IMPORTANT, LOC_ERR + 1265 "Failed to get frontend information for DVB-S frontend." + ENO); 1266 return false; 1267 } 1268 1269 capabilities = FEC_NONE; 1270 1271 dvbfe_modulation m; 1272 m = info.delsys.dvbs.modulation; 1273 if (m & DVBFE_MOD_QPSK) { capabilities |= FE_CAN_QPSK; } 1274 if (m & DVBFE_MOD_QAM16) { capabilities |= FE_CAN_QAM_16; } 1275 if (m & DVBFE_MOD_QAM32) { capabilities |= FE_CAN_QAM_32; } 1276 if (m & DVBFE_MOD_QAM64) { capabilities |= FE_CAN_QAM_64; } 1277 if (m & DVBFE_MOD_QAM128) { capabilities |= FE_CAN_QAM_128; } 1278 if (m & DVBFE_MOD_QAM256) { capabilities |= FE_CAN_QAM_256; } 1279 if (m & DVBFE_MOD_QAMAUTO) { capabilities |= FE_CAN_QAM_AUTO; } 1280 1281 dvbfe_fec f; 1282 f = info.delsys.dvbs.fec; 1283 if (f & DVBFE_FEC_1_2) { capabilities |= FE_CAN_FEC_1_2; } 1284 if (f & DVBFE_FEC_2_3) { capabilities |= FE_CAN_FEC_2_3; } 1285 if (f & DVBFE_FEC_3_4) { capabilities |= FE_CAN_FEC_3_4; } 1286 if (f & DVBFE_FEC_4_5) { capabilities |= FE_CAN_FEC_4_5; } 1287 if (f & DVBFE_FEC_5_6) { capabilities |= FE_CAN_FEC_5_6; } 1288 if (f & DVBFE_FEC_6_7) { capabilities |= FE_CAN_FEC_6_7; } 1289 if (f & DVBFE_FEC_7_8) { capabilities |= FE_CAN_FEC_7_8; } 1290 if (f & DVBFE_FEC_8_9) { capabilities |= FE_CAN_FEC_8_9; } 1291 if (f & DVBFE_FEC_AUTO) { capabilities |= FE_CAN_FEC_AUTO;} 1292 1293 fe_spectral_inversion_t i; 1294 i = info.inversion; 1295 if ((i & INVERSION_AUTO) || i == 0) { capabilities |= FE_CAN_INVERSION_AUTO; } 1296 1297 frontend_name = info.name; 1298 frequency_minimum = info.frequency_min; 1299 frequency_maximum = info.frequency_max; 1300 symbol_rate_minimum = info.symbol_rate_min; 1301 symbol_rate_maximum = info.symbol_rate_max; 1302 1303 return true; 1304 } 1305 #endif -
libs/libmythtv/transporteditor.cpp
38 38 #include "cardutil.h" 39 39 #include "mythcontext.h" 40 40 #include "mythdbcon.h" 41 #include "dvbtypes.h" 41 42 42 43 #define LOC QString("DTVMux: ") 43 44 #define LOC_ERR QString("DTVMux, Error: ") … … 505 506 if (CardUtil::QPSK == nType) 506 507 { 507 508 // no modulation options 508 setVisible(false); 509 //setVisible(false); 510 addSelection("QPSK", "qpsk"); 511 addSelection("8PSK", "8psk"); 509 512 } 510 513 else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType)) 511 514 { … … 582 585 addSelection("6/7"); 583 586 addSelection("7/8"); 584 587 addSelection("8/9"); 588 #ifdef DVB_API_MULTIPROTO 589 addSelection("1/4"); 590 addSelection("1/3"); 591 addSelection("2/5"); 592 addSelection("3/5"); 593 addSelection("9/10"); 594 #endif 585 595 }; 586 596 }; 587 597 … … 710 720 left->addChild(new DTVStandard(id, true, false)); 711 721 left->addChild(new Frequency(id, true)); 712 722 left->addChild(new DVBSymbolRate(id)); 723 left->addChild(new Modulation(id, nType)); 713 724 714 725 right = new VerticalConfigurationGroup(false, true, false, false); 715 726 right->addChild(new DVBInversion(id)); -
libs/libmythtv/dtvmultiplex.cpp
180 180 181 181 if (ok) 182 182 frequency = _frequency.toInt(&ok); 183 183 184 184 return ok; 185 185 } 186 186