[linux-dvb] [PATCH] dvb-kernel-v4 demux.h

Johannes Stezenbach js at linuxtv.org
Wed Aug 31 13:35:04 CEST 2005


On Wed, Aug 31, 2005 hunold at linuxtv.org wrote:
> I have been thinking about this for some time now and I've come to the 
> conclusion that neither enums nor defines are suitable here. The reason is 
> that some combinations of these flags don't make sense (in contrast to the 
> recording filter events which can be combined in any way). So IMO these 
> flags should be split up into logical sections, like this. 
> 
> Instead of having one "flags" member for the pid filter, we should have a 
> whole structure for defining special filter properties. It should be able 
> to memset() the whole structure to 0 and then get the default behaviour. 
> 
> enum dvb_demux_pid_filter_packet_selection {
> 	DVB_DEMUX_TS_PACKET       = (1 << 0), /*!< default: process the 
> 	whole TS packet */
> 	DVB_DEMUX_PAYLOAD_ONLY    = (1 << 1), /*!< only deliver the payload 
> 	(ie. strip off the TS header) */
> 	DVB_DEMUX_ADAPTATION_ONLY = (1 << 2), /*!< only deliver the TS 
> 	header and any adaptation fields if present */
> }; 
> 
> enum dvb_demux_pid_filter_prio_selection {
> 	DVB_DEMUX_PRIO_IGNORE  = (1 << 0), /*!< default: ignore priorities 
> 	of TS packets */
> 	DVB_DEMUX_PRIO_NORMAL  = (1 << 1), /*!< only deliver low priority 
> 	packets on the specified pid */
> 	DVB_DEMUX_PRIO_HIGH    = (1 << 2), /*!< only deliver high priority 
> 	packets on the specified pid */
> }; 

If these enums aren't flags, then why the hell do you make them
look like flags?

> Unfortunately, this has a side effect on capabilities. Before, we just 
> returned the enum when the user queried DVB_DEMUX_CAP_PID_FILTER_FLAGS. 
> 
> Now, this is not possible anymore. One solution would be to split up the 
> one pid filter flags capability to more detailied individual flags, like 
> this: 
> 	DVB_DEMUX_CAP_NUM_PID_FILTERS,             /*!< integer, number of 
> available pid filters (\ref DVB_DEMUX_SET_PID_FILTER)*/
> 	DVB_DEMUX_CAP_PID_FILTER_PAYLOAD_ONLY_SELECTION, /*!< */
> 	DVB_DEMUX_CAP_PID_FILTER_ADAPTATION_ONLY_SELECTION, /*!< */
> 	DVB_DEMUX_CAP_PID_FILTER_PRIO_NORMAL_SELECTION,   /*!< */
> 	DVB_DEMUX_CAP_PID_FILTER_PRIO_HIGH_SELECTION,   /*!< */

I believe one PRIO cap should be enough

> 	DVB_DEMUX_CAP_PID_FILTER_WAIT_FOR_PUSI,    /*!< */
> 	DVB_DEMUX_CAP_PID_FILTER_OUTPUT_DUPES,     /*!< */
> 	DVB_DEMUX_CAP_PID_FILTER_OUTPUT_ERRPKTS,   /*!< */ 

Johannes




More information about the linux-dvb mailing list