diff options
author | Lars Heer <l.heer@gmx.de> | 2013-09-18 05:50:03 +0200 |
---|---|---|
committer | Lars Heer <l.heer@gmx.de> | 2013-09-18 05:50:03 +0200 |
commit | ccf6e0f9c6b0481ed13e0f4794e3fbead750f385 (patch) | |
tree | ed86efb54f7ee41edfba5c89ca519b5fd10aa0d5 /mcast/dvbloop | |
download | vdr-plugin-mcli-ccf6e0f9c6b0481ed13e0f4794e3fbead750f385.tar.gz vdr-plugin-mcli-ccf6e0f9c6b0481ed13e0f4794e3fbead750f385.tar.bz2 |
added vdr-plugin-mcli-0.0.1+svn20120927
Diffstat (limited to 'mcast/dvbloop')
-rw-r--r-- | mcast/dvbloop/.svn/entries | 266 | ||||
-rw-r--r-- | mcast/dvbloop/.svn/text-base/dvblo.h.svn-base | 58 | ||||
-rw-r--r-- | mcast/dvbloop/.svn/text-base/dvblo_adap.h.svn-base | 155 | ||||
-rw-r--r-- | mcast/dvbloop/.svn/text-base/dvblo_adap_ca.h.svn-base | 43 | ||||
-rw-r--r-- | mcast/dvbloop/.svn/text-base/dvblo_adap_fe.h.svn-base | 30 | ||||
-rw-r--r-- | mcast/dvbloop/.svn/text-base/dvblo_char.h.svn-base | 33 | ||||
-rw-r--r-- | mcast/dvbloop/.svn/text-base/dvblo_ioctl.h.svn-base | 203 | ||||
-rw-r--r-- | mcast/dvbloop/.svn/text-base/dvblo_util.h.svn-base | 45 | ||||
-rw-r--r-- | mcast/dvbloop/dvblo.h | 58 | ||||
-rw-r--r-- | mcast/dvbloop/dvblo_adap.h | 155 | ||||
-rw-r--r-- | mcast/dvbloop/dvblo_adap_ca.h | 43 | ||||
-rw-r--r-- | mcast/dvbloop/dvblo_adap_fe.h | 30 | ||||
-rw-r--r-- | mcast/dvbloop/dvblo_char.h | 33 | ||||
-rw-r--r-- | mcast/dvbloop/dvblo_ioctl.h | 203 | ||||
-rw-r--r-- | mcast/dvbloop/dvblo_util.h | 45 |
15 files changed, 1400 insertions, 0 deletions
diff --git a/mcast/dvbloop/.svn/entries b/mcast/dvbloop/.svn/entries new file mode 100644 index 0000000..27a2288 --- /dev/null +++ b/mcast/dvbloop/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +18963 +svn://reelbox.org/testing/src/vdr-plugins/src/mcli-1/mcast/dvbloop +svn://reelbox.org + + + +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + +12be777f-adf9-0310-842f-e37ecc4c7426 + +dvblo_char.h +file + + + + +2012-09-27T17:22:49.554848Z +7553ff59846c61f88d2c7171141787db +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + + + + + + + + +861 + +dvblo_util.h +file + + + + +2012-09-27T17:22:49.558848Z +46c77702134b5e6a2d12f523b6bc24c0 +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + + + + + + + + +1085 + +dvblo_adap_fe.h +file + + + + +2012-09-27T17:22:49.558848Z +46ddf82ea04127779d379b1322eb5917 +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + + + + + + + + +1061 + +dvblo.h +file + + + + +2012-09-27T17:22:49.558848Z +6e4aa28638d3a37d219f92cc767e622f +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + + + + + + + + +1653 + +dvblo_adap.h +file + + + + +2012-09-27T17:22:49.554848Z +fc1f91fe9ae2874f3f81208624d86a8a +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + + + + + + + + +3964 + +dvblo_adap_ca.h +file + + + + +2012-09-27T17:22:49.554848Z +63e84e959a0e8ca86b0b177cf02456bb +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + + + + + + + + +1063 + +dvblo_ioctl.h +file + + + + +2012-09-27T17:22:49.554848Z +89d6a7d362e0ccde5d23822e9a060187 +2011-07-13T10:29:48.841676Z +16920 +rollercoaster + + + + + + + + + + + + + + + + + + + + + +5102 + diff --git a/mcast/dvbloop/.svn/text-base/dvblo.h.svn-base b/mcast/dvbloop/.svn/text-base/dvblo.h.svn-base new file mode 100644 index 0000000..2ce7a4b --- /dev/null +++ b/mcast/dvbloop/.svn/text-base/dvblo.h.svn-base @@ -0,0 +1,58 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo.h + * Desc: Common Header File + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_H_ +#define _DVBLO_H_ + +#include <linux/stringify.h> + +#define DVBLO_NAME "dvblo" +#define DVBLO_VERSION "0.9.4" +#define DVBLO_LONGMANE "DVB Loopback Adapter Version "DVBLO_VERSION + +#define DVBLO_DEVMAX 8 + +#define DVBLO_TS_SZ 188 + +#define SUCCESS 0 + +/* DVBLO_DEFINE_GLOBALS is defined by the file which defines the global + * variables, which is usally dvblo.c. + */ +#ifndef DVBLO_DEFINE_GLOBALS +/* defined in dvblo.c */ +extern unsigned int dvblo_debug; +extern unsigned int dvblo_autocreate; + +#endif /* */ + +#define DVBLO_DEBUG_LEVELS 3 + +#define DBGLEV_ADAP DVBLO_DEBUG_LEVELS +#define DBGLEV_ADAP_FE (DBGLEV_ADAP+DVBLO_DEBUG_LEVELS) +#define DBGLEV_ADAP_CA (DBGLEV_ADAP_FE+DVBLO_DEBUG_LEVELS) +#define DBGLEV_CHAR (DBGLEV_ADAP_CA+DVBLO_DEBUG_LEVELS) + +#define DBGLEV_ALL 0 +#define DBGLEV_1 (1<<0) +#define DBGLEV_2 (1<<1) +#define DBGLEV_3 (1<<2) + +#define dprintk(level,args...) \ + do { if ((dvblo_debug & level) == level) { printk (KERN_DEBUG "%s: %s(): ", DVBLO_NAME, __FUNCTION__); printk (args); } } while (0) + +/*#define dprintk(level,args...) \ + do {{ printk(KERN_DEBUG "%s: %s(): ", __stringify(DVBLO_NAME), __FUNCTION__); printk(args); } } while (0) +*/ +#define mprintk(level, args...) \ + do { printk (level "%s: %s(): ", DVBLO_NAME, __FUNCTION__); printk (args); } while (0) + +#endif /* _DVBLO_H_ */ diff --git a/mcast/dvbloop/.svn/text-base/dvblo_adap.h.svn-base b/mcast/dvbloop/.svn/text-base/dvblo_adap.h.svn-base new file mode 100644 index 0000000..26f6bfc --- /dev/null +++ b/mcast/dvbloop/.svn/text-base/dvblo_adap.h.svn-base @@ -0,0 +1,155 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_adap.h + * Desc: Support for virtual DVB adapters + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_ADAP_H_ +#define _DVBLO_ADAP_H_ + +#include <linux/types.h> +#include "dvb-core/dvbdev.h" +#include "dvb-core/dvb_demux.h" +#include "dvb-core/dmxdev.h" +#include "dvb-core/dvb_net.h" +#include "dvb-core/dvb_frontend.h" +#include <linux/dvb/ca.h> +#include "dvblo_ioctl.h" + +struct dvblo_adap_statistics +{ + + /// Number of TS packets received on the adapter + unsigned long ts_count; +}; + +/** + * Structure that represents a virtual DVB adapter instance + * @todo rename this to dvblo_adap + */ +struct dvblo +{ + + /** + * Level of initialization + * This help dvblo_destroy() to determine which things have to be + * cleaned/unregistered as it is used by dvblo_init() when an error occurs + */ + unsigned int initlev:8; + + /// Flag that is set to 1 if this dvblo structure is completely initialized + unsigned int initdone:1; + + /// The name of this adapter, e.g. "dvblo_adap0" + char name[16]; + struct + { + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) + /* Since kernel version 2.6.12 the dvb_adapter structure has to be + * embedded into our structure + */ + struct dvb_adapter adap; + +#define DVBLO_DVB_ADAP(dvblop) (&(dvblop)->dvb.adap) +#else /* */ + struct dvb_adapter *adap; + +#define DVBLO_DVB_ADAP(dvblop) ((dvblop)->dvb.adap) +#endif /* */ + struct dvb_device *ca_dev; + struct dmxdev dmxdev; + struct dvb_demux demux; + struct dvb_net net; + struct dvb_frontend frontend; + + /* struct dvb_frontend: tuner_priv was added in 2.6.18 */ +#define FE_PRIV(fep) ((fep)->demodulator_priv) + +#define DVBLO_DVB_ADAP_FEPRIV(dvblop) FE_PRIV(&((dvblop)->dvb.frontend)) + struct dmx_frontend hw_frontend; + struct dmx_frontend mem_frontend; + } dvb; + + /// count, how many times dvblo_demux_start_feed() has been called + int feeding; + struct semaphore sem; + spinlock_t event_lock; + wait_queue_head_t event_queue; + unsigned int event; + struct dvblo_adap_statistics stats; + struct + { + struct dvb_frontend_parameters params; + struct + { + struct dvb_frontend_parameters params; + u32 status; + } tuner; + dvblo_sec_t sec; + dvblo_festatus_t status; + } fe; + + struct dvb_ringbuffer ci_rbuffer; + struct dvb_ringbuffer ci_wbuffer; + dvblo_cacaps_t ca; + + dvblo_private_t private; +}; + +/** + * Adapter configuration paramters + */ +struct dvblo_adap_config +{ + + /// Whether a MAC address is specified by this structure + unsigned int mac_valid:1; + + /// The MAC address of the DVB adapter (if mac_valid == 1) + u8 mac[6]; +}; + +/** + * Creates a new virtual DVB adapter + * @param adapnum The desired adapter number (set to -1 for automatic assignment) + * @param cfg Adapter configuration (may be NULL) + * @param dvblo_out A pointer to the newly allocated DVB adapter context is + * returned via this parameter + */ +int dvblo_adap_create (int adapnum, struct dvblo_adap_config *cfg, struct dvblo **dvblo_out); + +/** + * Destroys a virtual DVB adapter + */ +int dvblo_adap_destroy (struct dvblo *dvblo); + +/** + * Deliver TS packets to the virtual DVB adapter + * @param dvblo The dvblo adapter context + * @param buf Pointer to buffer containing TS packets + * @param len Length of buf in bytes + */ +ssize_t dvblo_adap_deliver_packets (struct dvblo *dvblo, const u8 * buf, size_t len); + +/** + * Handle event bitpattern without race conditions + */ +unsigned int dvblo_set_event (struct dvblo *dvblo, unsigned int event); + +/** + * Get list of currently active PIDs from DVB adapter + */ +int dvblog_adap_get_pids (struct dvblo *dvblo, dvblo_pids_t * pids_out); + +/** + * Get MAC address of virtual DVB adapter + */ +int dvblo_adap_get_mac (struct dvblo *dvblo, u8 * mac_out); + +#endif /* _DVBLO_ADAP_H_ */ diff --git a/mcast/dvbloop/.svn/text-base/dvblo_adap_ca.h.svn-base b/mcast/dvbloop/.svn/text-base/dvblo_adap_ca.h.svn-base new file mode 100644 index 0000000..192fa60 --- /dev/null +++ b/mcast/dvbloop/.svn/text-base/dvblo_adap_ca.h.svn-base @@ -0,0 +1,43 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Flieg + ----------------------------------------- + * File: dvblo_adap.c + * Desc: Support for virtual DVB adapters - Frontend implementation + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_ADAP_CA_H_ +#define _DVBLO_ADAP_CA_H_ + +#include "dvb-core/dvbdev.h" +#include "dvb-core/dvb_demux.h" +#include "dvb-core/dmxdev.h" +#include "dvb-core/dvb_net.h" +#include "dvb-core/dvb_frontend.h" +#include "dvb-core/dvb_ringbuffer.h" +#include "linux/dvb/ca.h" + +void ci_get_data(struct dvb_ringbuffer *cibuf, u8 *data, int len); + +/** + * Register new ca device + */ +int dvblo_ca_register(struct dvblo *dvblo); +/** + * Unregister ca device + */ +void dvblo_ca_unregister(struct dvblo *dvblo); +/** + * Initialize ca device + */ +int dvblo_ca_init(struct dvblo* dvblo); +/** + * Uninitialize ca device + */ +void dvblo_ca_exit(struct dvblo* dvblo); + + +#endif /* _DVBLO_ADAP_FE_H_ */ diff --git a/mcast/dvbloop/.svn/text-base/dvblo_adap_fe.h.svn-base b/mcast/dvbloop/.svn/text-base/dvblo_adap_fe.h.svn-base new file mode 100644 index 0000000..fcdef0d --- /dev/null +++ b/mcast/dvbloop/.svn/text-base/dvblo_adap_fe.h.svn-base @@ -0,0 +1,30 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Flieg + ----------------------------------------- + * File: dvblo_adap.c + * Desc: Support for virtual DVB adapters - Frontend implementation + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_ADAP_FE_H_ +#define _DVBLO_ADAP_FE_H_ + +#include "dvb-core/dvbdev.h" +#include "dvb-core/dvb_demux.h" +#include "dvb-core/dmxdev.h" +#include "dvb-core/dvb_net.h" +#include "dvb-core/dvb_frontend.h" +extern struct dvb_frontend_ops dvblo_adap_fe_ops; +int dvblo_fe_get_info (struct dvblo *dvblo, struct dvb_frontend_info *info); +int dvblo_fe_set_info (struct dvblo *dvblo, struct dvb_frontend_info *info); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +int dvblo_fe_get_tunerinfo (struct dvblo *dvblo, struct dvb_tuner_info *tunerinfo); +int dvblo_fe_set_tunerinfo (struct dvblo *dvblo, struct dvb_tuner_info *tunerinfo); + +#endif /* */ + +#endif /* _DVBLO_ADAP_FE_H_ */ diff --git a/mcast/dvbloop/.svn/text-base/dvblo_char.h.svn-base b/mcast/dvbloop/.svn/text-base/dvblo_char.h.svn-base new file mode 100644 index 0000000..41f5744 --- /dev/null +++ b/mcast/dvbloop/.svn/text-base/dvblo_char.h.svn-base @@ -0,0 +1,33 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_char.h + * Desc: Char device support for dvblo + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_CHAR_H_ +#define _DVBLO_CHAR_H_ + +#include "dvblo.h" +#include "dvblo_adap.h" + +/** + * Maximum number of devices + */ +#define DVBLO_CHAR_DEVMAX 8 +struct dvblo_chardev_config +{ + + /// The configuration for the corresponding virtual DVB adapter + struct dvblo_adap_config dvbcfg; +}; +int dvblo_char_init (void); +int dvblo_char_exit (void); +int dvblo_char_add_dev (struct dvblo_chardev_config *cfg, unsigned int *devnum_out); +int dvblo_char_del_dev (unsigned int devnum); + +#endif /* _DVBLO_CHAR_H_ */ diff --git a/mcast/dvbloop/.svn/text-base/dvblo_ioctl.h.svn-base b/mcast/dvbloop/.svn/text-base/dvblo_ioctl.h.svn-base new file mode 100644 index 0000000..08e737c --- /dev/null +++ b/mcast/dvbloop/.svn/text-base/dvblo_ioctl.h.svn-base @@ -0,0 +1,203 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_char.h + * Desc: Char device support for dvblo + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_IOCTL_H_ +#define _DVBLO_IOCTL_H_ + +#ifndef WIN32 +#include <linux/ioctl.h> +#endif +/** + * Maximum number of devices + */ +#define DVBLO_IOC_MAGIC 'd' +#define PRIV_DATA_SIZE 4096 +typedef struct +{ + u_int16_t pid[256]; + int num; +} dvblo_pids_t; +typedef struct dvblo_sec +{ + struct dvb_diseqc_master_cmd diseqc_cmd; + fe_sec_mini_cmd_t mini_cmd; + fe_sec_tone_mode_t tone_mode; + fe_sec_voltage_t voltage; +} dvblo_sec_t; +typedef struct dvblo_festatus +{ + fe_status_t st; + u_int32_t ber; + u_int16_t strength; + u_int16_t snr; + u_int32_t ucblocks; +} dvblo_festatus_t; +typedef unsigned char dvblo_private_t[PRIV_DATA_SIZE]; + +#define CA_MAX_SLOTS 16 +typedef struct { + ca_caps_t cap; + ca_slot_info_t info[CA_MAX_SLOTS]; +} dvblo_cacaps_t; + +#define CA_TPDU_MAX 2048 +typedef struct { + u_int16_t len; + u_int8_t data[CA_TPDU_MAX]; +} dvblo_tpdu_t; + +#define EV_MASK_FE 0x0000000f +#define EV_MASK_PID 0x000000f0 +#define EV_MASK_SEC 0x00000f00 +#define EV_MASK_PRIV 0x0000f000 +#define EV_MASK_CA 0x000f0000 + +#define EV_FRONTEND 0x00000001 +#define EV_TUNER 0x00000002 +#define EV_FREQUENCY 0x00000004 +#define EV_BANDWIDTH 0x00000008 + +#define EV_PIDFILTER 0x00000010 + +#define EV_TONE 0x00000100 +#define EV_VOLTAGE 0x00000200 +#define EV_DISEC_MSG 0x00000400 +#define EV_DISEC_BURST 0x00000800 + +#define EV_PRIV_READ 0x00001000 +#define EV_PRIV_WRITE 0x00002000 + +#define EV_CA_RESET 0x00010000 +#define EV_CA_WRITE 0x00020000 +#define EV_CA_PID 0x00040000 +#define EV_CA_DESCR 0x00080000 + +struct dvblo_ioc_dev +{ + + /// The MAC address of the virtual DVB adapter + u_int8_t mac[6]; + + /** + * This is set to the number of the new device when ioctl(DVBLO_IOCADDDEV) + * was successful. + * @note This corresponds to the minor device number. + */ + int num; +}; + +/** + * @brief Add a new DVBLoop adapter device + */ +#define DVBLO_IOCADDDEV _IO(DVBLO_IOC_MAGIC, 1) +/** + * @brief Remove the DVBLoop adapter device with the specified number + */ +#define DVBLO_IOCDELDEV _IO(DVBLO_IOC_MAGIC, 2) +/** + * @brief Check if DVBLoop adapter has a corresponding dvb device + */ +#define DVBLO_IOCCHECKDEV _IO(DVBLO_IOC_MAGIC, 30) +/** + * @brief Get event mask + */ +#define DVBLO_GET_EVENT_MASK _IOR(DVBLO_IOC_MAGIC, 3, unsigned int) +/** + * @brief Get FE parameters + */ +#define DVBLO_GET_FRONTEND_PARAMETERS _IOR(DVBLO_IOC_MAGIC, 4, struct dvb_frontend_parameters) +/** + * @brief Set FE parameters + */ +#define DVBLO_SET_FRONTEND_PARAMETERS _IOW(DVBLO_IOC_MAGIC, 4, struct dvb_frontend_parameters) +/** + * @brief Get tuner parameters + */ +#define DVBLO_GET_TUNER_PARAMETERS _IOR(DVBLO_IOC_MAGIC, 5, struct dvb_frontend_parameters) +/** + * @brief Set tuner parameters + */ +#define DVBLO_SET_TUNER_PARAMETERS _IOW(DVBLO_IOC_MAGIC, 5, struct dvb_frontend_parameters) +/** + * @brief Get SEC parameters + */ +#define DVBLO_GET_SEC_PARAMETERS _IOR(DVBLO_IOC_MAGIC, 6, struct dvblo_sec) +/** + * @brief Get SEC parameters + */ +#define DVBLO_SET_SEC_PARAMETERS _IOW(DVBLO_IOC_MAGIC, 6, struct dvblo_sec) +/** + * @brief Set FE-Status parameters + */ +#define DVBLO_GET_FRONTEND_STATUS _IOR(DVBLO_IOC_MAGIC, 7, struct dvblo_festatus) +/** + * @brief Set Tuner-Status parameters + */ +#define DVBLO_SET_FRONTEND_STATUS _IOW(DVBLO_IOC_MAGIC, 7, struct dvblo_festatus) +/** + * @brief Get Tuner-Status parameters + */ +#define DVBLO_GET_TUNER_STATUS _IOR(DVBLO_IOC_MAGIC, 8, u_int32_t) +/** + * @brief Set Tuner-Status parameters + */ +#define DVBLO_SET_TUNER_STATUS _IOW(DVBLO_IOC_MAGIC, 8, u_int32_t) +/** + * @brief Set FE-Info + */ +#define DVBLO_GET_FRONTEND_INFO _IOR(DVBLO_IOC_MAGIC, 9, struct dvb_frontend_info) +/** + * @brief Set FE-Info + */ +#define DVBLO_SET_FRONTEND_INFO _IOW(DVBLO_IOC_MAGIC, 9, struct dvb_frontend_info) + +#ifndef WIN32 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +/** + * @brief Set Tuner-Info + */ +#define DVBLO_GET_TUNER_INFO _IOR(DVBLO_IOC_MAGIC, 10, struct dvb_tuner_info) +/** + * @brief Set Tuner-Info + */ +#define DVBLO_SET_TUNER_INFO _IOW(DVBLO_IOC_MAGIC, 10, struct dvb_tuner_info) +#endif /* */ +/** + * @brief Get list of PIDS + */ +#define DVBLO_GET_PIDLIST _IOR(DVBLO_IOC_MAGIC, 20, dvblo_pids_t) +/** + * @brief Pass through of private data + */ +#define DVBLO_GET_PRIVATE _IOR(DVBLO_IOC_MAGIC, 40, dvblo_private_t) +/** + * @brief Pass through of private data + */ +#define DVBLO_SET_PRIVATE _IOW(DVBLO_IOC_MAGIC, 40, dvblo_private_t) +/** + * @brief Get CA_CAPS including slot_info + */ +#define DVBLO_GET_CA_CAPS _IOR(DVBLO_IOC_MAGIC, 80, dvblo_cacaps_t) +/** + * @brief Set CA_CAPS including slot_info + */ +#define DVBLO_SET_CA_CAPS _IOW(DVBLO_IOC_MAGIC, 80, dvblo_cacaps_t) +/** + * @brief Get TPDU + */ +#define DVBLO_GET_TPDU _IOR(DVBLO_IOC_MAGIC, 81, dvblo_tpdu_t) +/** + * @brief Send TPDU + */ +#define DVBLO_SET_TPDU _IOW(DVBLO_IOC_MAGIC, 81, dvblo_tpdu_t) + +#endif /* _DVBLO_IOCTL_H_ */ +#endif diff --git a/mcast/dvbloop/.svn/text-base/dvblo_util.h.svn-base b/mcast/dvbloop/.svn/text-base/dvblo_util.h.svn-base new file mode 100644 index 0000000..e86bfa6 --- /dev/null +++ b/mcast/dvbloop/.svn/text-base/dvblo_util.h.svn-base @@ -0,0 +1,45 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_char.h + * Desc: Char device support for dvblo + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_UTIL_H_ +#define _DVBLO_UTIL_H_ + +#include <linux/types.h> +int dvblo_parse_mac (const char *macstr, u8 * mac_out); + +#if 0 +/** + * Ring buffer implementation + * @todo maybe use kfifo which is provided by Linux kernels >= 2.6.10 + */ +struct dvblo_ringbuf +{ + u8 *buf; + size_t size; + unsigned int wr; + unsigned int rd; +}; +typedef struct dvblo_ringbuf dvblo_ringbuf_t; +static inline int dvblo_rb_alloc (size_t size, dvblo_ringbuf_t * rb_out) +{ + rb_out->buf = kmalloc (size, GFP_KERNEL); + if (rb_out->buf == NULL) + return -ENOMEM; + + else { + rb_out->size = size; + rb_out->in = rb_out->out = 0; + } + return 0; +} +static inline ssize_t dvblo_rb_write (dvblo_ringbuf_t * rb_out, +#endif /* */ +#endif /* _DVBLO_UTIL_H_ */ diff --git a/mcast/dvbloop/dvblo.h b/mcast/dvbloop/dvblo.h new file mode 100644 index 0000000..2ce7a4b --- /dev/null +++ b/mcast/dvbloop/dvblo.h @@ -0,0 +1,58 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo.h + * Desc: Common Header File + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_H_ +#define _DVBLO_H_ + +#include <linux/stringify.h> + +#define DVBLO_NAME "dvblo" +#define DVBLO_VERSION "0.9.4" +#define DVBLO_LONGMANE "DVB Loopback Adapter Version "DVBLO_VERSION + +#define DVBLO_DEVMAX 8 + +#define DVBLO_TS_SZ 188 + +#define SUCCESS 0 + +/* DVBLO_DEFINE_GLOBALS is defined by the file which defines the global + * variables, which is usally dvblo.c. + */ +#ifndef DVBLO_DEFINE_GLOBALS +/* defined in dvblo.c */ +extern unsigned int dvblo_debug; +extern unsigned int dvblo_autocreate; + +#endif /* */ + +#define DVBLO_DEBUG_LEVELS 3 + +#define DBGLEV_ADAP DVBLO_DEBUG_LEVELS +#define DBGLEV_ADAP_FE (DBGLEV_ADAP+DVBLO_DEBUG_LEVELS) +#define DBGLEV_ADAP_CA (DBGLEV_ADAP_FE+DVBLO_DEBUG_LEVELS) +#define DBGLEV_CHAR (DBGLEV_ADAP_CA+DVBLO_DEBUG_LEVELS) + +#define DBGLEV_ALL 0 +#define DBGLEV_1 (1<<0) +#define DBGLEV_2 (1<<1) +#define DBGLEV_3 (1<<2) + +#define dprintk(level,args...) \ + do { if ((dvblo_debug & level) == level) { printk (KERN_DEBUG "%s: %s(): ", DVBLO_NAME, __FUNCTION__); printk (args); } } while (0) + +/*#define dprintk(level,args...) \ + do {{ printk(KERN_DEBUG "%s: %s(): ", __stringify(DVBLO_NAME), __FUNCTION__); printk(args); } } while (0) +*/ +#define mprintk(level, args...) \ + do { printk (level "%s: %s(): ", DVBLO_NAME, __FUNCTION__); printk (args); } while (0) + +#endif /* _DVBLO_H_ */ diff --git a/mcast/dvbloop/dvblo_adap.h b/mcast/dvbloop/dvblo_adap.h new file mode 100644 index 0000000..26f6bfc --- /dev/null +++ b/mcast/dvbloop/dvblo_adap.h @@ -0,0 +1,155 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_adap.h + * Desc: Support for virtual DVB adapters + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_ADAP_H_ +#define _DVBLO_ADAP_H_ + +#include <linux/types.h> +#include "dvb-core/dvbdev.h" +#include "dvb-core/dvb_demux.h" +#include "dvb-core/dmxdev.h" +#include "dvb-core/dvb_net.h" +#include "dvb-core/dvb_frontend.h" +#include <linux/dvb/ca.h> +#include "dvblo_ioctl.h" + +struct dvblo_adap_statistics +{ + + /// Number of TS packets received on the adapter + unsigned long ts_count; +}; + +/** + * Structure that represents a virtual DVB adapter instance + * @todo rename this to dvblo_adap + */ +struct dvblo +{ + + /** + * Level of initialization + * This help dvblo_destroy() to determine which things have to be + * cleaned/unregistered as it is used by dvblo_init() when an error occurs + */ + unsigned int initlev:8; + + /// Flag that is set to 1 if this dvblo structure is completely initialized + unsigned int initdone:1; + + /// The name of this adapter, e.g. "dvblo_adap0" + char name[16]; + struct + { + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) + /* Since kernel version 2.6.12 the dvb_adapter structure has to be + * embedded into our structure + */ + struct dvb_adapter adap; + +#define DVBLO_DVB_ADAP(dvblop) (&(dvblop)->dvb.adap) +#else /* */ + struct dvb_adapter *adap; + +#define DVBLO_DVB_ADAP(dvblop) ((dvblop)->dvb.adap) +#endif /* */ + struct dvb_device *ca_dev; + struct dmxdev dmxdev; + struct dvb_demux demux; + struct dvb_net net; + struct dvb_frontend frontend; + + /* struct dvb_frontend: tuner_priv was added in 2.6.18 */ +#define FE_PRIV(fep) ((fep)->demodulator_priv) + +#define DVBLO_DVB_ADAP_FEPRIV(dvblop) FE_PRIV(&((dvblop)->dvb.frontend)) + struct dmx_frontend hw_frontend; + struct dmx_frontend mem_frontend; + } dvb; + + /// count, how many times dvblo_demux_start_feed() has been called + int feeding; + struct semaphore sem; + spinlock_t event_lock; + wait_queue_head_t event_queue; + unsigned int event; + struct dvblo_adap_statistics stats; + struct + { + struct dvb_frontend_parameters params; + struct + { + struct dvb_frontend_parameters params; + u32 status; + } tuner; + dvblo_sec_t sec; + dvblo_festatus_t status; + } fe; + + struct dvb_ringbuffer ci_rbuffer; + struct dvb_ringbuffer ci_wbuffer; + dvblo_cacaps_t ca; + + dvblo_private_t private; +}; + +/** + * Adapter configuration paramters + */ +struct dvblo_adap_config +{ + + /// Whether a MAC address is specified by this structure + unsigned int mac_valid:1; + + /// The MAC address of the DVB adapter (if mac_valid == 1) + u8 mac[6]; +}; + +/** + * Creates a new virtual DVB adapter + * @param adapnum The desired adapter number (set to -1 for automatic assignment) + * @param cfg Adapter configuration (may be NULL) + * @param dvblo_out A pointer to the newly allocated DVB adapter context is + * returned via this parameter + */ +int dvblo_adap_create (int adapnum, struct dvblo_adap_config *cfg, struct dvblo **dvblo_out); + +/** + * Destroys a virtual DVB adapter + */ +int dvblo_adap_destroy (struct dvblo *dvblo); + +/** + * Deliver TS packets to the virtual DVB adapter + * @param dvblo The dvblo adapter context + * @param buf Pointer to buffer containing TS packets + * @param len Length of buf in bytes + */ +ssize_t dvblo_adap_deliver_packets (struct dvblo *dvblo, const u8 * buf, size_t len); + +/** + * Handle event bitpattern without race conditions + */ +unsigned int dvblo_set_event (struct dvblo *dvblo, unsigned int event); + +/** + * Get list of currently active PIDs from DVB adapter + */ +int dvblog_adap_get_pids (struct dvblo *dvblo, dvblo_pids_t * pids_out); + +/** + * Get MAC address of virtual DVB adapter + */ +int dvblo_adap_get_mac (struct dvblo *dvblo, u8 * mac_out); + +#endif /* _DVBLO_ADAP_H_ */ diff --git a/mcast/dvbloop/dvblo_adap_ca.h b/mcast/dvbloop/dvblo_adap_ca.h new file mode 100644 index 0000000..192fa60 --- /dev/null +++ b/mcast/dvbloop/dvblo_adap_ca.h @@ -0,0 +1,43 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Flieg + ----------------------------------------- + * File: dvblo_adap.c + * Desc: Support for virtual DVB adapters - Frontend implementation + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_ADAP_CA_H_ +#define _DVBLO_ADAP_CA_H_ + +#include "dvb-core/dvbdev.h" +#include "dvb-core/dvb_demux.h" +#include "dvb-core/dmxdev.h" +#include "dvb-core/dvb_net.h" +#include "dvb-core/dvb_frontend.h" +#include "dvb-core/dvb_ringbuffer.h" +#include "linux/dvb/ca.h" + +void ci_get_data(struct dvb_ringbuffer *cibuf, u8 *data, int len); + +/** + * Register new ca device + */ +int dvblo_ca_register(struct dvblo *dvblo); +/** + * Unregister ca device + */ +void dvblo_ca_unregister(struct dvblo *dvblo); +/** + * Initialize ca device + */ +int dvblo_ca_init(struct dvblo* dvblo); +/** + * Uninitialize ca device + */ +void dvblo_ca_exit(struct dvblo* dvblo); + + +#endif /* _DVBLO_ADAP_FE_H_ */ diff --git a/mcast/dvbloop/dvblo_adap_fe.h b/mcast/dvbloop/dvblo_adap_fe.h new file mode 100644 index 0000000..fcdef0d --- /dev/null +++ b/mcast/dvbloop/dvblo_adap_fe.h @@ -0,0 +1,30 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Flieg + ----------------------------------------- + * File: dvblo_adap.c + * Desc: Support for virtual DVB adapters - Frontend implementation + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_ADAP_FE_H_ +#define _DVBLO_ADAP_FE_H_ + +#include "dvb-core/dvbdev.h" +#include "dvb-core/dvb_demux.h" +#include "dvb-core/dmxdev.h" +#include "dvb-core/dvb_net.h" +#include "dvb-core/dvb_frontend.h" +extern struct dvb_frontend_ops dvblo_adap_fe_ops; +int dvblo_fe_get_info (struct dvblo *dvblo, struct dvb_frontend_info *info); +int dvblo_fe_set_info (struct dvblo *dvblo, struct dvb_frontend_info *info); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +int dvblo_fe_get_tunerinfo (struct dvblo *dvblo, struct dvb_tuner_info *tunerinfo); +int dvblo_fe_set_tunerinfo (struct dvblo *dvblo, struct dvb_tuner_info *tunerinfo); + +#endif /* */ + +#endif /* _DVBLO_ADAP_FE_H_ */ diff --git a/mcast/dvbloop/dvblo_char.h b/mcast/dvbloop/dvblo_char.h new file mode 100644 index 0000000..41f5744 --- /dev/null +++ b/mcast/dvbloop/dvblo_char.h @@ -0,0 +1,33 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_char.h + * Desc: Char device support for dvblo + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_CHAR_H_ +#define _DVBLO_CHAR_H_ + +#include "dvblo.h" +#include "dvblo_adap.h" + +/** + * Maximum number of devices + */ +#define DVBLO_CHAR_DEVMAX 8 +struct dvblo_chardev_config +{ + + /// The configuration for the corresponding virtual DVB adapter + struct dvblo_adap_config dvbcfg; +}; +int dvblo_char_init (void); +int dvblo_char_exit (void); +int dvblo_char_add_dev (struct dvblo_chardev_config *cfg, unsigned int *devnum_out); +int dvblo_char_del_dev (unsigned int devnum); + +#endif /* _DVBLO_CHAR_H_ */ diff --git a/mcast/dvbloop/dvblo_ioctl.h b/mcast/dvbloop/dvblo_ioctl.h new file mode 100644 index 0000000..08e737c --- /dev/null +++ b/mcast/dvbloop/dvblo_ioctl.h @@ -0,0 +1,203 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_char.h + * Desc: Char device support for dvblo + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_IOCTL_H_ +#define _DVBLO_IOCTL_H_ + +#ifndef WIN32 +#include <linux/ioctl.h> +#endif +/** + * Maximum number of devices + */ +#define DVBLO_IOC_MAGIC 'd' +#define PRIV_DATA_SIZE 4096 +typedef struct +{ + u_int16_t pid[256]; + int num; +} dvblo_pids_t; +typedef struct dvblo_sec +{ + struct dvb_diseqc_master_cmd diseqc_cmd; + fe_sec_mini_cmd_t mini_cmd; + fe_sec_tone_mode_t tone_mode; + fe_sec_voltage_t voltage; +} dvblo_sec_t; +typedef struct dvblo_festatus +{ + fe_status_t st; + u_int32_t ber; + u_int16_t strength; + u_int16_t snr; + u_int32_t ucblocks; +} dvblo_festatus_t; +typedef unsigned char dvblo_private_t[PRIV_DATA_SIZE]; + +#define CA_MAX_SLOTS 16 +typedef struct { + ca_caps_t cap; + ca_slot_info_t info[CA_MAX_SLOTS]; +} dvblo_cacaps_t; + +#define CA_TPDU_MAX 2048 +typedef struct { + u_int16_t len; + u_int8_t data[CA_TPDU_MAX]; +} dvblo_tpdu_t; + +#define EV_MASK_FE 0x0000000f +#define EV_MASK_PID 0x000000f0 +#define EV_MASK_SEC 0x00000f00 +#define EV_MASK_PRIV 0x0000f000 +#define EV_MASK_CA 0x000f0000 + +#define EV_FRONTEND 0x00000001 +#define EV_TUNER 0x00000002 +#define EV_FREQUENCY 0x00000004 +#define EV_BANDWIDTH 0x00000008 + +#define EV_PIDFILTER 0x00000010 + +#define EV_TONE 0x00000100 +#define EV_VOLTAGE 0x00000200 +#define EV_DISEC_MSG 0x00000400 +#define EV_DISEC_BURST 0x00000800 + +#define EV_PRIV_READ 0x00001000 +#define EV_PRIV_WRITE 0x00002000 + +#define EV_CA_RESET 0x00010000 +#define EV_CA_WRITE 0x00020000 +#define EV_CA_PID 0x00040000 +#define EV_CA_DESCR 0x00080000 + +struct dvblo_ioc_dev +{ + + /// The MAC address of the virtual DVB adapter + u_int8_t mac[6]; + + /** + * This is set to the number of the new device when ioctl(DVBLO_IOCADDDEV) + * was successful. + * @note This corresponds to the minor device number. + */ + int num; +}; + +/** + * @brief Add a new DVBLoop adapter device + */ +#define DVBLO_IOCADDDEV _IO(DVBLO_IOC_MAGIC, 1) +/** + * @brief Remove the DVBLoop adapter device with the specified number + */ +#define DVBLO_IOCDELDEV _IO(DVBLO_IOC_MAGIC, 2) +/** + * @brief Check if DVBLoop adapter has a corresponding dvb device + */ +#define DVBLO_IOCCHECKDEV _IO(DVBLO_IOC_MAGIC, 30) +/** + * @brief Get event mask + */ +#define DVBLO_GET_EVENT_MASK _IOR(DVBLO_IOC_MAGIC, 3, unsigned int) +/** + * @brief Get FE parameters + */ +#define DVBLO_GET_FRONTEND_PARAMETERS _IOR(DVBLO_IOC_MAGIC, 4, struct dvb_frontend_parameters) +/** + * @brief Set FE parameters + */ +#define DVBLO_SET_FRONTEND_PARAMETERS _IOW(DVBLO_IOC_MAGIC, 4, struct dvb_frontend_parameters) +/** + * @brief Get tuner parameters + */ +#define DVBLO_GET_TUNER_PARAMETERS _IOR(DVBLO_IOC_MAGIC, 5, struct dvb_frontend_parameters) +/** + * @brief Set tuner parameters + */ +#define DVBLO_SET_TUNER_PARAMETERS _IOW(DVBLO_IOC_MAGIC, 5, struct dvb_frontend_parameters) +/** + * @brief Get SEC parameters + */ +#define DVBLO_GET_SEC_PARAMETERS _IOR(DVBLO_IOC_MAGIC, 6, struct dvblo_sec) +/** + * @brief Get SEC parameters + */ +#define DVBLO_SET_SEC_PARAMETERS _IOW(DVBLO_IOC_MAGIC, 6, struct dvblo_sec) +/** + * @brief Set FE-Status parameters + */ +#define DVBLO_GET_FRONTEND_STATUS _IOR(DVBLO_IOC_MAGIC, 7, struct dvblo_festatus) +/** + * @brief Set Tuner-Status parameters + */ +#define DVBLO_SET_FRONTEND_STATUS _IOW(DVBLO_IOC_MAGIC, 7, struct dvblo_festatus) +/** + * @brief Get Tuner-Status parameters + */ +#define DVBLO_GET_TUNER_STATUS _IOR(DVBLO_IOC_MAGIC, 8, u_int32_t) +/** + * @brief Set Tuner-Status parameters + */ +#define DVBLO_SET_TUNER_STATUS _IOW(DVBLO_IOC_MAGIC, 8, u_int32_t) +/** + * @brief Set FE-Info + */ +#define DVBLO_GET_FRONTEND_INFO _IOR(DVBLO_IOC_MAGIC, 9, struct dvb_frontend_info) +/** + * @brief Set FE-Info + */ +#define DVBLO_SET_FRONTEND_INFO _IOW(DVBLO_IOC_MAGIC, 9, struct dvb_frontend_info) + +#ifndef WIN32 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +/** + * @brief Set Tuner-Info + */ +#define DVBLO_GET_TUNER_INFO _IOR(DVBLO_IOC_MAGIC, 10, struct dvb_tuner_info) +/** + * @brief Set Tuner-Info + */ +#define DVBLO_SET_TUNER_INFO _IOW(DVBLO_IOC_MAGIC, 10, struct dvb_tuner_info) +#endif /* */ +/** + * @brief Get list of PIDS + */ +#define DVBLO_GET_PIDLIST _IOR(DVBLO_IOC_MAGIC, 20, dvblo_pids_t) +/** + * @brief Pass through of private data + */ +#define DVBLO_GET_PRIVATE _IOR(DVBLO_IOC_MAGIC, 40, dvblo_private_t) +/** + * @brief Pass through of private data + */ +#define DVBLO_SET_PRIVATE _IOW(DVBLO_IOC_MAGIC, 40, dvblo_private_t) +/** + * @brief Get CA_CAPS including slot_info + */ +#define DVBLO_GET_CA_CAPS _IOR(DVBLO_IOC_MAGIC, 80, dvblo_cacaps_t) +/** + * @brief Set CA_CAPS including slot_info + */ +#define DVBLO_SET_CA_CAPS _IOW(DVBLO_IOC_MAGIC, 80, dvblo_cacaps_t) +/** + * @brief Get TPDU + */ +#define DVBLO_GET_TPDU _IOR(DVBLO_IOC_MAGIC, 81, dvblo_tpdu_t) +/** + * @brief Send TPDU + */ +#define DVBLO_SET_TPDU _IOW(DVBLO_IOC_MAGIC, 81, dvblo_tpdu_t) + +#endif /* _DVBLO_IOCTL_H_ */ +#endif diff --git a/mcast/dvbloop/dvblo_util.h b/mcast/dvbloop/dvblo_util.h new file mode 100644 index 0000000..e86bfa6 --- /dev/null +++ b/mcast/dvbloop/dvblo_util.h @@ -0,0 +1,45 @@ +/* dvbloop - A DVB Loopback Device + * Copyright (C) 2006 Christian Praehauser, Deti Fliegl + ----------------------------------------- + * File: dvblo_char.h + * Desc: Char device support for dvblo + * Date: October 2006 + * Author: Christian Praehauser <cpreahaus@cosy.sbg.ac.at>, Deti Fliegl <deti@fliegl.de> + * + * This file is released under the GPLv2. + */ + +#ifndef _DVBLO_UTIL_H_ +#define _DVBLO_UTIL_H_ + +#include <linux/types.h> +int dvblo_parse_mac (const char *macstr, u8 * mac_out); + +#if 0 +/** + * Ring buffer implementation + * @todo maybe use kfifo which is provided by Linux kernels >= 2.6.10 + */ +struct dvblo_ringbuf +{ + u8 *buf; + size_t size; + unsigned int wr; + unsigned int rd; +}; +typedef struct dvblo_ringbuf dvblo_ringbuf_t; +static inline int dvblo_rb_alloc (size_t size, dvblo_ringbuf_t * rb_out) +{ + rb_out->buf = kmalloc (size, GFP_KERNEL); + if (rb_out->buf == NULL) + return -ENOMEM; + + else { + rb_out->size = size; + rb_out->in = rb_out->out = 0; + } + return 0; +} +static inline ssize_t dvblo_rb_write (dvblo_ringbuf_t * rb_out, +#endif /* */ +#endif /* _DVBLO_UTIL_H_ */ |