Chapter 10. DVB Demux Device

Table of Contents

Demux Data Types
Output for the demux
dmx_input_t
dmx_pes_type_t
struct dmx_filter
struct dmx_sct_filter_params
struct dmx_pes_filter_params
struct dmx_event
struct dmx_stc
struct dmx_caps
enum dmx_source_t
Demux Function Calls
open()
close()
read()
write()
DMX_START
DMX_STOP
DMX_SET_FILTER
DMX_SET_PES_FILTER
DMX_SET_BUFFER_SIZE
DMX_GET_EVENT
DMX_GET_STC
DMX_GET_PES_PIDS
DMX_GET_CAPS
DMX_SET_SOURCE
DMX_ADD_PID
DMX_REMOVE_PID

The DVB demux device controls the filters of the DVB hardware/software. It can be accessed through /dev/adapter?/demux?. Data types and and ioctl definitions can be accessed by including linux/dvb/dmx.h in your application.

Demux Data Types

Output for the demux

Table 10.1. enum dmx_output

IDDescription
DMX_OUT_DECODERStreaming directly to decoder.
DMX_OUT_TAPOutput going to a memory buffer (to be retrieved via the read command). Delivers the stream output to the demux device on which the ioctl is called.
DMX_OUT_TS_TAPOutput multiplexed into a new TS (to be retrieved by reading from the logical DVR device). Routes output to the logical DVR device /dev/dvb/adapter?/dvr?, which delivers a TS multiplexed from all filters for which DMX_OUT_TS_TAP was specified.
DMX_OUT_TSDEMUX_TAPLike DMX_OUT_TS_TAP but retrieved from the DMX device.

dmx_input_t

typedef enum
{
	DMX_IN_FRONTEND, /⋆ Input from a front-end device.  ⋆/
	DMX_IN_DVR       /⋆ Input from the logical DVR device.  ⋆/
} dmx_input_t;

dmx_pes_type_t

typedef enum
{
	DMX_PES_AUDIO0,
	DMX_PES_VIDEO0,
	DMX_PES_TELETEXT0,
	DMX_PES_SUBTITLE0,
	DMX_PES_PCR0,

	DMX_PES_AUDIO1,
	DMX_PES_VIDEO1,
	DMX_PES_TELETEXT1,
	DMX_PES_SUBTITLE1,
	DMX_PES_PCR1,

	DMX_PES_AUDIO2,
	DMX_PES_VIDEO2,
	DMX_PES_TELETEXT2,
	DMX_PES_SUBTITLE2,
	DMX_PES_PCR2,

	DMX_PES_AUDIO3,
	DMX_PES_VIDEO3,
	DMX_PES_TELETEXT3,
	DMX_PES_SUBTITLE3,
	DMX_PES_PCR3,

	DMX_PES_OTHER
} dmx_pes_type_t;

struct dmx_filter

 typedef struct dmx_filter
{
	__u8  filter[DMX_FILTER_SIZE];
	__u8  mask[DMX_FILTER_SIZE];
	__u8  mode[DMX_FILTER_SIZE];
} dmx_filter_t;

struct dmx_sct_filter_params

struct dmx_sct_filter_params
{
	__u16          pid;
	dmx_filter_t   filter;
	__u32          timeout;
	__u32          flags;
#define DMX_CHECK_CRC       1
#define DMX_ONESHOT         2
#define DMX_IMMEDIATE_START 4
#define DMX_KERNEL_CLIENT   0x8000
};

struct dmx_pes_filter_params

struct dmx_pes_filter_params
{
	__u16          pid;
	dmx_input_t    input;
	dmx_output_t   output;
	dmx_pes_type_t pes_type;
	__u32          flags;
};

struct dmx_event

 struct dmx_event
 {
	 dmx_event_t          event;
	 time_t               timeStamp;
	 union
	 {
		 dmx_scrambling_status_t scrambling;
	 } u;
 };

struct dmx_stc

struct dmx_stc {
	unsigned int num;	/⋆ input : which STC? 0..N ⋆/
	unsigned int base;	/⋆ output: divisor for stc to get 90 kHz clock ⋆/
	__u64 stc;		/⋆ output: stc in 'base'⋆90 kHz units ⋆/
};

struct dmx_caps

 typedef struct dmx_caps {
	__u32 caps;
	int num_decoders;
} dmx_caps_t;

enum dmx_source_t

typedef enum {
	DMX_SOURCE_FRONT0 = 0,
	DMX_SOURCE_FRONT1,
	DMX_SOURCE_FRONT2,
	DMX_SOURCE_FRONT3,
	DMX_SOURCE_DVR0   = 16,
	DMX_SOURCE_DVR1,
	DMX_SOURCE_DVR2,
	DMX_SOURCE_DVR3
} dmx_source_t;