/*************************************************************************
* Copyright 2009 Ralph Spitzner (rasp@spitzner.org)
*
* This file is part of Yahdr.
*
* Yahdr is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Yahdr is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Yahdr. If not, see .
**************************************************************************/
#ifndef DEFS_H
#define DEFS_H
//#define _BSD_SOURCE
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "connection.h"
#include "embedhttp.h"
#include
#include
#include "rconf.h"
//#include "dvbtcontrol.h"
#include "epg/rawepg.h"
#include "epg/cookepg.h"
/*
#include "replex-0.1.6.8/avi.h"
#include "replex-0.1.6.8/element.h"
#include "replex-0.1.6.8/mpg_common.h"
#include "replex-0.1.6.8/multiplex.h"
#include "replex-0.1.6.8/pes.h"
#include "replex-0.1.6.8/replex.h"
#include "replex-0.1.6.8/ringbuffer.h"
#include "replex-0.1.6.8/ts.h"
*/
#include
#include
#include
#include
#include
#include
#define GIVE_UP 18800
#define FINDPIDS 10340 // 55*188
#define MAXCLIENTS 5
typedef struct dpack {
#define MSG_DATA 0x01 /// normal data packet
#define MSG_HEAD 0x02 /// resend PS header
uint32_t type;
uint32_t seq; /// sequence number (for debugging)
uint16_t size; /// actual size
int address;
uint8_t data[2048]; /// size of Ipack in replex
} MPG_MSG;
#define MPG_MSG_KEY 0x33458818
struct nlist
{
char *name;
struct nlist *next;
};
typedef struct audiopid
{
uint16_t apid;
char lang[4];
struct audiopid *next;
}APID;
typedef struct chanpid
{
uint16_t pid;
uint16_t type;
struct chanpid *next;
}CPIDS;
typedef struct cdat
{
uint32_t freq;
uint16_t tpnum;
uint16_t tsid;
uint16_t channum;
uint16_t pnum; /// service_id (epg)
// uint16_t vpid;
// APID *apid;
// uint16_t tpid;
CPIDS *cpids;
uint8_t bw;
fe_modulation_t qam;
uint8_t epg_sched;
uint8_t epg_pf;
uint8_t adapter;
unsigned char *stype;
unsigned char *provider;
unsigned char *name;
struct cdat *next;
}CHANNEL;
typedef struct rec
{
time_t start;
time_t duration;
uint16_t pnum;
char filename[256];
int recordfd;
struct rec *next;
struct rec *prev;
}REC;
struct rbuf
{
uint8_t recording;
uint8_t instant;
char recfile[256];
pid_t http_pids[MAXCLIENTS];
time_t http_beats[MAXCLIENTS];
pid_t servvid;
pid_t run_pid;
uint16_t numpids;
uint16_t cpids[8192];
};
string *specialchars(unsigned char *data); // converts to html
CHANNEL *readchans(string *channelselect);
/// replex forward decls
/*
extern "C" {
int replex_all_set(struct replex *rx);
int replex_fill_buffers(struct replex *rx, uint8_t *mbuf);
void init_replex(struct replex *rx,int bufsize);
int fill_buffers(void *r, int finish);
void fix_audio(struct replex *rx, multiplex_t *mx);
void check_times( multiplex_t *mx, int *video_ok, int *audio_ok, int *ac3_ok,int *start);
void write_out_packs( multiplex_t *mx, int video_ok, int *audio_ok, int *ac3_ok);
void init_multiplex( multiplex_t *mx, sequence_t *seq_head, audio_frame_t *aframe,
audio_frame_t *ac3frame, int apidn, int ac3n,
uint64_t video_delay, uint64_t audio_delay, int fd,
int (*fill_buffers)(void *p, int f),
ringbuffer *vrbuffer, ringbuffer *index_vrbuffer,
ringbuffer *arbuffer, ringbuffer *index_arbuffer,
ringbuffer *ac3rbuffer, ringbuffer *index_ac3rbuffer,
int otype);
void setup_multiplex(multiplex_t *mx);
}
*/
//int my_write_out(uint8_t *buffer, int length);
int checkrunning(int adapter,int target_event);
void do_all_epg();
extern uint16_t adapter;
extern uint16_t demux_adapter;
#include "dvbtcontrol.h"
#define ERROR(x...) \
do { \
fprintf(stderr, "ERROR: "); \
fprintf(stderr, x); \
fprintf (stderr, "\n"); \
} while (0)
#define PERROR(x...) \
do { \
fprintf(stderr, "ERROR: "); \
fprintf(stderr, x); \
fprintf (stderr, " (%s)\n", strerror(errno)); \
} while (0)
//# define O_LARGEFILE 0100000
#endif