1 /* 2 * Copyright (c) 2011-2014 - Mauro Carvalho Chehab 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation version 2.1 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * These routines were originally written as part of the dvb-apps, as: 14 * util functions for various ?zap implementations 15 * 16 * Copyright (C) 2001 Johannes Stezenbach (js@convergence.de) 17 * for convergence integrated media 18 * 19 * Originally licensed as GPLv2 or upper 20 */ 21 22 /** 23 * @file dvb-demux.h 24 * @ingroup demux 25 * @brief Provides interfaces to deal with DVB demux. 26 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 27 * @author Mauro Carvalho Chehab 28 * 29 * @par Bug Report 30 * Please submit bug reports and patches to linux-media@vger.kernel.org 31 */ 32 33 #ifndef _DVB_DEMUX_H 34 #define _DVB_DEMUX_H 35 36 #include <linux/dvb/dmx.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /** 43 * @brief Opens a DVB demux in read/write mode 44 * @ingroup demux 45 * 46 * @param adapter DVB adapter number to open 47 * @param demux DVB demux number to open 48 * 49 * @details This is a wrapper function to open(). File is always opened in 50 * blocking mode. 51 * 52 * @return Returns a file descriptor on success, -1 otherwise. 53 * 54 * @warning Deprecated. Please use dvb_dev_open() instead. 55 */ 56 int dvb_dmx_open(int adapter, int demux); 57 58 /** 59 * @brief Stops the DMX filter for the file descriptor and closes 60 * @ingroup demux 61 * 62 * @param dmx_fd File descriptor to close 63 * 64 * This is a wrapper function to close(). 65 * 66 * @warning Deprecated. Please use dvb_dev_close() instead. 67 */ 68 void dvb_dmx_close(int dmx_fd); 69 70 /** 71 * @brief Stops the DMX filter for a given file descriptor 72 * @ingroup demux 73 * 74 * @param dmx_fd File descriptor to close 75 * 76 * This is a wrapper function to DMX_STOP ioctl. 77 * See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html 78 * for more details. 79 * 80 * @warning Deprecated. Please use dvb_dev_dmx_stop() instead. 81 */ 82 void dvb_dmx_stop(int dmx_fd); 83 84 /** 85 * @brief Start a filter for a MPEG-TS Packetized Elementary 86 * Stream (PES) 87 * @ingroup demux 88 * 89 * @param dmxfd File descriptor for the demux device 90 * @param pid Program ID to filter. Use 0x2000 to select all PIDs 91 * @param type type of the PID (DMX_PES_VIDEO, DMX_PES_AUDIO, 92 * DMX_PES_OTHER, etc). 93 * @param output Where the data will be output (DMX_OUT_TS_TAP, 94 * DMX_OUT_DECODER, etc). 95 * @param buffersize Size of the buffer to be allocated to store the filtered data. 96 * 97 * This is a wrapper function for DMX_SET_PES_FILTER ioctl. 98 * See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html 99 * for more details. 100 * 101 * @return Retuns zero on success, -1 otherwise. 102 * 103 * @warning Deprecated. Please use dvb_dev_dmx_set_pesfilter() instead. 104 */ 105 int dvb_set_pesfilter(int dmxfd, int pid, dmx_pes_type_t type, 106 dmx_output_t output, int buffersize); 107 108 /** 109 * @brief Sets a MPEG-TS section filter 110 * @ingroup demux 111 * 112 * @param dmxfd File descriptor for the demux device 113 * @param pid Program ID to filter. Use 0x2000 to select all PIDs 114 * @param filtsize Size of the filter (up to 18 btyes) 115 * @param filter data to filter. Can be NULL or should have filtsize length 116 * @param mask filter mask. Can be NULL or should have filtsize length 117 * @param mode mode mask. Can be NULL or should have filtsize length 118 * @param flags flags for set filter (DMX_CHECK_CRC,DMX_ONESHOT, 119 * DMX_IMMEDIATE_START). 120 * 121 * This is a wrapper function for DMX_SET_FILTER ioctl. 122 * See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html 123 * for more details. 124 * 125 * @warning Deprecated. Please use dvb_dev_dmx_set_pesfilter() instead. 126 * 127 * @return Retuns zero on success, -1 otherwise. 128 * 129 */ 130 int dvb_set_section_filter(int dmxfd, int pid, unsigned filtsize, 131 unsigned char *filter, 132 unsigned char *mask, 133 unsigned char *mode, 134 unsigned int flags); 135 136 /** 137 * @brief read the contents of the MPEG-TS PAT table, seeking for 138 * an specific service ID 139 * @ingroup demux 140 * 141 * @param dmxfd File descriptor for the demux device 142 * @param sid Session ID to seeking 143 * 144 * @warning Deprecated. Please use dvb_get_pmt_pid() instead. 145 * 146 * @return At return, it returns a negative value if error or the PID associated with 147 * the desired Session ID. 148 * 149 * @warning This function currently assumes that the PAT fits into one session. 150 */ 151 int dvb_get_pmt_pid(int dmxfd, int sid); 152 153 #ifdef __cplusplus 154 } 155 #endif 156 157 #endif 158