mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
- libarmbox/libmipsbox: some manual code nicenings
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -51,7 +51,7 @@ extern cVideo *videoDecoder;
|
||||
|
||||
#define dmx_err(_errfmt, _errstr, _revents) do { \
|
||||
hal_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, flt); \
|
||||
__func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \
|
||||
} while(0);
|
||||
|
||||
cDemux *videoDemux = NULL;
|
||||
@@ -185,7 +185,7 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_
|
||||
{
|
||||
/* we changed source -> close and reopen the fd */
|
||||
hal_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n",
|
||||
__func__, num, fd, last_source, devnum);
|
||||
__func__, num, fd, last_source, devnum);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
@@ -198,8 +198,8 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_
|
||||
hal_info_z("%s %s: %m\n", __FUNCTION__, devname(0, devnum));
|
||||
return false;
|
||||
}
|
||||
hal_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__,
|
||||
num, DMX_T[dmx_type], dmx_type, buffersize, fd);
|
||||
hal_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n",
|
||||
__func__, num, DMX_T[dmx_type], dmx_type, buffersize, fd);
|
||||
|
||||
/* this would actually need locking, but the worst that weill happen is, that
|
||||
* we'll DMX_SET_SOURCE twice per device, so don't bother... */
|
||||
@@ -214,7 +214,7 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_
|
||||
init[devnum] = true;
|
||||
}
|
||||
if (buffersize == 0)
|
||||
buffersize = 0xffff; // may or may not be reasonable --martii
|
||||
buffersize = 0xffff; // may or may not be reasonable --martii
|
||||
if (buffersize > 0)
|
||||
{
|
||||
/* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */
|
||||
@@ -270,7 +270,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout)
|
||||
#if 0
|
||||
if (len != 4095 && timeout != 10)
|
||||
fprintf(stderr, "cDemux::%s #%d fd: %d type: %s len: %d timeout: %d\n",
|
||||
__FUNCTION__, num, fd, DMX_T[dmx_type], len, timeout);
|
||||
__FUNCTION__, num, fd, DMX_T[dmx_type], len, timeout);
|
||||
#endif
|
||||
if (fd < 0)
|
||||
{
|
||||
@@ -339,7 +339,7 @@ retry:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */
|
||||
if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */
|
||||
{
|
||||
/* read(-1,...) will just return EBADF anyway... */
|
||||
hal_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd);
|
||||
@@ -355,8 +355,8 @@ retry:
|
||||
}
|
||||
|
||||
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)
|
||||
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));
|
||||
@@ -373,7 +373,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
|
||||
s_flt.pid = pid;
|
||||
s_flt.timeout = timeout;
|
||||
memcpy(s_flt.filter.filter, filter, len);
|
||||
memcpy(s_flt.filter.mask, mask, len);
|
||||
memcpy(s_flt.filter.mask, mask, len);
|
||||
if (negmask != NULL)
|
||||
memcpy(s_flt.filter.mode, negmask, len);
|
||||
|
||||
@@ -424,7 +424,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
|
||||
case 0x70: /* time_date_section */
|
||||
s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */
|
||||
s_flt.flags |= DMX_ONESHOT;
|
||||
//s_flt.pid = 0x0014;
|
||||
//s_flt.pid = 0x0014;
|
||||
to = 30000;
|
||||
break;
|
||||
case 0x71: /* running_status_section */
|
||||
@@ -437,7 +437,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
|
||||
break;
|
||||
case 0x73: /* time_offset_section */
|
||||
s_flt.flags |= DMX_ONESHOT;
|
||||
//s_flt.pid = 0x0014;
|
||||
//s_flt.pid = 0x0014;
|
||||
to = 30000;
|
||||
break;
|
||||
case 0x74: /* application_information_section */
|
||||
@@ -465,8 +465,8 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
|
||||
if (timeout == 0 && negmask == NULL)
|
||||
s_flt.timeout = to;
|
||||
|
||||
hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num,
|
||||
pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]);
|
||||
hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n",
|
||||
__func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]);
|
||||
|
||||
if (debuglevel == 2)
|
||||
{
|
||||
@@ -474,10 +474,10 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
|
||||
for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.filter[i]);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "mask: ");
|
||||
for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mask [i]);
|
||||
for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mask[i]);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "mode: ");
|
||||
for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mode [i]);
|
||||
for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mode[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ bool cDemux::pesFilter(const unsigned short _pid)
|
||||
* this check originally is from tuxbox cvs but I'm not sure
|
||||
* what it is good for...
|
||||
if (pid <= 0x0001 && dmx_type != DMX_PCR_ONLY_CHANNEL)
|
||||
return false;
|
||||
return false;
|
||||
*/
|
||||
if ((pid >= 0x0002 && pid <= 0x000f) || pid >= 0x1fff)
|
||||
return false;
|
||||
@@ -507,10 +507,10 @@ bool cDemux::pesFilter(const unsigned short _pid)
|
||||
_open(this, num, fd, P->last_source, dmx_type, buffersize);
|
||||
|
||||
memset(&p_flt, 0, sizeof(p_flt));
|
||||
p_flt.pid = pid;
|
||||
p_flt.input = DMX_IN_FRONTEND;
|
||||
p_flt.pid = pid;
|
||||
p_flt.input = DMX_IN_FRONTEND;
|
||||
p_flt.output = DMX_OUT_DECODER;
|
||||
p_flt.flags = 0;
|
||||
p_flt.flags = 0;
|
||||
|
||||
switch (dmx_type)
|
||||
{
|
||||
@@ -534,7 +534,7 @@ bool cDemux::pesFilter(const unsigned short _pid)
|
||||
break;
|
||||
case DMX_PES_CHANNEL:
|
||||
p_flt.pes_type = DMX_PES_OTHER;
|
||||
p_flt.output = DMX_OUT_TAP;
|
||||
p_flt.output = DMX_OUT_TAP;
|
||||
break;
|
||||
#if 0
|
||||
case DMX_PSI_CHANNEL:
|
||||
@@ -542,7 +542,7 @@ bool cDemux::pesFilter(const unsigned short _pid)
|
||||
#endif
|
||||
case DMX_TP_CHANNEL:
|
||||
p_flt.pes_type = DMX_PES_OTHER;
|
||||
p_flt.output = DMX_OUT_TSDEMUX_TAP;
|
||||
p_flt.output = DMX_OUT_TSDEMUX_TAP;
|
||||
break;
|
||||
case DMX_PCR_ONLY_CHANNEL:
|
||||
switch (num)
|
||||
|
Reference in New Issue
Block a user