mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
all: clean up cDemux headers
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include "audio_lib.h"
|
||||
#include "dmx_lib.h"
|
||||
#include "dmx_hal.h"
|
||||
#include "lt_debug.h"
|
||||
|
||||
#define lt_debug(args...) _lt_debug(HAL_DEBUG_AUDIO, this, args)
|
||||
@@ -151,4 +151,3 @@ void cAudio::setBypassMode(bool disable)
|
||||
{
|
||||
lt_debug("%s %d\n", __func__, disable);
|
||||
}
|
||||
|
||||
|
@@ -4,13 +4,13 @@
|
||||
#define _AUDIO_LIB_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../common/cs_types.h"
|
||||
#include "cs_types.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AUDIO_SYNC_WITH_PTS,
|
||||
AUDIO_NO_SYNC,
|
||||
AUDIO_SYNC_AUDIO_MASTER
|
||||
AUDIO_SYNC_WITH_PTS,
|
||||
AUDIO_NO_SYNC,
|
||||
AUDIO_SYNC_AUDIO_MASTER
|
||||
} AUDIO_SYNC_MODE;
|
||||
|
||||
typedef enum {
|
||||
@@ -21,20 +21,20 @@ typedef enum {
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AUDIO_FMT_AUTO = 0,
|
||||
AUDIO_FMT_MPEG,
|
||||
AUDIO_FMT_MP3,
|
||||
AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_AAC,
|
||||
AUDIO_FMT_AAC_PLUS,
|
||||
AUDIO_FMT_DD_PLUS,
|
||||
AUDIO_FMT_DTS,
|
||||
AUDIO_FMT_AVS,
|
||||
AUDIO_FMT_MLP,
|
||||
AUDIO_FMT_WMA,
|
||||
AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback
|
||||
AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP
|
||||
AUDIO_FMT_AUTO = 0,
|
||||
AUDIO_FMT_MPEG,
|
||||
AUDIO_FMT_MP3,
|
||||
AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_AAC,
|
||||
AUDIO_FMT_AAC_PLUS,
|
||||
AUDIO_FMT_DD_PLUS,
|
||||
AUDIO_FMT_DTS,
|
||||
AUDIO_FMT_AVS,
|
||||
AUDIO_FMT_MLP,
|
||||
AUDIO_FMT_WMA,
|
||||
AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback
|
||||
AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP
|
||||
} AUDIO_FORMAT;
|
||||
|
||||
class cAudio
|
||||
@@ -61,6 +61,7 @@ class cAudio
|
||||
|
||||
int do_mute(bool enable, bool remember);
|
||||
void setBypassMode(bool disable);
|
||||
|
||||
public:
|
||||
/* construct & destruct */
|
||||
cAudio(void *, void *, void *);
|
||||
|
@@ -1 +0,0 @@
|
||||
../libspark/cs_api.h
|
@@ -19,7 +19,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -27,16 +26,17 @@
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "dmx_lib.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include "dmx_hal.h"
|
||||
#include "lt_debug.h"
|
||||
|
||||
/* needed for getSTC :-( */
|
||||
#include "video_lib.h"
|
||||
/* needed for getSTC... */
|
||||
extern cVideo *videoDecoder;
|
||||
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args)
|
||||
@@ -44,14 +44,8 @@ extern cVideo *videoDecoder;
|
||||
#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args)
|
||||
|
||||
#define dmx_err(_errfmt, _errstr, _revents) do { \
|
||||
uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\
|
||||
if (dmx_type == DMX_PSI_CHANNEL) { \
|
||||
_pid = s_flt.pid; _f = s_flt.filter.filter[0]; \
|
||||
} else { \
|
||||
_pid = p_flt.pid; \
|
||||
}; \
|
||||
lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \
|
||||
__func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \
|
||||
__func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \
|
||||
} while(0);
|
||||
|
||||
cDemux *videoDemux = NULL;
|
||||
@@ -90,9 +84,6 @@ cDemux::cDemux(int n)
|
||||
else
|
||||
num = n;
|
||||
fd = -1;
|
||||
measure = false;
|
||||
last_measure = 0;
|
||||
last_data = 0;
|
||||
}
|
||||
|
||||
cDemux::~cDemux()
|
||||
@@ -154,12 +145,11 @@ void cDemux::Close(void)
|
||||
lt_info("%s #%d: not open!\n", __FUNCTION__, num);
|
||||
return;
|
||||
}
|
||||
|
||||
pesfds.clear();
|
||||
ioctl(fd, DMX_STOP);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
if (measure)
|
||||
return;
|
||||
if (dmx_type == DMX_TP_CHANNEL)
|
||||
{
|
||||
dmx_tp_count--;
|
||||
@@ -251,17 +241,20 @@ int cDemux::Read(unsigned char *buff, int len, int timeout)
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filter,
|
||||
bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filter,
|
||||
const unsigned char * const mask, int len, int timeout,
|
||||
const unsigned char * const negmask)
|
||||
{
|
||||
struct dmx_sct_filter_params s_flt;
|
||||
memset(&s_flt, 0, sizeof(s_flt));
|
||||
pid = _pid;
|
||||
|
||||
if (len > DMX_FILTER_SIZE)
|
||||
{
|
||||
lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE);
|
||||
len = DMX_FILTER_SIZE;
|
||||
}
|
||||
flt = filter[0];
|
||||
s_flt.pid = pid;
|
||||
s_flt.timeout = timeout;
|
||||
memcpy(s_flt.filter.filter, filter, len);
|
||||
@@ -364,8 +357,11 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cDemux::pesFilter(const unsigned short pid)
|
||||
bool cDemux::pesFilter(const unsigned short _pid)
|
||||
{
|
||||
struct dmx_pes_filter_params p_flt;
|
||||
pid = _pid;
|
||||
flt = 0;
|
||||
/* allow PID 0 for web streaming e.g.
|
||||
* this check originally is from tuxbox cvs but I'm not sure
|
||||
* what it is good for...
|
||||
@@ -382,20 +378,19 @@ bool cDemux::pesFilter(const unsigned short pid)
|
||||
p_flt.output = DMX_OUT_DECODER;
|
||||
p_flt.input = DMX_IN_FRONTEND;
|
||||
|
||||
/* for now, output to TS_TAP for live mode,
|
||||
* test playback with "omxplayer /dev/dvb/adapter0/dvr0" */
|
||||
switch (dmx_type) {
|
||||
case DMX_PCR_ONLY_CHANNEL:
|
||||
p_flt.pes_type = DMX_PES_OTHER;
|
||||
p_flt.output = DMX_OUT_TS_TAP;
|
||||
p_flt.output = DMX_OUT_TAP;
|
||||
return true;
|
||||
break;
|
||||
case DMX_AUDIO_CHANNEL:
|
||||
p_flt.pes_type = DMX_PES_OTHER;
|
||||
p_flt.output = DMX_OUT_TS_TAP;
|
||||
p_flt.output = DMX_OUT_TSDEMUX_TAP;
|
||||
break;
|
||||
case DMX_VIDEO_CHANNEL:
|
||||
p_flt.pes_type = DMX_PES_OTHER;
|
||||
p_flt.output = DMX_OUT_TS_TAP;
|
||||
p_flt.output = DMX_OUT_TSDEMUX_TAP;
|
||||
break;
|
||||
case DMX_PES_CHANNEL:
|
||||
p_flt.pes_type = DMX_PES_OTHER;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
#ifndef __DEMUX_TD_H
|
||||
#define __DEMUX_TD_H
|
||||
#ifndef __dmx_hal__
|
||||
#define __dmx_hal__
|
||||
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <inttypes.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dvb/dmx.h>
|
||||
#include "../common/cs_types.h"
|
||||
|
||||
@@ -28,20 +27,13 @@ typedef struct
|
||||
unsigned short pid;
|
||||
} pes_pids;
|
||||
|
||||
class cRecord;
|
||||
class cPlayback;
|
||||
class cDemux
|
||||
{
|
||||
private:
|
||||
int num;
|
||||
int fd;
|
||||
int buffersize;
|
||||
bool measure;
|
||||
uint64_t last_measure, last_data;
|
||||
DMX_CHANNEL_TYPE dmx_type;
|
||||
std::vector<pes_pids> pesfds;
|
||||
struct dmx_sct_filter_params s_flt;
|
||||
struct dmx_pes_filter_params p_flt;
|
||||
friend class cRecord;
|
||||
friend class cPlayback;
|
||||
public:
|
||||
|
||||
bool Open(DMX_CHANNEL_TYPE pes_type, void * x = NULL, int y = 0);
|
||||
void Close(void);
|
||||
bool Start(bool record = false);
|
||||
@@ -58,13 +50,20 @@ class cDemux
|
||||
int getUnit(void);
|
||||
static bool SetSource(int unit, int source);
|
||||
static int GetSource(int unit);
|
||||
// TD only functions
|
||||
int getFD(void) { return fd; }; /* needed by cPlayback class */
|
||||
void removePid(unsigned short Pid); /* needed by cRecord class */
|
||||
std::vector<pes_pids> getPesPids(void) { return pesfds; };
|
||||
//
|
||||
cDemux(int num = 0);
|
||||
~cDemux();
|
||||
|
||||
private:
|
||||
void removePid(unsigned short Pid); /* needed by cRecord class */
|
||||
int num;
|
||||
int fd;
|
||||
int buffersize;
|
||||
uint16_t pid;
|
||||
uint8_t flt;
|
||||
std::vector<pes_pids> pesfds;
|
||||
DMX_CHANNEL_TYPE dmx_type;
|
||||
void *pdata;
|
||||
};
|
||||
|
||||
#endif //__DEMUX_H
|
||||
#endif //__dmx_hal__
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include <map>
|
||||
#include <thread_abstraction.h>
|
||||
|
||||
#include "init_lib.h"
|
||||
#include "init_td.h"
|
||||
#include "lt_debug.h"
|
||||
#include "glfb.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args)
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#ifndef __INIT_TD_H
|
||||
#define __INIT_TD_H
|
||||
void init_td_api();
|
||||
void shutdown_td_api();
|
||||
#endif
|
@@ -1,10 +1,11 @@
|
||||
#ifndef _VIDEO_TD_H
|
||||
#define _VIDEO_TD_H
|
||||
#ifndef _VIDEO_LIB_H
|
||||
#define _VIDEO_LIB_H
|
||||
|
||||
#include <vector>
|
||||
#include <linux/dvb/video.h>
|
||||
#include "../common/cs_types.h"
|
||||
#include "dmx_lib.h"
|
||||
#include "cs_types.h"
|
||||
#include "dmx_hal.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/rational.h>
|
||||
}
|
||||
@@ -57,7 +58,7 @@ typedef enum {
|
||||
DISPLAY_AR_14_9,
|
||||
DISPLAY_AR_16_9,
|
||||
DISPLAY_AR_20_9,
|
||||
DISPLAY_AR_RAW,
|
||||
DISPLAY_AR_RAW
|
||||
} DISPLAY_AR;
|
||||
|
||||
typedef enum {
|
||||
@@ -101,7 +102,7 @@ typedef enum {
|
||||
|
||||
/* not used, for dummy functions */
|
||||
typedef enum {
|
||||
VIDEO_HDMI_CEC_MODE_OFF = 0,
|
||||
VIDEO_HDMI_CEC_MODE_OFF = 0,
|
||||
VIDEO_HDMI_CEC_MODE_TUNER,
|
||||
VIDEO_HDMI_CEC_MODE_RECORDER
|
||||
} VIDEO_HDMI_CEC_MODE;
|
||||
|
Reference in New Issue
Block a user