Hi Steve and others,I was quite busy recently and only found now the time to do what I should have done some time ago as it turned out. I could beat myself.
When I checked how DVB-T is now implemented I saw that there is one thing which was wrong in the DVBv3 API already and is still in DVBv5.
It is regarding hierarchical transmissions and the selection of high-priority and low-priority streams. This was not possible with DVBv3.
I quickly changed how I think it should be done and the resulting patch can be found attached.
The worst is, that this patch changes the frontend.h and thus the user interface. I put some comments in the code I wrote which hopefully helps to understand why I think this is necessary.
I hope it is not too late to apply this and to go for 2.6.28 . If it is, my bad and everyone can blame me for not having a proper hierarchical mode implemented.
Sorry again, Patrick. -- Mail: patrick.boettcher@xxxxxxx WWW: http://www.wi-bw.tfh-wildau.de/~pboettch/
diff -r e2a8b9b9c294 linux/drivers/media/dvb/dvb-core/dvb_frontend.c --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c Fri Oct 17 19:45:55 2008 +0300 +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c Sun Oct 19 18:42:53 2008 +0200 @@ -845,6 +845,7 @@ .cmd = DTV_DELIVERY_SYSTEM, .set = 1, }, + [DTV_HIERARCHY] = { .name = "DTV_HIERARCHY", .cmd = DTV_HIERARCHY, @@ -862,16 +863,6 @@ .set = 1, }, #endif - [DTV_CODE_RATE_HP] = { - .name = "DTV_CODE_RATE_HP", - .cmd = DTV_CODE_RATE_HP, - .set = 1, - }, - [DTV_CODE_RATE_LP] = { - .name = "DTV_CODE_RATE_LP", - .cmd = DTV_CODE_RATE_LP, - .set = 1, - }, [DTV_GUARD_INTERVAL] = { .name = "DTV_GUARD_INTERVAL", .cmd = DTV_GUARD_INTERVAL, @@ -882,6 +873,7 @@ .cmd = DTV_TRANSMISSION_MODE, .set = 1, }, + /* Get */ [DTV_DISEQC_SLAVE_REPLY] = { .name = "DTV_DISEQC_SLAVE_REPLY", @@ -961,10 +953,15 @@ .cmd = DTV_TRANSMISSION_MODE, .set = 0, }, - [DTV_HIERARCHY] = { + [DTV_HIERARCHY] = { /* is this a hierarchical transmission - boolean*/ .name = "DTV_HIERARCHY", .cmd = DTV_HIERARCHY, .set = 0, + }, + [DTV_ALPHA] = { + .name = "DTV_ALPHA", + .cmd = DTV_ALPHA, + .set = 0, }, }; @@ -1043,14 +1040,49 @@ else /* Including BANDWIDTH_AUTO */ c->bandwidth_hz = 0; - c->code_rate_HP = p->u.ofdm.code_rate_HP; - c->code_rate_LP = p->u.ofdm.code_rate_LP; + c->modulation = p->u.ofdm.constellation; c->transmission_mode = p->u.ofdm.transmission_mode; c->guard_interval = p->u.ofdm.guard_interval; - c->hierarchy = p->u.ofdm.hierarchy_information; + + if (p->u.ofdm.hierarchy_information== HIERARCHY_AUTO || + p->u.ofdm.hierarchy_information == HIERARCHY_NONE) { + c->fec_inner = p->u.ofdm.code_rate_HP; + c->hierarchy = 0; + c->stream_selection = 1; + c->alpha = 1; + } else { + + /* the previous channel descriptor does not + * really support hierarchy, that's why we can + * assume HP as selected here - closest to + * previous behaviour */ + c->fec_inner = p->u.ofdm.code_rate_HP; + + c->hierarchy = 1; + c->stream_selection = 1; + switch (p->u.ofdm.hierarchy_information) { + default: /* just to inhibit a compiler warning, both cases have been handled above */ + case HIERARCHY_1: + c->alpha = 1; + break; + case HIERARCHY_2: + c->alpha = 2; + break; + case HIERARCHY_4: + c->alpha = 4; + break; + } + } + + /* to report back the correct information to the user + * after a auto scan - not used for tuning */ + c->code_rate_HP = p->u.ofdm.code_rate_HP; + c->code_rate_LP = p->u.ofdm.code_rate_LP; + c->delivery_system = SYS_DVBT; break; + case FE_ATSC: c->modulation = p->u.vsb.modulation; if ((c->modulation == VSB_8) || (c->modulation == VSB_16)) @@ -1097,12 +1129,28 @@ p->u.ofdm.bandwidth = BANDWIDTH_8_MHZ; else p->u.ofdm.bandwidth = BANDWIDTH_AUTO; - p->u.ofdm.code_rate_HP = c->code_rate_HP; - p->u.ofdm.code_rate_LP = c->code_rate_LP; + + p->u.ofdm.code_rate_HP = c->fec_inner; + p->u.ofdm.code_rate_LP = FEC_1_2; /* never used correctly by any frontend driver so far */ + if (c->hierarchy) { + switch (c->alpha) { + default: + case 1: + p->u.ofdm.hierarchy_information = HIERARCHY_1; + break; + case 2: + p->u.ofdm.hierarchy_information = HIERARCHY_2; + break; + case 4: + p->u.ofdm.hierarchy_information = HIERARCHY_4; + break; + } + } else + p->u.ofdm.hierarchy_information = HIERARCHY_NONE; + p->u.ofdm.constellation = c->modulation; p->u.ofdm.transmission_mode = c->transmission_mode; p->u.ofdm.guard_interval = c->guard_interval; - p->u.ofdm.hierarchy_information = c->hierarchy; c->delivery_system = SYS_DVBT; break; case FE_ATSC: @@ -1287,6 +1335,16 @@ case DTV_HIERARCHY: tvp->u.data = fe->dtv_property_cache.hierarchy; break; + case DTV_ALPHA: + tvp->u.data = fe->dtv_property_cache.alpha; + break; + case DTV_STREAM_SELECTION: + tvp->u.data = fe->dtv_property_cache.stream_selection; + break; + case DTV_TRANSMITTER_ID: + tvp->u.data = fe->dtv_property_cache.transmitter_id; + break; + default: r = -1; } @@ -1376,21 +1434,20 @@ r = dvb_frontend_ioctl_legacy(inode, file, FE_SET_TONE, (void *)fe->dtv_property_cache.sectone); break; - case DTV_CODE_RATE_HP: - fe->dtv_property_cache.code_rate_HP = tvp->u.data; - break; - case DTV_CODE_RATE_LP: - fe->dtv_property_cache.code_rate_LP = tvp->u.data; - break; case DTV_GUARD_INTERVAL: fe->dtv_property_cache.guard_interval = tvp->u.data; break; case DTV_TRANSMISSION_MODE: fe->dtv_property_cache.transmission_mode = tvp->u.data; break; - case DTV_HIERARCHY: - fe->dtv_property_cache.hierarchy = tvp->u.data; + + case DTV_ALPHA: + fe->dtv_property_cache.alpha = tvp->u.data; break; + case DTV_STREAM_SELECTION: + fe->dtv_property_cache.stream_selection = tvp->u.data; + break; + default: r = -1; } diff -r e2a8b9b9c294 linux/drivers/media/dvb/dvb-core/dvb_frontend.h --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h Fri Oct 17 19:45:55 2008 +0300 +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h Sun Oct 19 18:42:53 2008 +0200 @@ -200,7 +200,9 @@ fe_transmit_mode_t transmission_mode; u32 bandwidth_hz; /* 0 = AUTO */ fe_guard_interval_t guard_interval; - fe_hierarchy_t hierarchy; + u8 hierarchy; + u8 alpha; + u8 stream_selection; u32 symbol_rate; fe_code_rate_t code_rate_HP; fe_code_rate_t code_rate_LP; @@ -209,6 +211,8 @@ fe_rolloff_t rolloff; fe_delivery_system_t delivery_system; + + u32 transmitter_id; #if 0 /* ISDB-T specifics */ u32 isdb_segment_idx; diff -r e2a8b9b9c294 linux/include/linux/dvb/frontend.h --- a/linux/include/linux/dvb/frontend.h Fri Oct 17 19:45:55 2008 +0300 +++ b/linux/include/linux/dvb/frontend.h Sun Oct 19 18:42:54 2008 +0200 @@ -300,12 +300,29 @@ #define DTV_ISDB_LAYERC_TIME_INTERLEAVING 34 #endif #define DTV_API_VERSION 35 -#define DTV_API_VERSION 35 + +/* FEC code rate for the two streams coded (ro), in case of no hierarchy: CODE_RATE_HP is the one */ #define DTV_CODE_RATE_HP 36 #define DTV_CODE_RATE_LP 37 + +/* all OFDM standard have that (rw) */ #define DTV_GUARD_INTERVAL 38 +/* FFT size (rw) */ #define DTV_TRANSMISSION_MODE 39 + +/* DVB-T hierarchical stream information and selection */ +/* hierarchical transmission in DVB-T is in fact two independent transport streams + * one low-priority stream and a high priority one - see code_rate above (ro) */ #define DTV_HIERARCHY 40 +/* alpha is signalled by TPS, for HIERARCHY = 0, ALPHA is 1 */ +#define DTV_ALPHA 41 + +/* 1 = HP (default) , 0 = LP */ +#define DTV_STREAM_SELECTION 42 +/* use DTV_INNER_FEC to to tune with the DTV_STREAM_SELECTION correctly set */ + +/* tps cell id in DVB-T - (ro) */ +#define DTV_TRANSMITTER_ID 43 #define DTV_MAX_COMMAND DTV_HIERARCHY
_______________________________________________ linux-dvb mailing list linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb