[linux-dvb] [V4] Querying capabilities

hunold at linuxtv.org hunold at linuxtv.org
Thu Sep 15 10:11:21 CEST 2005


In a recent discussion we agreed, that some of the enums that have been 
introduced in v4 are actually bitfields. For C++ this is a problem, because 
or'ing enums does not work without explicit casting, which is ugly. So we 
turned some of the enums to explicit #defines. 

Currently, the v4 API supports querying capabilities through the 
DVB_DEMUX_GET_CAPS ioctl. struct dvb_demux_caps is used to specify
the desired capability that should be queried, the return value is an
unsigned int value. 

This is ugly, because the unsigned int return type can either be an integer, 
a bitfield or an enum. 

Another point is, that I'm trying to get rid of dvb_demux_pid_filter_flags. 

The reason is that completely unrelated things (selection of full ts, 
selection of payload only/ts header only, packet priority selection, packet 
output selection) are crowded into one "flags" field. 

enum dvb_demux_pid_filter_flags {

Instead I'd like to have a struct dvb_demux_pid_filter_prop, which can be 
used to select the properties of a section filter. If you just initialize 
that portion to 0, you get the default behaviour just like with setting 
flags to zero before. 

enum dvb_demux_pid_filter_packet_selection {
	DVB_DEMUX_TS_PACKET,       /*!< default: process the whole TS packet */
	DVB_DEMUX_PAYLOAD_ONLY,    /*!< only deliver the payload (ie. strip off the 
TS header) */
	DVB_DEMUX_ADAPTATION_ONLY, /*!< only deliver the TS header and any 
adaptation fields if present */

enum dvb_demux_pid_filter_prio_selection {
	DVB_DEMUX_PRIO_IGNORE, /*!< default: ignore priorities of TS packets */
	DVB_DEMUX_PRIO_NORMAL, /*!< only deliver low priority packets on the 
specified pid */
	DVB_DEMUX_PRIO_HIGH,   /*!< only deliver high priority packets on the 
specified pid */

struct dvb_demux_pid_filter_prop {
	enum dvb_demux_pid_filter_packet_selection packet;
	enum dvb_demux_pid_filter_prio_selection prio;
	int wait_for_pusi:1;
	int output_dupes:1;
	int output_errpkts:1;

The impact of that change will be that DVB_DEMUX_GET_CAPS can not be used to 
query the capabilities of the pid filter hardware anymore, because 
dvb_demux_pid_filter_flags is gone. 

In order to have a clean solution, I'd like to replace the current 
DVB_DEMUX_GET_CAPS implementation. Instead of returning one value at a time 
that needs to be casted to the correct type by the application, I'd like to 
return only one structure that will have all informations. This structure 
could look like this: 

struct dvb_demux_capability
	int num_pes_filters;,      /*!< number of available PES filters (\ref 
	int num_audio_dec_feeds;   /*!< number of available audio filters (\ref 
	int num_video_dec_feeds;   /*!< number of available video filters (\ref 
	int num_pcr_dec_feeds;     /*!< number of available pcr filters (\ref 
	int num_section_filters;   /*!< number of available section filters (\ref 
	int num_pid_filters;       /*!< number of available pid filters (\ref 
	int num_recording_filters; /*!< number of available recording filters (\ref 
	int num_descr_key_pairs; 

	int soure_format_ts:1;     /*!< can handle TS input */
	int soure_format_ps:1;     /*!< can handle PS input */
	int soure_format_pes:1;    /*!< can handle PES input */
	int soure_format_mpeg1:1;  /*!< can handle MPEG1 input */ 

	int pid_filter_payload_only:1;          /*!< can strip off the TS header */
	int pid_filter_adaptation_only:1;       /*!< can deliver TS header + 
adaptation fields only */
	int pid_filter_prio_normal_selection:1; /*!< can deliver low priority 
packets only */
	int pid_filter_prio_high_selection:1;   /*!< can deliver high priority 
packets only */
	int pid_filter_wait_for_pusi:1;         /*!< can wait for pusi before 
filtering */
	int pid_filter_output_dupes:1;          /*!< don't filter out duplicated 
packets */
	int pid_filter_output_errpkts:1;        /*!< don't filter out packets with 
errors */ 

	int recording_event_logging:1;  /*!< recording units have event logging 
support */
	uint32_t recording_events;	/*!< bitfield, supported flags for recording 
filters (\ref dvb_demux_recording_filter_flags) */ 

	uint32_t priv[16]; /*!< reserved */

#define DVB_DEMUX_GET_CAPS _IOWR(DVB_IOCTL_BASE, 0x20, struct 

Comments? Objections? 


More information about the linux-dvb mailing list