mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 17:01:08 +02:00
real copy of sectionsd includes
Origin commit data
------------------
Branch: ni/coolstream
Commit: 1b4e149bd1
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-02-01 (Wed, 01 Feb 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
40
src/eitd/debug.h
Normal file
40
src/eitd/debug.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/debug.h,v 1.4 2008/10/05 13:40:36 seife Exp $
|
||||
*
|
||||
* Debug tools (sectionsd) - d-box2 linux project
|
||||
*
|
||||
* (C) 2003 by thegoodguy <thegoodguy@berlios.de>
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __sectionsd__debug_h__
|
||||
#define __sectionsd__debug_h__
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
extern bool sections_debug;
|
||||
|
||||
#define dprintf(fmt, args...) do { if (sections_debug) { printdate_ms(stdout); printf(fmt, ## args); fflush(stdout); }} while (0)
|
||||
#define dputs(str) do { if (sections_debug) { printdate_ms(stdout); puts(str); fflush(stdout); }} while (0)
|
||||
#define xprintf(fmt, args...) do { printdate_ms(stderr); fprintf(stderr, fmt, ## args); } while (0)
|
||||
|
||||
void printdate_ms(FILE* f);
|
||||
|
||||
#endif /* __sectionsd__debug_h__ */
|
||||
|
116
src/eitd/dmx.h
Normal file
116
src/eitd/dmx.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmx.h,v 1.17 2009/05/23 16:50:12 seife Exp $
|
||||
*
|
||||
* DMX class (sectionsd) - d-box2 linux project
|
||||
*
|
||||
* (C) 2003 by thegoodguy <thegoodguy@berlios.de>
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __sectionsd__dmx_h__
|
||||
#define __sectionsd__dmx_h__
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
#include <config.h>
|
||||
#if HAVE_COOL_HARDWARE
|
||||
#include <dmx_cs.h>
|
||||
#endif
|
||||
#if HAVE_TRIPLEDRAGON
|
||||
#include <dmx_td.h>
|
||||
#endif
|
||||
|
||||
typedef uint64_t sections_id_t;
|
||||
typedef unsigned char version_number_t;
|
||||
|
||||
class DMX
|
||||
{
|
||||
private:
|
||||
|
||||
int fd;
|
||||
cDemux * dmx;
|
||||
int dmx_num;
|
||||
pthread_mutex_t pauselock;
|
||||
unsigned short pID;
|
||||
unsigned short dmxBufferSizeInKB;
|
||||
sections_id_t first_skipped;
|
||||
int current_service;
|
||||
unsigned char eit_version;
|
||||
bool cache; /* should read sections be cached? true for all but dmxCN */
|
||||
|
||||
inline bool isOpen(void) {
|
||||
return (fd != -1);
|
||||
}
|
||||
|
||||
int immediate_start(void); /* mutex must be locked before and unlocked after this method */
|
||||
int immediate_stop(void); /* mutex must be locked before and unlocked after this method */
|
||||
bool check_complete(const unsigned char table_id, const unsigned short extension_id, const unsigned short onid, const unsigned short tsid, const unsigned char);
|
||||
sections_id_t create_sections_id(const unsigned char table_id, const unsigned short extension_id, const unsigned char section_number, const unsigned short onid, const unsigned short tsid);
|
||||
ssize_t readNbytes(int fd, char * buf, const size_t n, unsigned timeoutInMSeconds);
|
||||
|
||||
public:
|
||||
struct s_filters
|
||||
{
|
||||
unsigned char filter;
|
||||
unsigned char mask;
|
||||
};
|
||||
|
||||
std::vector<s_filters> filters;
|
||||
int filter_index;
|
||||
time_t lastChanged;
|
||||
|
||||
int real_pauseCounter;
|
||||
pthread_cond_t change_cond;
|
||||
pthread_mutex_t start_stop_mutex;
|
||||
|
||||
|
||||
DMX(const unsigned short p, const unsigned short bufferSizeInKB, const bool cache = true, int dmx_source = 0);
|
||||
~DMX();
|
||||
|
||||
int start(void);
|
||||
ssize_t read(char * const buf, const size_t buflength, const unsigned timeoutMInSeconds);
|
||||
void closefd(void);
|
||||
void addfilter(const unsigned char filter, const unsigned char mask);
|
||||
int stop(void);
|
||||
void close(void);
|
||||
|
||||
int real_pause(void);
|
||||
int real_unpause(void);
|
||||
|
||||
int request_pause(void);
|
||||
int request_unpause(void);
|
||||
|
||||
int change(const int new_filter_index, const int new_current_service = -1); // locks while changing
|
||||
|
||||
void lock(void);
|
||||
void unlock(void);
|
||||
|
||||
int getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts);
|
||||
// section with size < 3 + 5 are skipped !
|
||||
int setPid(const unsigned short new_pid);
|
||||
int setCurrentService(int new_current_service);
|
||||
int dropCachedSectionIDs();
|
||||
|
||||
unsigned char get_eit_version(void);
|
||||
// was useful for debugging...
|
||||
unsigned int get_current_service(void);
|
||||
};
|
||||
|
||||
#endif /* __sectionsd__dmx_h__ */
|
||||
|
46
src/eitd/dmxapi.h
Normal file
46
src/eitd/dmxapi.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmxapi.h,v 1.3 2003/03/01 19:26:51 thegoodguy Exp $
|
||||
*
|
||||
* DMX low level functions (sectionsd) - d-box2 linux project
|
||||
*
|
||||
* (C) 2003 by thegoodguy <thegoodguy@berlios.de>
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __sectionsd__dmxapi_h__
|
||||
#define __sectionsd__dmxapi_h__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#if !HAVE_TRIPLEDRAGON
|
||||
#include <linux/dvb/dmx.h>
|
||||
#endif
|
||||
|
||||
bool setfilter(const int fd, const uint16_t pid, const uint8_t filter, const uint8_t mask, const uint32_t flags);
|
||||
|
||||
typedef struct UTC_time
|
||||
{
|
||||
uint64_t time : 40;
|
||||
} __attribute__ ((packed)) UTC_t;
|
||||
|
||||
bool getUTC(UTC_t * const UTC, const bool TDT = true);
|
||||
|
||||
#endif /* __sectionsd__dmxapi_h__ */
|
||||
|
14
src/eitd/edvbstring.h
Normal file
14
src/eitd/edvbstring.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef __E_STRING__
|
||||
#define __E_STRING__
|
||||
|
||||
const std::string convertLatin1UTF8(const std::string &string);
|
||||
int isUTF8(const std::string &string);
|
||||
std::string convertDVBUTF8(const char *data, int len, int table, int tsidonid = 0);
|
||||
int readEncodingFile();
|
||||
|
||||
inline std::string stringDVBUTF8(const std::string &string, int table=0, int tsidonid=0)
|
||||
{
|
||||
return convertDVBUTF8((const char*)string.c_str(), string.length(), table, tsidonid);
|
||||
}
|
||||
|
||||
#endif // __E_STRING__
|
Reference in New Issue
Block a user