pike.git / src / modules / DVB / dvb.c

version» Context lines:

pike.git/src/modules/DVB/dvb.c:16:    *    * Distro: aconfig.h (automake-> config.h.in), configure.in, Makefile.in    *    * Todo:    * - remove crc32 table and use Gz.crc32() call    * - "Frontend", "Mux" ...    */      #include "config.h"   #include "module.h" + #include "module_support.h"      #ifdef HAVE_DVB    - #include <stdio.h> +    #include <stdlib.h>   #include <limits.h>   #include <string.h>   #include <errno.h>   #include <sys/ioctl.h>   #include <sys/types.h>   #include <sys/stat.h>   #include <sys/poll.h>   #include <fcntl.h>   #include <time.h>
pike.git/src/modules/DVB/dvb.c:59:   # include <ost/frontend.h>   # include <ost/dmx.h>   # include <ost/audio.h>   # define SECDEVICE "/dev/ost/sec"   # define FRONTENDDEVICE "/dev/ost/frontend"   # define DEMUXDEVICE "/dev/ost/demux"   # define AUDIODEVICE "/dev/ost/audio"   #endif      #include "interpret.h" - #include "svalue.h" - #include "stralloc.h" - #include "array.h" - #include "object.h" - #include "mapping.h" +    #include "pike_macros.h"   #include "threads.h"   #include "fd_control.h" - #include "module_support.h" +    #include "builtin_functions.h"   #include "operators.h" -  + #include "pike_types.h"      #include "dvb.h"      #if HAVE_DVB >= 30   /* Compat with old DVB. */   /* frontend.h */   typedef struct dvb_frontend_info FrontendInfo;   typedef struct dvb_frontend_parameters FrontendParameters;   typedef struct dvb_frontend_event FrontendEvent;   #define minFrequency frequency_min
pike.git/src/modules/DVB/dvb.c:97:   /* audio.h */   typedef audio_status_t audioStatus_t;   typedef audio_mixer_t audioMixer_t;   #define AVSyncState AV_sync_state   #define muteState mute_state   #define playState play_state   #define streamSource stream_source   #define channelSelect channel_select   #define bypassMode bypass_mode   /* dmx.h */ - typedef __u16 dvb_pid_t; + typedef unsigned INT16 dvb_pid_t;   #define dmxSctFilterParams dmx_sct_filter_params   #define dmxPesFilterParams dmx_pes_filter_params   #define pesType pes_type   #endif      /* WARNING: It is a design limit of DVB-S full cards! */   #define MAX_PES_FD 8      #define _DMX_PES_RDS 129   
pike.git/src/modules/DVB/dvb.c:218:    while(st != NULL && st->pid != pid)    st = st->next;    if(st == NULL)    return 0;    return st;      }      static char devname_buf[24];    - static INLINE char *mk_devname(int devno, const char *basename) { + static inline char *mk_devname(int devno, const char *basename) {    sprintf(devname_buf, "%s%d", basename, devno); /* FIXME: uncorrect for v2.0+ !! */    return devname_buf;   }         /*! @module DVB    *!    *! Implements Digital Video Broadcasting interface    *!    *! @note
pike.git/src/modules/DVB/dvb.c:322:    uint32_t status;    int cnt = 0, ret;       pop_n_elems(args);    THREADS_ALLOW();    ret = ioctl(dvb->fefd, FE_READ_STATUS, &status);    THREADS_DISALLOW();    if(ret < 0)    push_int(0);    else { -  push_text("signal"); push_int(!!(status & ~FE_HAS_SIGNAL)); -  push_text("carrier"); push_int(!!(status & ~FE_HAS_CARRIER)); -  push_text("viterbi"); push_int(!!(status & ~FE_HAS_VITERBI)); -  push_text("lock"); push_int(!!(status & ~FE_HAS_LOCK)); -  push_text("sync"); push_int(!!(status & ~FE_HAS_SYNC)); +  push_static_text("signal"); push_int(!!(status & ~FE_HAS_SIGNAL)); +  push_static_text("carrier"); push_int(!!(status & ~FE_HAS_CARRIER)); +  push_static_text("viterbi"); push_int(!!(status & ~FE_HAS_VITERBI)); +  push_static_text("lock"); push_int(!!(status & ~FE_HAS_LOCK)); +  push_static_text("sync"); push_int(!!(status & ~FE_HAS_SYNC));    cnt = 5;    /*push_text("spectrum_inverse"); push_int(status & ~FE_HAS_SPECTRUM_INV);*/   #if HAVE_DVB < 30 -  push_text("power"); push_int(!!(status & ~FE_HAS_POWER)); -  push_text("tuner_lock"); push_int(!!(status & ~FE_TUNER_HAS_LOCK)); +  push_static_text("power"); push_int(!!(status & ~FE_HAS_POWER)); +  push_static_text("tuner_lock"); push_int(!!(status & ~FE_TUNER_HAS_LOCK));    cnt += 2;   #endif    THREADS_ALLOW();    ret = ioctl(dvb->fefd, FE_READ_BER, &status);    THREADS_DISALLOW();    if(ret > -1) { -  push_text("ber"); push_int(status); +  push_static_text("ber"); push_int(status);    cnt++;    }    THREADS_ALLOW();    ret = ioctl(dvb->fefd, FE_READ_SNR, &status);    THREADS_DISALLOW();    if(ret > -1) { -  push_text("snr"); push_int(status); +  push_static_text("snr"); push_int(status);    cnt++;    }    THREADS_ALLOW();    ret = ioctl(dvb->fefd, FE_READ_SIGNAL_STRENGTH, &status);    THREADS_DISALLOW();    if(ret > -1) { -  push_text("signal_strength"); push_int(status); +  push_static_text("signal_strength"); push_int(status);    cnt++;    }       f_aggregate_mapping(2 * cnt);    }   }      /*! @decl mapping fe_info()    *!    *! Return info of a frondend device.
pike.git/src/modules/DVB/dvb.c:381:    FrontendInfo info;    int ret;       pop_n_elems(args);    THREADS_ALLOW();    ret = ioctl(dvb->fefd, FE_GET_INFO, &info);    THREADS_DISALLOW();    if(ret < 0)    push_int(0);    else { -  push_text("frequency"); -  push_text("min"); +  push_static_text("frequency"); +  push_static_text("min");    push_int(info.minFrequency); -  push_text("max"); +  push_static_text("max");    push_int(info.maxFrequency);    f_aggregate_mapping(2 * 2); -  push_text("sr"); -  push_text("min"); +  push_static_text("sr"); +  push_static_text("min");    push_int(info.minSymbolRate); -  push_text("max"); +  push_static_text("max");    push_int(info.maxSymbolRate);    f_aggregate_mapping(2 * 2); -  push_text("hardware"); -  push_text("type"); +  push_static_text("hardware"); +  ref_push_string(literal_type_string);    push_int(info.hwType);   #if HAVE_DVB < 30 -  push_text("version"); +  push_static_text("version");    push_int(info.hwVersion);    f_aggregate_mapping(2 * 2);   #else    /* FIXME: Where is the version in the new DVB API? */    f_aggregate_mapping(1 * 2);   #endif    f_aggregate_mapping(2 * 3);    }   }   
pike.git/src/modules/DVB/dvb.c:548:    uint ifreq;    int hiband, result;    FrontendInfo fe_info;       int satno;    uint freq;    int pol;    uint sr;    char *devname;    -  check_all_args("DVB.dvb->tune", args, BIT_INT, BIT_INT, BIT_INT | BIT_STRING, +  check_all_args(NULL, args, BIT_INT, BIT_INT, BIT_INT | BIT_STRING,    BIT_INT, 0);       sr = (u_short)Pike_sp[-1].u.integer * 1000;    Pike_sp--;       if(TYPEOF(Pike_sp[-1]) == T_INT)    pol = (u_short)Pike_sp[-1].u.integer;    else    pol = Pike_sp[-1].u.string->str[0] == 'V' ||    Pike_sp[-1].u.string->str[0] == 'v';
pike.git/src/modules/DVB/dvb.c:635:    dmx = DVB->stream->fd;    /* get the current PID settings */    THREADS_ALLOW();    ret = ioctl(dmx, DMX_GET_PES_PIDS, &pids);    THREADS_DISALLOW();    if (ret) {    Pike_error("GET PIDS failed.\n");    }       if(DVB->cardn != -1) { -  push_text("audio"); push_int( pids[DMX_PES_AUDIO] & 0x1fff ); +  push_static_text("audio"); push_int( pids[DMX_PES_AUDIO] & 0x1fff );    cnt++; -  push_text("video"); push_int( pids[DMX_PES_VIDEO] & 0x1fff ); +  push_static_text("video"); push_int( pids[DMX_PES_VIDEO] & 0x1fff );    cnt++; -  push_text("teletext"); push_int( pids[DMX_PES_TELETEXT] & 0x1fff ); +  push_static_text("teletext"); push_int( pids[DMX_PES_TELETEXT] & 0x1fff );    cnt++; -  push_text("subtitle"); push_int( pids[DMX_PES_SUBTITLE] & 0x1fff ); +  push_static_text("subtitle"); push_int( pids[DMX_PES_SUBTITLE] & 0x1fff );    cnt++; -  push_text("pcr"); push_int( pids[DMX_PES_PCR] & 0x1fff ); +  push_static_text("pcr"); push_int( pids[DMX_PES_PCR] & 0x1fff );    cnt++;    f_aggregate_mapping( 2 * cnt );    } else    push_int(0);    if(!sl_count(DVB))    close(dmx);   }         
pike.git/src/modules/DVB/dvb.c:794:       THREADS_ALLOW();    n = read(fd,buffer+1,length-1);    THREADS_DISALLOW();    if (n < 0)    {    perror("read error");    return -1;    }    -  if (cks && crc32(buffer+1,n) != 0) +  if (cks && crc32((char *)buffer+1,n) != 0)    {    fprintf(stderr,"crc error\n"); /* FIXME: ??? */    continue;    }       break;    }       return n+1;   }
pike.git/src/modules/DVB/dvb.c:940:    case IRDETO_CA_SYSTEM:    case BETA_CA_SYSTEM:    e = malloc(sizeof(struct ECMINFO));    if (e == NULL)    return;    e->system = ca_system;    e->name = irdeto_name;    e->ecm_pid = ((data[2] & 0x1f) << 8) | data[3];    e->next = st->ecminfo;    st->ecminfo = e; - /* printf("Found irdeto\n"); */ +     break;    case NAGRA_CA_SYSTEM:    e = malloc(sizeof(struct ECMINFO));    if (e == NULL)    return;    e->system = ca_system;    e->name = nagra_name;    e->ecm_pid = ((data[2] & 0x1f) << 8) | data[3];    e->next = st->ecminfo;    st->ecminfo = e; - /* fprintf(stderr,"Found nagra\n"); */ +     break;    }   #ifdef DVB_DEBUG    while(e != NULL)    printf("DEB: dvb: ecminfo: system=%s, ecm_pid=%d, id=%d\n", e->name,    e->ecm_pid, e->id);   #endif   }      /*! @decl array(mapping)|int analyze_pmt(int sid, int prognum)
pike.git/src/modules/DVB/dvb.c:985:       int pnr = -1;       int program_number;    int pmt_pid;    int dmx;    dvb_stream_data stream;    char *devname;    int cnt = 0, arr = 0;    -  check_all_args("DVB.dvb->analyze_pmt", args, BIT_INT, BIT_INT, 0); +  check_all_args(NULL, args, BIT_INT, BIT_INT, 0);       devname = mk_devname(DVB->cardn, DEMUXDEVICE);    dmx = open (devname, O_RDWR | O_NONBLOCK);    if (dmx < 0) {    snprintf (DVB->low_errmsg, MAX_ERR_LEN, "DMX SET SECTION FILTER.\n");    push_int(0);    return;    }    -  +  /* Clear the stream, and most notably, set stream.ecminfo to NULL. */ +  memset(&stream, 0, sizeof(stream)); +     pmt_pid = (u_short)Pike_sp[-1].u.integer;    Pike_sp--;       program_number = (u_short)Pike_sp[-1].u.integer;    Pike_sp--;       SetFilt(dmx,pmt_pid,2);       for (retries=0; retries<100; retries++)    {
pike.git/src/modules/DVB/dvb.c:1050:    ParseCADescriptor(&stream, &buffer[index+2], buffer[index+1]);       info_len -= 2+buffer[index+1];    index += 2+buffer[index+1];    }       while (index < length-4)    {    cnt = 0;    pid = ((buffer[index+1] & 0x1f) << 8) + buffer[index+2]; -  push_text("pid"); push_int(pid); cnt++; +  push_static_text("pid"); push_int(pid); cnt++;       switch(buffer[index]) {    case 2: -  push_text("type"); push_int(DMX_PES_VIDEO); cnt++; -  push_text("desc"); push_text("video"); cnt++; +  ref_push_string(literal_type_string); push_int(DMX_PES_VIDEO); cnt++; +  push_static_text("desc"); push_static_text("video"); cnt++;    break;    case 3:    case 4: -  push_text("type"); push_int(DMX_PES_AUDIO); cnt++; -  push_text("desc"); push_text("audio"); cnt++; +  ref_push_string(literal_type_string); push_int(DMX_PES_AUDIO); cnt++; +  push_static_text("desc"); push_static_text("audio"); cnt++;    break;    case 6: -  push_text("type"); push_int(DMX_PES_TELETEXT); cnt++; -  push_text("desc"); push_text("teletext"); cnt++; +  ref_push_string(literal_type_string); push_int(DMX_PES_TELETEXT); cnt++; +  push_static_text("desc"); push_static_text("teletext"); cnt++;    break;    case 129: -  push_text("type"); push_int(_DMX_PES_RDS); cnt++; -  push_text("desc"); push_text("_rds"); cnt++; +  ref_push_string(literal_type_string); push_int(_DMX_PES_RDS); cnt++; +  push_static_text("desc"); push_static_text("_rds"); cnt++;    break;    default: -  push_text("unknown_type"); push_int(buffer[index]); cnt++; -  push_text("desc"); push_text("unknown"); cnt++; +  push_static_text("unknown_type"); push_int(buffer[index]); cnt++; +  push_static_text("desc"); push_static_text("unknown"); cnt++;    }       data_len = ((buffer[index+3] & 0x0F) << 8) + buffer[index+4];    if (buffer[index]==0x02 || buffer[index]==0x03 || buffer[index]==0x04)    {    unsigned int i = index+5;    while (i < index+5+data_len)    {    switch (buffer[i])    {    case 0x0a:    if (buffer[index]==3 || buffer[index]==4) { -  push_text("lang"); -  push_string(make_shared_binary_string(&buffer[i+2], 3)); cnt++; +  push_static_text("lang"); +  push_string(make_shared_binary_string((char *)&buffer[i+2], 3)); cnt++;    }    break;    case 0x09:    ParseCADescriptor(&stream, &buffer[i+2],buffer[i+1]);    break;    }    i += 2 + buffer[i+1];    }    }    f_aggregate_mapping( 2 * cnt );
pike.git/src/modules/DVB/dvb.c:1138:    *! @seealso    *! @[DVB.Stream()->read()]    */   static void f_stream_attach(INT32 args) {       int err, ptype = PID_NONE;    unsigned int pid;    struct svalue feeder;    unsigned char *pktdata;    -  check_all_args("DVB.dvb->stream", args, BIT_INT, +  check_all_args(NULL, args, BIT_INT,    BIT_FUNCTION | BIT_INT | BIT_VOID, BIT_INT | BIT_VOID, 0);       if(sl_count(DVB) >= MAX_PES_FD)    Pike_error("Max opened DEMUX devices reached.\n");       if(args > 2) {    ptype = (u_short)Pike_sp[-1].u.integer;    Pike_sp--;    }    if(args > 1) {
pike.git/src/modules/DVB/dvb.c:1179:    if(TYPEOF(Pike_sp[-1]) != PIKE_T_OBJECT)    Pike_error("Failed to create Stream object!\n");      }      static void f__sprintf(INT32 args) {       int n = 0, x, cnt;    dvb_stream_data *st = DVB->stream;    -  check_all_args("DVB.dvb->_sprintf", args, BIT_INT, BIT_MAPPING | BIT_VOID, 0); +  check_all_args(NULL, args, BIT_INT, BIT_MAPPING | BIT_VOID, 0);       x = Pike_sp[-args].u.integer;    pop_n_elems(args);    switch (x) {    case 'O': -  n++; push_text("DVB.dvb("); +  n++; push_static_text("DVB.dvb(");    n++; push_text(mk_devname(DVB->cardn, DEMUXDEVICE)); -  n++; push_text(": "); +  n++; push_static_text(": ");    cnt = 0;    while(st != NULL) {    n++; push_int(st->pid); -  n++; push_text("/"); +  n++; push_static_text("/");    n++; switch(st->stype) { -  case DMX_PES_AUDIO: push_text("a"); break; -  case DMX_PES_VIDEO: push_text("v"); break; -  case DMX_PES_TELETEXT: push_text("t"); break; -  case DMX_PES_SUBTITLE: push_text("s"); break; -  case DMX_PES_OTHER: push_text("o"); break; -  default: push_text("?"); +  case DMX_PES_AUDIO: push_static_text("a"); break; +  case DMX_PES_VIDEO: push_static_text("v"); break; +  case DMX_PES_TELETEXT: push_static_text("t"); break; +  case DMX_PES_SUBTITLE: push_static_text("s"); break; +  case DMX_PES_OTHER: push_static_text("o"); break; +  default: push_static_text("?");    }    cnt++;    if(cnt < sl_count(DVB)) { -  n++; push_text(","); +  n++; push_static_text(",");    }    st = st->next;    } -  n++; push_text(")"); +  n++; push_static_text(")");    f_add(n);    return;    default:    push_int(0);    return;    }   }      /*! @endclass    */
pike.git/src/modules/DVB/dvb.c:1237:    * @note    * The size is 4096 by default.    *    * @seealso    * @[read()]    */   static void f_stream_set_buffer(INT32 args) {       int buflen;    -  check_all_args("DVB.Stream->set_buffer", args, BIT_INT, 0); +  check_all_args(NULL, args, BIT_INT, 0);    buflen = (u_short)Pike_sp[-1].u.integer;    Pike_sp--;    DVBStream->buflen = buflen;    push_int(1);   }            static void f_stream_create(INT32 args) {       struct dmxPesFilterParams pesflt;    int err, pid, fd, ix, ptype;    struct svalue feeder;    unsigned char *pktdata;    struct object *dvbprog;    dvb_data *dvbstor;    char *devname;    -  check_all_args("DVB.dvb->stream", args, BIT_OBJECT, BIT_INT, +  check_all_args(NULL, args, BIT_OBJECT, BIT_INT,    BIT_FUNCTION | BIT_INT, BIT_INT, 0);       ptype = (u_short)Pike_sp[-1].u.integer;    Pike_sp--;    if(ptype == PID_NONE)    ptype = DMX_PES_OTHER;      #if 0    feeder = Pike_sp[1-args].u.svalue;    apply_svalue(&feeder, 0); /* we want more data */   #endif    Pike_sp--;       pid = (u_short)Pike_sp[-1].u.integer;    Pike_sp--;       dvbprog = Pike_sp[-1].u.object;    Pike_sp--; -  if( !dvbprog || !(dvbstor = (dvb_data *)get_storage( dvbprog, dvb_program )) ) +  if( !dvbprog || !(dvbstor = get_storage( dvbprog, dvb_program )) )    Pike_error("This class cannot be instantiated directly\n");       devname = mk_devname(DVB->cardn, DEMUXDEVICE);    fd = open (devname, O_RDWR /*| O_NONBLOCK*/);    if (fd < 0) {    Pike_error("Opening DEMUX failed.\n");    }    pesflt.pid = pid;    pesflt.input = DMX_IN_FRONTEND;    pesflt.output = DMX_OUT_TAP;
pike.git/src/modules/DVB/dvb.c:1322:    push_int(1);   #else    if(sl_add(dvbstor, DVBStream))    push_int(1);    else    push_int(0);   #endif      }    - /*! @decl int destroy() + /*! @decl int _destruct()    *!    *! Purge a stream reader.    *!    *! @seealso    *! @[DVB.dvb()->stream()], @[read()]    */   static void f_stream_detach(INT32 args) {       pop_n_elems(args);    close(DVBStream->fd);
pike.git/src/modules/DVB/dvb.c:1359:    *! @note    *! Read buffer size is 4096 by default.    *!    *! @seealso    *! @[DVB.dvb()->stream()], @[close()]    */   static void f_stream_read(INT32 args) {       dvb_stream_data *dvb_stream = DVBStream;    int all = 1, ret, e, cnt, ix = 0; -  char buf[MAX_DVB_READ_SIZE], *bufptr; +  unsigned char buf[MAX_DVB_READ_SIZE], *bufptr;       if(dvb_stream->fd < 0)    Pike_error("Object destroyed!\n");    -  check_all_args("DVB.dvb->stream_read", args, BIT_INT | BIT_VOID, 0); +  check_all_args(NULL, args, BIT_INT | BIT_VOID, 0);    if(args > 1)    all = (u_short)Pike_sp[-1].u.integer;    pop_n_elems(args);       if(dvb_stream->pkt.payload_len > 0)    memcpy(buf, dvb_stream->pkt.payload, dvb_stream->pkt.payload_len);    for(;;) {    e = 0;    THREADS_ALLOW();    ret = read(dvb_stream->fd, buf + dvb_stream->pkt.payload_len,
pike.git/src/modules/DVB/dvb.c:1435:    printf("DEB: dvb: ret=%d (ix: %d)\n", ret, ix);   #endif    return;    }    push_int(0);      }      static void f_stream_info(INT32 args) {    -  check_all_args("DVB.dvb->stream_info", args, BIT_INT, 0); +  check_all_args(NULL, args, BIT_INT, 0);    pop_n_elems(args);    push_int(0);      }      /*! @decl void close()    *!    *! Closes an open stream.    *!    *! @seealso
pike.git/src/modules/DVB/dvb.c:1512:    *!    *| @seealso    *| @[mixer()]    */   static void f_audio_mute(INT32 args) {       dvb_audio_data *dvb_audio = DVBAudio;    int mute = 1; /* default is mute = on */    int ret;    -  check_all_args("DVB.dvb->audio_mute", args, BIT_INT | BIT_VOID, 0); +  check_all_args(NULL, args, BIT_INT | BIT_VOID, 0);       if(args) {    mute = (u_short)Pike_sp[-1].u.integer;    Pike_sp--;    }       THREADS_ALLOW();    ret = ioctl(dvb_audio->fd, AUDIO_SET_MUTE, mute);    THREADS_DISALLOW();    if(ret < 0)
pike.git/src/modules/DVB/dvb.c:1546:    int ret;    audioStatus_t status;       pop_n_elems(args);    THREADS_ALLOW();    ret = ioctl(dvb_audio->fd, AUDIO_GET_STATUS, &status);    THREADS_DISALLOW();    if(ret < 0)    push_int(0);    else { -  push_text("av_sync"); push_int(status.AVSyncState); -  push_text("mute"); push_int(status.muteState); -  push_text("state"); +  push_static_text("av_sync"); push_int(status.AVSyncState); +  push_static_text("mute"); push_int(status.muteState); +  push_static_text("state");    switch(status.playState) { -  case AUDIO_STOPPED: push_text("stopped"); +  case AUDIO_STOPPED: push_static_text("stopped");    break; -  case AUDIO_PLAYING: push_text("playing"); +  case AUDIO_PLAYING: push_static_text("playing");    break; -  case AUDIO_PAUSED: push_text("paused"); +  case AUDIO_PAUSED: push_static_text("paused");    break; -  default: push_text("unknown"); +  default: push_static_text("unknown");    } -  push_text("source"); +  push_static_text("source");    switch(status.streamSource) { -  case AUDIO_SOURCE_DEMUX: push_text("demux"); +  case AUDIO_SOURCE_DEMUX: push_static_text("demux");    break; -  case AUDIO_SOURCE_MEMORY: push_text("memory"); +  case AUDIO_SOURCE_MEMORY: push_static_text("memory");    break; -  default: push_text("unknown"); +  default: push_static_text("unknown");    } -  push_text("channels"); +  push_static_text("channels");    switch(status.channelSelect) { -  case AUDIO_STEREO: push_text("stereo"); +  case AUDIO_STEREO: push_static_text("stereo");    break; -  case AUDIO_MONO_LEFT: push_text("left"); +  case AUDIO_MONO_LEFT: push_static_text("left");    break; -  case AUDIO_MONO_RIGHT: push_text("right"); +  case AUDIO_MONO_RIGHT: push_static_text("right");    break; -  default: push_text("unknown"); +  default: push_static_text("unknown");    } -  push_text("bypass"); push_int(status.bypassMode); +  push_static_text("bypass"); push_int(status.bypassMode);    f_aggregate_mapping( 2 * 6 );    }      }      static void f_audio_ctrl(INT32 args) {       dvb_audio_data *dvb_audio = DVBAudio;    int ret;    int cw = -1;    -  check_all_args("DVB.dvb->ctrl", args, BIT_INT | BIT_STRING, 0); +  check_all_args(NULL, args, BIT_INT | BIT_STRING, 0);       if(TYPEOF(Pike_sp[-1]) == T_INT)    cw = (u_short)Pike_sp[-1].u.integer;    else    if(!strcmp(Pike_sp[-1].u.string->str, "play"))    cw = AUDIO_PLAY;    else    if(!strcmp(Pike_sp[-1].u.string->str, "pause"))    cw = AUDIO_PAUSE;    else
pike.git/src/modules/DVB/dvb.c:1632:    *!    *| @seealso    *| @[mute()]    */   static void f_audio_mixer(INT32 args) {       dvb_audio_data *dvb_audio = DVBAudio;    int ret;    audioMixer_t mixer;    -  check_all_args("DVB.dvb->audio_mixer", args, BIT_INT, BIT_INT | BIT_VOID, 0); +  check_all_args(NULL, args, BIT_INT, BIT_INT | BIT_VOID, 0);       mixer.volume_right = (unsigned int)Pike_sp[-1].u.integer;    Pike_sp--;    if(args > 1) {    mixer.volume_left = (unsigned int)Pike_sp[-1].u.integer;    Pike_sp--;    } else    mixer.volume_left = mixer.volume_right;       THREADS_ALLOW();
pike.git/src/modules/DVB/dvb.c:1657:    else    push_int(1);      }   /*! @endclass    */      /*! @endmodule    */    - static void init_dvb_data(struct object *obj) { + static void init_dvb_data(struct object *UNUSED(obj)) {       unsigned int i;       DVB->cardn = -1;    DVB->stream = NULL;    memset(&DVB->low_errmsg, '\0', sizeof(DVB->low_errmsg));   }      static void exit_dvb_stream(struct object *obj); - static void exit_dvb_data(struct object *obj) { + static void exit_dvb_data(struct object *UNUSED(obj)) {       dvb_stream_data *s;       if(DVB->cardn != -1) {    close(DVB->fefd);    s = DVB->stream;    while (s != NULL) {    s = s->next;    exit_dvb_stream((struct object *)s);    }    }   }    - static void init_dvb_audio(struct object *obj) { + static void init_dvb_audio(struct object *UNUSED(obj)) {    DVBAudio->fd = -1;    memset(&DVBAudio->low_errmsg, '\0', sizeof(DVBAudio->low_errmsg));   }    - static void exit_dvb_audio(struct object *obj) { + static void exit_dvb_audio(struct object *UNUSED(obj)) {    if(DVBAudio->fd != -1)    close(DVBAudio->fd);   }    - static void init_dvb_stream(struct object *obj) { + static void init_dvb_stream(struct object *UNUSED(obj)) {       DVBStream->parent = NULL;    DVBStream->next = NULL;    DVBStream->fd = -1;    DVBStream->pid = 0;    DVBStream->pkt.payload = NULL;    DVBStream->buflen = MAX_DVB_READ_SIZE;    DVBStream->ecminfo = NULL;    memset(&DVBStream->low_errmsg, '\0', sizeof(DVBStream->low_errmsg));   }       - static void exit_dvb_stream(struct object *obj) { + static void exit_dvb_stream(struct object *UNUSED(obj)) {       struct ECMINFO *e;    unsigned int i;       sl_del(DVBStream->parent, DVBStream);    if(DVBStream->fd != -1) {    close(DVBStream->fd);    if(DVBStream->pkt.payload != NULL)    free(DVBStream->pkt.payload);    }
pike.git/src/modules/DVB/dvb.c:1756:    add_integer_constant("CA_SYSTEM_IRDETO", IRDETO_CA_SYSTEM, 0);    add_integer_constant("CA_SYSTEM_BETA", BETA_CA_SYSTEM, 0);    add_integer_constant("CA_SYSTEM_NAGRA", NAGRA_CA_SYSTEM, 0);       /* dvb */    start_new_program();    ADD_STORAGE(dvb_data);    set_init_callback(init_dvb_data);    set_exit_callback(exit_dvb_data);    -  add_function("create", f_create, "function(int|void:void)", 0); -  add_function("_sprintf", f__sprintf, "function(int,mapping|void:mixed)", 0); -  add_function("tune", f_zap, "function(int,int,int|string,int,mapping|void:int)", 0); -  /* add_function("set_pids", f_set_pids, "function(string,mixed:int)", 0); */ -  add_function("get_pids", f_get_pids, "function(:mapping|int)", 0); -  add_function("analyze_pat", f_parse_pat, "function(:mapping|int)", 0); -  add_function("analyze_pmt", f_parse_pmt, "function(int,int:array|int)", 0); +  ADD_FUNCTION("create", f_create, tFunc(tOr(tInt,tVoid),tVoid), 0); +  ADD_FUNCTION("_sprintf", f__sprintf, tFunc(tInt tOr(tMapping,tVoid), tMix), 0); +  ADD_FUNCTION("tune", f_zap, tFunc(tInt tInt tOr(tInt,tStr) tInt tOr(tMapping,tVoid), tInt), 0); +  /* ADD_FUNCTION("set_pids", f_set_pids, "function(string,mixed:int)", 0); */ +  ADD_FUNCTION("get_pids", f_get_pids, tFunc(tVoid,tOr(tMapping,tInt)), 0); +  ADD_FUNCTION("analyze_pat", f_parse_pat, tFunc(tVoid,tOr(tMapping,tInt)), 0); +  ADD_FUNCTION("analyze_pmt", f_parse_pmt, +  tFunc(tInt tInt, tOr(tInt,tArray)), 0);       /* Frontend */ -  add_function("fe_status", f_fe_status, "function(:mapping|int)", 0); -  add_function("fe_info", f_fe_info, "function(:mapping|int)", 0); +  ADD_FUNCTION("fe_status", f_fe_status, tFunc(tVoid,tOr(tMapping,tInt)), 0); +  ADD_FUNCTION("fe_info", f_fe_info, tFunc(tVoid,tOr(tMapping,tInt)), 0);    -  add_function("stream", f_stream_attach, "function(int,function|int|void,int|void:object)", 0); +  ADD_FUNCTION("stream", f_stream_attach, +  tFunc(tInt tOr3(tFunction,tInt,tVoid) tOr(tInt,tVoid), tObj),0);       dvb_program = end_program();    add_program_constant("dvb", dvb_program, 0);       /* PES streams */    start_new_program();    ADD_STORAGE(dvb_stream_data);    set_init_callback(init_dvb_stream);    set_exit_callback(exit_dvb_stream);    -  add_function("create", f_stream_create, "function(object,int,function|int,int:void)", 0); -  add_function("destroy", f_stream_detach, "function(void:void)", 0); -  add_function("read", f_stream_read, "function(int|void:string|int)", 0); -  add_function("set_buffer", f_stream_set_buffer, "function(int:int)", 0); -  add_function("info", f_stream_info, "function(int:mapping|int)", 0); -  add_function("close", f_stream_info, "function(:void)", 0); +  ADD_FUNCTION("create", f_stream_create, tFunc(tObj tInt tOr(tFunction,tInt) tInt, tVoid), 0); +  ADD_FUNCTION("_destruct", f_stream_detach, tFunc(tVoid,tVoid), 0); +  ADD_FUNCTION("read", f_stream_read, tFunc(tOr(tInt,tVoid),tOr(tInt,tStr)),0); +  ADD_FUNCTION("set_buffer", f_stream_set_buffer, tFunc(tInt,tInt), 0); +  ADD_FUNCTION("info", f_stream_info, tFunc(tInt, tOr(tMapping,tInt)), 0); +  ADD_FUNCTION("close", f_stream_close, tFunc(tVoid,tVoid), 0);       dvb_stream_program = end_program();    add_program_constant("Stream", dvb_stream_program, 0);       /* Audio */    start_new_program();    ADD_STORAGE(dvb_audio_data);    set_init_callback(init_dvb_audio);    set_exit_callback(exit_dvb_audio);    -  add_function("create", f_audio_create, "function(int|void:void)", 0); -  add_function("mute", f_audio_mute, "function(int|void:int)", 0); -  add_function("status", f_audio_status, "function(:mapping|int)", 0); -  add_function("ctrl", f_audio_ctrl, "function(int|string:int)", 0); -  add_function("mixer", f_audio_mixer, "function(int,int|void:int)", 0); +  ADD_FUNCTION("create", f_audio_create, tFunc(tOr(tInt,tVoid),tVoid), 0); +  ADD_FUNCTION("mute", f_audio_mute, tFunc(tOr(tInt,tVoid),tInt), 0); +  ADD_FUNCTION("status", f_audio_status, tFunc(tVoid,tOr(tMapping,tInt)), 0); +  ADD_FUNCTION("ctrl", f_audio_ctrl, tFunc(tOr(tInt,tStr),tInt), 0); +  ADD_FUNCTION("mixer", f_audio_mixer, tFunc(tInt tOr(tInt,tVoid),tInt), 0);       end_class("Audio", 0);      } /* PIKE_MODULE_INIT */      PIKE_MODULE_EXIT {       if(dvb_stream_program) {    free_program(dvb_stream_program);    dvb_stream_program = NULL;    }    if(dvb_program) {    free_program(dvb_program);    dvb_program = NULL;    }   } /* PIKE_MODULE_EXIT */      #else      #include "program.h" - #include "module_support.h" +       PIKE_MODULE_INIT { -  if(!TEST_COMPAT(7,6)) +     HIDE_MODULE();   }      PIKE_MODULE_EXIT {   }      #endif -  +