Advertisement
Guest User

[dvblast-devel] DVB-T2 PLP support

a guest
Feb 12th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.37 KB | None | 0 0
  1. diff --git a/dvb.c b/dvb.c
  2. index 6873da4..1191ad9 100644
  3. --- a/dvb.c
  4. +++ b/dvb.c
  5. @@ -930,6 +930,26 @@ static struct dtv_properties dvbt_cmdseq = {
  6. .props = dvbt_cmdargs
  7. };
  8.  
  9. +static struct dtv_property dvbt2_cmdargs[] = {
  10. + { .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBT2 },
  11. + { .cmd = DTV_FREQUENCY, .u.data = 0 },
  12. + { .cmd = DTV_MODULATION, .u.data = QAM_AUTO },
  13. + { .cmd = DTV_INVERSION, .u.data = INVERSION_AUTO },
  14. + { .cmd = DTV_BANDWIDTH_HZ, .u.data = 8000000 },
  15. + { .cmd = DTV_CODE_RATE_HP, .u.data = FEC_AUTO },
  16. + { .cmd = DTV_CODE_RATE_LP, .u.data = FEC_AUTO },
  17. + { .cmd = DTV_GUARD_INTERVAL, .u.data = GUARD_INTERVAL_AUTO },
  18. + { .cmd = DTV_TRANSMISSION_MODE,.u.data = TRANSMISSION_MODE_AUTO },
  19. + { .cmd = DTV_HIERARCHY, .u.data = HIERARCHY_AUTO },
  20. + { .cmd = DTV_STREAM_ID, .u.data = 0 },
  21. + { .cmd = DTV_TUNE },
  22. +};
  23. +
  24. +static struct dtv_properties dvbt2_cmdseq = {
  25. + .num = sizeof(dvbt2_cmdargs)/sizeof(struct dtv_property),
  26. + .props = dvbt2_cmdargs
  27. +};
  28. +
  29. /* ATSC + DVB-C annex B */
  30. static struct dtv_property atsc_cmdargs[] = {
  31. { .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_ATSC },
  32. @@ -957,6 +977,7 @@ static struct dtv_properties atsc_cmdseq = {
  33. #define ROLLOFF 8
  34. #define MIS 9
  35. #define HIERARCHY 9
  36. +#define PLP_ID 10
  37.  
  38. struct dtv_property pclear[] = {
  39. { .cmd = DTV_CLEAR },
  40. @@ -972,6 +993,8 @@ FrontendGuessSystem( fe_delivery_system_t *p_systems, int i_systems )
  41. {
  42. if ( psz_delsys != NULL )
  43. {
  44. + if ( !strcasecmp( psz_delsys, "DVBT2" ) )
  45. + return SYS_DVBT2;
  46. if ( !strcasecmp( psz_delsys, "DVBS" ) )
  47. return SYS_DVBS;
  48. if ( !strcasecmp( psz_delsys, "DVBS2" ) )
  49. @@ -1000,6 +1023,10 @@ FrontendGuessSystem( fe_delivery_system_t *p_systems, int i_systems )
  50. {
  51. switch ( p_systems[i] )
  52. {
  53. + case SYS_DVBT2:
  54. + if ( i_frequency > 50000000 && (dvb_plp_id) )
  55. + return SYS_DVBT2;
  56. + break;
  57. case SYS_DVBS:
  58. if ( i_frequency < 50000000 )
  59. return SYS_DVBS;
  60. @@ -1018,7 +1045,7 @@ FrontendGuessSystem( fe_delivery_system_t *p_systems, int i_systems )
  61. break;
  62. #endif
  63. case SYS_DVBT:
  64. - if ( i_frequency > 50000000 )
  65. + if ( i_frequency > 50000000 && !(dvb_plp_id) )
  66. return SYS_DVBT;
  67. break;
  68. default:
  69. @@ -1137,6 +1164,28 @@ static void FrontendSet( bool b_init )
  70. i_guard, i_transmission );
  71. break;
  72.  
  73. + case SYS_DVBT2:
  74. + p = &dvbt2_cmdseq;
  75. + p->props[DELSYS].u.data = system;
  76. + p->props[FREQUENCY].u.data = i_frequency;
  77. + p->props[INVERSION].u.data = GetInversion();
  78. + if ( psz_modulation != NULL )
  79. + p->props[MODULATION].u.data = GetModulation();
  80. + p->props[BANDWIDTH].u.data = i_bandwidth * 1000000;
  81. + p->props[FEC_INNER].u.data = GetFECInner(info.caps);
  82. + p->props[FEC_LP].u.data = GetFECLP(info.caps);
  83. + p->props[GUARD].u.data = GetGuard();
  84. + p->props[TRANSMISSION].u.data = GetTransmission();
  85. + p->props[HIERARCHY].u.data = GetHierarchy();
  86. + p->props[PLP_ID].u.data = dvb_plp_id;
  87. +
  88. + msg_Dbg( NULL, "tuning DVB-T2 frontend to f=%d bandwidth=%d inversion=%d fec_hp=%d fec_lp=%d hierarchy=%d modulation=%s guard=%d transmission=%d PLP_ID=%d ",
  89. + i_frequency, i_bandwidth, i_inversion, i_fec, i_fec_lp,
  90. + i_hierarchy,
  91. + psz_modulation == NULL ? "qam_auto" : psz_modulation,
  92. + i_guard, i_transmission, p->props[PLP_ID].u.data );
  93. + break;
  94. +
  95. #if DVBAPI_VERSION >= 505
  96. case SYS_DVBC_ANNEX_A:
  97. #else
  98. diff --git a/dvblast.c b/dvblast.c
  99. index da2be3a..92c5d23 100644
  100. --- a/dvblast.c
  101. +++ b/dvblast.c
  102. @@ -64,6 +64,7 @@ int i_fenum = 0;
  103. int i_canum = 0;
  104. char *psz_delsys = NULL;
  105. int i_frequency = 0;
  106. +int dvb_plp_id = 0;
  107. int i_inversion = -1;
  108. int i_srate = 27500000;
  109. int i_fec = 999;
  110. @@ -578,6 +579,7 @@ void usage()
  111. msg_Raw( NULL, " -r --remote-socket <remote socket>" );
  112. msg_Raw( NULL, " -V --version only display the version" );
  113. msg_Raw( NULL, " -Z --mrtg-file <file> Log input packets and errors into mrtg-file" );
  114. + msg_Raw( NULL, " -9 --dvb-plp-id <number> Switch PLP of the DVB-T2 transmission (for Russia special)" );
  115. exit(1);
  116. }
  117.  
  118. @@ -600,7 +602,7 @@ int main( int i_argc, char **pp_argv )
  119. usage();
  120.  
  121. /*
  122. - * The only short options left are: 346789
  123. + * The only short options left are: 34678
  124. * Use them wisely.
  125. */
  126. static const struct option long_options[] =
  127. @@ -613,6 +615,7 @@ int main( int i_argc, char **pp_argv )
  128. { "adapter", required_argument, NULL, 'a' },
  129. { "frontend-number", required_argument, NULL, 'n' },
  130. { "delsys", required_argument, NULL, '5' },
  131. + { "dvb-plp-id", required_argument, NULL, '9' },
  132. { "frequency", required_argument, NULL, 'f' },
  133. { "fec-inner", required_argument, NULL, 'F' },
  134. { "rolloff", required_argument, NULL, 'R' },
  135. @@ -664,7 +667,7 @@ int main( int i_argc, char **pp_argv )
  136. { 0, 0, 0, 0 }
  137. };
  138.  
  139. - while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:5:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:y:0:1:2:", long_options, NULL)) != -1 )
  140. + while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:5:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:y:0:1:2:9:", long_options, NULL)) != -1 )
  141. {
  142. switch ( c )
  143. {
  144. @@ -738,6 +741,10 @@ int main( int i_argc, char **pp_argv )
  145. psz_delsys = optarg;
  146. break;
  147.  
  148. + case '9':
  149. + dvb_plp_id = strtol( optarg, NULL, 0 );
  150. + break;
  151. +
  152. case 'f':
  153. if (optarg && optarg[0] != '-')
  154. i_frequency = strtol( optarg, NULL, 0 );
  155. diff --git a/dvblast.h b/dvblast.h
  156. index fbd62a8..a94151b 100644
  157. --- a/dvblast.h
  158. +++ b/dvblast.h
  159. @@ -203,6 +203,7 @@ extern int i_canum;
  160. extern char *psz_delsys;
  161. extern int i_dvr_buffer_size;
  162. extern int i_frequency;
  163. +extern int dvb_plp_id;
  164. extern int i_srate;
  165. extern int i_satnum;
  166. extern int i_uncommitted;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement