18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * dvb_demux.h: DVB kernel demux API
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2000-2001 Marcus Metzler & Ralph Metzler
58c2ecf20Sopenharmony_ci *                         for convergence integrated media GmbH
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or
88c2ecf20Sopenharmony_ci * modify it under the terms of the GNU Lesser General Public License
98c2ecf20Sopenharmony_ci * as published by the Free Software Foundation; either version 2.1
108c2ecf20Sopenharmony_ci * of the License, or (at your option) any later version.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful,
138c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
148c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
158c2ecf20Sopenharmony_ci * GNU General Public License for more details.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#ifndef _DVB_DEMUX_H_
208c2ecf20Sopenharmony_ci#define _DVB_DEMUX_H_
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include <linux/time.h>
238c2ecf20Sopenharmony_ci#include <linux/timer.h>
248c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
258c2ecf20Sopenharmony_ci#include <linux/mutex.h>
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#include <media/demux.h>
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/**
308c2ecf20Sopenharmony_ci * enum dvb_dmx_filter_type - type of demux feed.
318c2ecf20Sopenharmony_ci *
328c2ecf20Sopenharmony_ci * @DMX_TYPE_TS:	feed is in TS mode.
338c2ecf20Sopenharmony_ci * @DMX_TYPE_SEC:	feed is in Section mode.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_cienum dvb_dmx_filter_type {
368c2ecf20Sopenharmony_ci	DMX_TYPE_TS,
378c2ecf20Sopenharmony_ci	DMX_TYPE_SEC,
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/**
418c2ecf20Sopenharmony_ci * enum dvb_dmx_state - state machine for a demux filter.
428c2ecf20Sopenharmony_ci *
438c2ecf20Sopenharmony_ci * @DMX_STATE_FREE:		indicates that the filter is freed.
448c2ecf20Sopenharmony_ci * @DMX_STATE_ALLOCATED:	indicates that the filter was allocated
458c2ecf20Sopenharmony_ci *				to be used.
468c2ecf20Sopenharmony_ci * @DMX_STATE_READY:		indicates that the filter is ready
478c2ecf20Sopenharmony_ci *				to be used.
488c2ecf20Sopenharmony_ci * @DMX_STATE_GO:		indicates that the filter is running.
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_cienum dvb_dmx_state {
518c2ecf20Sopenharmony_ci	DMX_STATE_FREE,
528c2ecf20Sopenharmony_ci	DMX_STATE_ALLOCATED,
538c2ecf20Sopenharmony_ci	DMX_STATE_READY,
548c2ecf20Sopenharmony_ci	DMX_STATE_GO,
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define DVB_DEMUX_MASK_MAX 18
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define MAX_PID 0x1fff
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define SPEED_PKTS_INTERVAL 50000
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/**
648c2ecf20Sopenharmony_ci * struct dvb_demux_filter - Describes a DVB demux section filter.
658c2ecf20Sopenharmony_ci *
668c2ecf20Sopenharmony_ci * @filter:		Section filter as defined by &struct dmx_section_filter.
678c2ecf20Sopenharmony_ci * @maskandmode:	logical ``and`` bit mask.
688c2ecf20Sopenharmony_ci * @maskandnotmode:	logical ``and not`` bit mask.
698c2ecf20Sopenharmony_ci * @doneq:		flag that indicates when a filter is ready.
708c2ecf20Sopenharmony_ci * @next:		pointer to the next section filter.
718c2ecf20Sopenharmony_ci * @feed:		&struct dvb_demux_feed pointer.
728c2ecf20Sopenharmony_ci * @index:		index of the used demux filter.
738c2ecf20Sopenharmony_ci * @state:		state of the filter as described by &enum dvb_dmx_state.
748c2ecf20Sopenharmony_ci * @type:		type of the filter as described
758c2ecf20Sopenharmony_ci *			by &enum dvb_dmx_filter_type.
768c2ecf20Sopenharmony_ci */
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistruct dvb_demux_filter {
798c2ecf20Sopenharmony_ci	struct dmx_section_filter filter;
808c2ecf20Sopenharmony_ci	u8 maskandmode[DMX_MAX_FILTER_SIZE];
818c2ecf20Sopenharmony_ci	u8 maskandnotmode[DMX_MAX_FILTER_SIZE];
828c2ecf20Sopenharmony_ci	bool doneq;
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	struct dvb_demux_filter *next;
858c2ecf20Sopenharmony_ci	struct dvb_demux_feed *feed;
868c2ecf20Sopenharmony_ci	int index;
878c2ecf20Sopenharmony_ci	enum dvb_dmx_state state;
888c2ecf20Sopenharmony_ci	enum dvb_dmx_filter_type type;
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci	/* private: used only by av7110 */
918c2ecf20Sopenharmony_ci	u16 hw_handle;
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/**
958c2ecf20Sopenharmony_ci * struct dvb_demux_feed - describes a DVB field
968c2ecf20Sopenharmony_ci *
978c2ecf20Sopenharmony_ci * @feed:	a union describing a digital TV feed.
988c2ecf20Sopenharmony_ci *		Depending on the feed type, it can be either
998c2ecf20Sopenharmony_ci *		@feed.ts or @feed.sec.
1008c2ecf20Sopenharmony_ci * @feed.ts:	a &struct dmx_ts_feed pointer.
1018c2ecf20Sopenharmony_ci *		For TS feed only.
1028c2ecf20Sopenharmony_ci * @feed.sec:	a &struct dmx_section_feed pointer.
1038c2ecf20Sopenharmony_ci *		For section feed only.
1048c2ecf20Sopenharmony_ci * @cb:		a union describing digital TV callbacks.
1058c2ecf20Sopenharmony_ci *		Depending on the feed type, it can be either
1068c2ecf20Sopenharmony_ci *		@cb.ts or @cb.sec.
1078c2ecf20Sopenharmony_ci * @cb.ts:	a dmx_ts_cb() calback function pointer.
1088c2ecf20Sopenharmony_ci *		For TS feed only.
1098c2ecf20Sopenharmony_ci * @cb.sec:	a dmx_section_cb() callback function pointer.
1108c2ecf20Sopenharmony_ci *		For section feed only.
1118c2ecf20Sopenharmony_ci * @demux:	pointer to &struct dvb_demux.
1128c2ecf20Sopenharmony_ci * @priv:	private data that can optionally be used by a DVB driver.
1138c2ecf20Sopenharmony_ci * @type:	type of the filter, as defined by &enum dvb_dmx_filter_type.
1148c2ecf20Sopenharmony_ci * @state:	state of the filter as defined by &enum dvb_dmx_state.
1158c2ecf20Sopenharmony_ci * @pid:	PID to be filtered.
1168c2ecf20Sopenharmony_ci * @timeout:	feed timeout.
1178c2ecf20Sopenharmony_ci * @filter:	pointer to &struct dvb_demux_filter.
1188c2ecf20Sopenharmony_ci * @buffer_flags: Buffer flags used to report discontinuity users via DVB
1198c2ecf20Sopenharmony_ci *		  memory mapped API, as defined by &enum dmx_buffer_flags.
1208c2ecf20Sopenharmony_ci * @ts_type:	type of TS, as defined by &enum ts_filter_type.
1218c2ecf20Sopenharmony_ci * @pes_type:	type of PES, as defined by &enum dmx_ts_pes.
1228c2ecf20Sopenharmony_ci * @cc:		MPEG-TS packet continuity counter
1238c2ecf20Sopenharmony_ci * @pusi_seen:	if true, indicates that a discontinuity was detected.
1248c2ecf20Sopenharmony_ci *		it is used to prevent feeding of garbage from previous section.
1258c2ecf20Sopenharmony_ci * @peslen:	length of the PES (Packet Elementary Stream).
1268c2ecf20Sopenharmony_ci * @list_head:	head for the list of digital TV demux feeds.
1278c2ecf20Sopenharmony_ci * @index:	a unique index for each feed. Can be used as hardware
1288c2ecf20Sopenharmony_ci *		pid filter index.
1298c2ecf20Sopenharmony_ci */
1308c2ecf20Sopenharmony_cistruct dvb_demux_feed {
1318c2ecf20Sopenharmony_ci	union {
1328c2ecf20Sopenharmony_ci		struct dmx_ts_feed ts;
1338c2ecf20Sopenharmony_ci		struct dmx_section_feed sec;
1348c2ecf20Sopenharmony_ci	} feed;
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	union {
1378c2ecf20Sopenharmony_ci		dmx_ts_cb ts;
1388c2ecf20Sopenharmony_ci		dmx_section_cb sec;
1398c2ecf20Sopenharmony_ci	} cb;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	struct dvb_demux *demux;
1428c2ecf20Sopenharmony_ci	void *priv;
1438c2ecf20Sopenharmony_ci	enum dvb_dmx_filter_type type;
1448c2ecf20Sopenharmony_ci	enum dvb_dmx_state state;
1458c2ecf20Sopenharmony_ci	u16 pid;
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	ktime_t timeout;
1488c2ecf20Sopenharmony_ci	struct dvb_demux_filter *filter;
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci	u32 buffer_flags;
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	enum ts_filter_type ts_type;
1538c2ecf20Sopenharmony_ci	enum dmx_ts_pes pes_type;
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	int cc;
1568c2ecf20Sopenharmony_ci	bool pusi_seen;
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci	u16 peslen;
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci	struct list_head list_head;
1618c2ecf20Sopenharmony_ci	unsigned int index;
1628c2ecf20Sopenharmony_ci};
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/**
1658c2ecf20Sopenharmony_ci * struct dvb_demux - represents a digital TV demux
1668c2ecf20Sopenharmony_ci * @dmx:		embedded &struct dmx_demux with demux capabilities
1678c2ecf20Sopenharmony_ci *			and callbacks.
1688c2ecf20Sopenharmony_ci * @priv:		private data that can optionally be used by
1698c2ecf20Sopenharmony_ci *			a DVB driver.
1708c2ecf20Sopenharmony_ci * @filternum:		maximum amount of DVB filters.
1718c2ecf20Sopenharmony_ci * @feednum:		maximum amount of DVB feeds.
1728c2ecf20Sopenharmony_ci * @start_feed:		callback routine to be called in order to start
1738c2ecf20Sopenharmony_ci *			a DVB feed.
1748c2ecf20Sopenharmony_ci * @stop_feed:		callback routine to be called in order to stop
1758c2ecf20Sopenharmony_ci *			a DVB feed.
1768c2ecf20Sopenharmony_ci * @write_to_decoder:	callback routine to be called if the feed is TS and
1778c2ecf20Sopenharmony_ci *			it is routed to an A/V decoder, when a new TS packet
1788c2ecf20Sopenharmony_ci *			is received.
1798c2ecf20Sopenharmony_ci *			Used only on av7110-av.c.
1808c2ecf20Sopenharmony_ci * @check_crc32:	callback routine to check CRC. If not initialized,
1818c2ecf20Sopenharmony_ci *			dvb_demux will use an internal one.
1828c2ecf20Sopenharmony_ci * @memcopy:		callback routine to memcopy received data.
1838c2ecf20Sopenharmony_ci *			If not initialized, dvb_demux will default to memcpy().
1848c2ecf20Sopenharmony_ci * @users:		counter for the number of demux opened file descriptors.
1858c2ecf20Sopenharmony_ci *			Currently, it is limited to 10 users.
1868c2ecf20Sopenharmony_ci * @filter:		pointer to &struct dvb_demux_filter.
1878c2ecf20Sopenharmony_ci * @feed:		pointer to &struct dvb_demux_feed.
1888c2ecf20Sopenharmony_ci * @frontend_list:	&struct list_head with frontends used by the demux.
1898c2ecf20Sopenharmony_ci * @pesfilter:		array of &struct dvb_demux_feed with the PES types
1908c2ecf20Sopenharmony_ci *			that will be filtered.
1918c2ecf20Sopenharmony_ci * @pids:		list of filtered program IDs.
1928c2ecf20Sopenharmony_ci * @feed_list:		&struct list_head with feeds.
1938c2ecf20Sopenharmony_ci * @tsbuf:		temporary buffer used internally to store TS packets.
1948c2ecf20Sopenharmony_ci * @tsbufp:		temporary buffer index used internally.
1958c2ecf20Sopenharmony_ci * @mutex:		pointer to &struct mutex used to protect feed set
1968c2ecf20Sopenharmony_ci *			logic.
1978c2ecf20Sopenharmony_ci * @lock:		pointer to &spinlock_t, used to protect buffer handling.
1988c2ecf20Sopenharmony_ci * @cnt_storage:	buffer used for TS/TEI continuity check.
1998c2ecf20Sopenharmony_ci * @speed_last_time:	&ktime_t used for TS speed check.
2008c2ecf20Sopenharmony_ci * @speed_pkts_cnt:	packets count used for TS speed check.
2018c2ecf20Sopenharmony_ci */
2028c2ecf20Sopenharmony_cistruct dvb_demux {
2038c2ecf20Sopenharmony_ci	struct dmx_demux dmx;
2048c2ecf20Sopenharmony_ci	void *priv;
2058c2ecf20Sopenharmony_ci	int filternum;
2068c2ecf20Sopenharmony_ci	int feednum;
2078c2ecf20Sopenharmony_ci	int (*start_feed)(struct dvb_demux_feed *feed);
2088c2ecf20Sopenharmony_ci	int (*stop_feed)(struct dvb_demux_feed *feed);
2098c2ecf20Sopenharmony_ci	int (*write_to_decoder)(struct dvb_demux_feed *feed,
2108c2ecf20Sopenharmony_ci				 const u8 *buf, size_t len);
2118c2ecf20Sopenharmony_ci	u32 (*check_crc32)(struct dvb_demux_feed *feed,
2128c2ecf20Sopenharmony_ci			    const u8 *buf, size_t len);
2138c2ecf20Sopenharmony_ci	void (*memcopy)(struct dvb_demux_feed *feed, u8 *dst,
2148c2ecf20Sopenharmony_ci			 const u8 *src, size_t len);
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci	int users;
2178c2ecf20Sopenharmony_ci#define MAX_DVB_DEMUX_USERS 10
2188c2ecf20Sopenharmony_ci	struct dvb_demux_filter *filter;
2198c2ecf20Sopenharmony_ci	struct dvb_demux_feed *feed;
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci	struct list_head frontend_list;
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	struct dvb_demux_feed *pesfilter[DMX_PES_OTHER];
2248c2ecf20Sopenharmony_ci	u16 pids[DMX_PES_OTHER];
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci#define DMX_MAX_PID 0x2000
2278c2ecf20Sopenharmony_ci	struct list_head feed_list;
2288c2ecf20Sopenharmony_ci	u8 tsbuf[204];
2298c2ecf20Sopenharmony_ci	int tsbufp;
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci	struct mutex mutex;
2328c2ecf20Sopenharmony_ci	spinlock_t lock;
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci	uint8_t *cnt_storage; /* for TS continuity check */
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	ktime_t speed_last_time; /* for TS speed check */
2378c2ecf20Sopenharmony_ci	uint32_t speed_pkts_cnt; /* for TS speed check */
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci	/* private: used only on av7110 */
2408c2ecf20Sopenharmony_ci	int playing;
2418c2ecf20Sopenharmony_ci	int recording;
2428c2ecf20Sopenharmony_ci};
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/**
2458c2ecf20Sopenharmony_ci * dvb_dmx_init - initialize a digital TV demux struct.
2468c2ecf20Sopenharmony_ci *
2478c2ecf20Sopenharmony_ci * @demux: &struct dvb_demux to be initialized.
2488c2ecf20Sopenharmony_ci *
2498c2ecf20Sopenharmony_ci * Before being able to register a digital TV demux struct, drivers
2508c2ecf20Sopenharmony_ci * should call this routine. On its typical usage, some fields should
2518c2ecf20Sopenharmony_ci * be initialized at the driver before calling it.
2528c2ecf20Sopenharmony_ci *
2538c2ecf20Sopenharmony_ci * A typical usecase is::
2548c2ecf20Sopenharmony_ci *
2558c2ecf20Sopenharmony_ci *	dvb->demux.dmx.capabilities =
2568c2ecf20Sopenharmony_ci *		DMX_TS_FILTERING | DMX_SECTION_FILTERING |
2578c2ecf20Sopenharmony_ci *		DMX_MEMORY_BASED_FILTERING;
2588c2ecf20Sopenharmony_ci *	dvb->demux.priv       = dvb;
2598c2ecf20Sopenharmony_ci *	dvb->demux.filternum  = 256;
2608c2ecf20Sopenharmony_ci *	dvb->demux.feednum    = 256;
2618c2ecf20Sopenharmony_ci *	dvb->demux.start_feed = driver_start_feed;
2628c2ecf20Sopenharmony_ci *	dvb->demux.stop_feed  = driver_stop_feed;
2638c2ecf20Sopenharmony_ci *	ret = dvb_dmx_init(&dvb->demux);
2648c2ecf20Sopenharmony_ci *	if (ret < 0)
2658c2ecf20Sopenharmony_ci *		return ret;
2668c2ecf20Sopenharmony_ci */
2678c2ecf20Sopenharmony_ciint dvb_dmx_init(struct dvb_demux *demux);
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci/**
2708c2ecf20Sopenharmony_ci * dvb_dmx_release - releases a digital TV demux internal buffers.
2718c2ecf20Sopenharmony_ci *
2728c2ecf20Sopenharmony_ci * @demux: &struct dvb_demux to be released.
2738c2ecf20Sopenharmony_ci *
2748c2ecf20Sopenharmony_ci * The DVB core internally allocates data at @demux. This routine
2758c2ecf20Sopenharmony_ci * releases those data. Please notice that the struct itelf is not
2768c2ecf20Sopenharmony_ci * released, as it can be embedded on other structs.
2778c2ecf20Sopenharmony_ci */
2788c2ecf20Sopenharmony_civoid dvb_dmx_release(struct dvb_demux *demux);
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci/**
2818c2ecf20Sopenharmony_ci * dvb_dmx_swfilter_packets - use dvb software filter for a buffer with
2828c2ecf20Sopenharmony_ci *	multiple MPEG-TS packets with 188 bytes each.
2838c2ecf20Sopenharmony_ci *
2848c2ecf20Sopenharmony_ci * @demux: pointer to &struct dvb_demux
2858c2ecf20Sopenharmony_ci * @buf: buffer with data to be filtered
2868c2ecf20Sopenharmony_ci * @count: number of MPEG-TS packets with size of 188.
2878c2ecf20Sopenharmony_ci *
2888c2ecf20Sopenharmony_ci * The routine will discard a DVB packet that don't start with 0x47.
2898c2ecf20Sopenharmony_ci *
2908c2ecf20Sopenharmony_ci * Use this routine if the DVB demux fills MPEG-TS buffers that are
2918c2ecf20Sopenharmony_ci * already aligned.
2928c2ecf20Sopenharmony_ci *
2938c2ecf20Sopenharmony_ci * NOTE: The @buf size should have size equal to ``count * 188``.
2948c2ecf20Sopenharmony_ci */
2958c2ecf20Sopenharmony_civoid dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
2968c2ecf20Sopenharmony_ci			      size_t count);
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci/**
2998c2ecf20Sopenharmony_ci * dvb_dmx_swfilter -  use dvb software filter for a buffer with
3008c2ecf20Sopenharmony_ci *	multiple MPEG-TS packets with 188 bytes each.
3018c2ecf20Sopenharmony_ci *
3028c2ecf20Sopenharmony_ci * @demux: pointer to &struct dvb_demux
3038c2ecf20Sopenharmony_ci * @buf: buffer with data to be filtered
3048c2ecf20Sopenharmony_ci * @count: number of MPEG-TS packets with size of 188.
3058c2ecf20Sopenharmony_ci *
3068c2ecf20Sopenharmony_ci * If a DVB packet doesn't start with 0x47, it will seek for the first
3078c2ecf20Sopenharmony_ci * byte that starts with 0x47.
3088c2ecf20Sopenharmony_ci *
3098c2ecf20Sopenharmony_ci * Use this routine if the DVB demux fill buffers that may not start with
3108c2ecf20Sopenharmony_ci * a packet start mark (0x47).
3118c2ecf20Sopenharmony_ci *
3128c2ecf20Sopenharmony_ci * NOTE: The @buf size should have size equal to ``count * 188``.
3138c2ecf20Sopenharmony_ci */
3148c2ecf20Sopenharmony_civoid dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count);
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci/**
3178c2ecf20Sopenharmony_ci * dvb_dmx_swfilter_204 -  use dvb software filter for a buffer with
3188c2ecf20Sopenharmony_ci *	multiple MPEG-TS packets with 204 bytes each.
3198c2ecf20Sopenharmony_ci *
3208c2ecf20Sopenharmony_ci * @demux: pointer to &struct dvb_demux
3218c2ecf20Sopenharmony_ci * @buf: buffer with data to be filtered
3228c2ecf20Sopenharmony_ci * @count: number of MPEG-TS packets with size of 204.
3238c2ecf20Sopenharmony_ci *
3248c2ecf20Sopenharmony_ci * If a DVB packet doesn't start with 0x47, it will seek for the first
3258c2ecf20Sopenharmony_ci * byte that starts with 0x47.
3268c2ecf20Sopenharmony_ci *
3278c2ecf20Sopenharmony_ci * Use this routine if the DVB demux fill buffers that may not start with
3288c2ecf20Sopenharmony_ci * a packet start mark (0x47).
3298c2ecf20Sopenharmony_ci *
3308c2ecf20Sopenharmony_ci * NOTE: The @buf size should have size equal to ``count * 204``.
3318c2ecf20Sopenharmony_ci */
3328c2ecf20Sopenharmony_civoid dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf,
3338c2ecf20Sopenharmony_ci			  size_t count);
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/**
3368c2ecf20Sopenharmony_ci * dvb_dmx_swfilter_raw -  make the raw data available to userspace without
3378c2ecf20Sopenharmony_ci *	filtering
3388c2ecf20Sopenharmony_ci *
3398c2ecf20Sopenharmony_ci * @demux: pointer to &struct dvb_demux
3408c2ecf20Sopenharmony_ci * @buf: buffer with data
3418c2ecf20Sopenharmony_ci * @count: number of packets to be passed. The actual size of each packet
3428c2ecf20Sopenharmony_ci *	depends on the &dvb_demux->feed->cb.ts logic.
3438c2ecf20Sopenharmony_ci *
3448c2ecf20Sopenharmony_ci * Use it if the driver needs to deliver the raw payload to userspace without
3458c2ecf20Sopenharmony_ci * passing through the kernel demux. That is meant to support some
3468c2ecf20Sopenharmony_ci * delivery systems that aren't based on MPEG-TS.
3478c2ecf20Sopenharmony_ci *
3488c2ecf20Sopenharmony_ci * This function relies on &dvb_demux->feed->cb.ts to actually handle the
3498c2ecf20Sopenharmony_ci * buffer.
3508c2ecf20Sopenharmony_ci */
3518c2ecf20Sopenharmony_civoid dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf,
3528c2ecf20Sopenharmony_ci			  size_t count);
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci#endif /* _DVB_DEMUX_H_ */
355