mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 07:22:44 +02:00
rename lt_debug => hal_debug; it's not only libtriple debugging
Origin commit data
------------------
Branch: master
Commit: ef4ad293cc
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-12-26 (Wed, 26 Dec 2018)
Origin message was:
------------------
- rename lt_debug => hal_debug; it's not only libtriple debugging
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
#include <proc_tools.h>
|
||||
|
||||
#include "audio_lib.h"
|
||||
#include "lt_debug.h"
|
||||
#include "hal_debug.h"
|
||||
|
||||
#define AUDIO_DEVICE "/dev/dvb/adapter0/audio0"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_AUDIO, this, args)
|
||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_AUDIO, this, args)
|
||||
#define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args)
|
||||
#define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args)
|
||||
|
||||
#include <linux/soundcard.h>
|
||||
|
||||
@@ -36,20 +36,20 @@ cAudio::~cAudio(void)
|
||||
|
||||
void cAudio::openDevice(void)
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
hal_debug("%s\n", __func__);
|
||||
if (fd < 0)
|
||||
{
|
||||
if ((fd = open(AUDIO_DEVICE, O_RDONLY|O_CLOEXEC)) < 0)
|
||||
lt_info("openDevice: open failed (%m)\n");
|
||||
hal_info("openDevice: open failed (%m)\n");
|
||||
do_mute(true, false);
|
||||
}
|
||||
else
|
||||
lt_info("openDevice: already open (fd = %d)\n", fd);
|
||||
hal_info("openDevice: already open (fd = %d)\n", fd);
|
||||
}
|
||||
|
||||
void cAudio::closeDevice(void)
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
hal_debug("%s\n", __func__);
|
||||
ioctl(fd, AUDIO_CONTINUE); /* enigma2 also does CONTINUE before close... */
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
@@ -64,14 +64,14 @@ void cAudio::closeDevice(void)
|
||||
|
||||
int cAudio::do_mute(bool enable, bool remember)
|
||||
{
|
||||
lt_debug("%s(%d, %d)\n", __func__, enable, remember);
|
||||
hal_debug("%s(%d, %d)\n", __func__, enable, remember);
|
||||
|
||||
if (remember)
|
||||
Muted = enable;
|
||||
#if 0
|
||||
/* does not work? */
|
||||
if (ioctl(fd, AUDIO_SET_MUTE, enable) < 0 )
|
||||
lt_info("%s: AUDIO_SET_MUTE failed (%m)\n", __func__);
|
||||
hal_info("%s: AUDIO_SET_MUTE failed (%m)\n", __func__);
|
||||
#else
|
||||
char s[2] = { 0, 0 };
|
||||
s[0] = '0' + (int)enable;
|
||||
@@ -93,7 +93,7 @@ int map_volume(const int volume)
|
||||
|
||||
int cAudio::setVolume(unsigned int left, unsigned int right)
|
||||
{
|
||||
lt_debug("%s(%d, %d)\n", __func__, left, right);
|
||||
hal_debug("%s(%d, %d)\n", __func__, left, right);
|
||||
|
||||
volume = (left + right) / 2;
|
||||
if (clipfd != -1 && mixer_fd != -1) {
|
||||
@@ -103,7 +103,7 @@ int cAudio::setVolume(unsigned int left, unsigned int right)
|
||||
tmp = left << 8 | right;
|
||||
int ret = ioctl(mixer_fd, MIXER_WRITE(mixer_num), &tmp);
|
||||
if (ret == -1)
|
||||
lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp);
|
||||
hal_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -112,14 +112,14 @@ int cAudio::setVolume(unsigned int left, unsigned int right)
|
||||
mixer.volume_right = map_volume(right);
|
||||
|
||||
if (ioctl(fd, AUDIO_SET_MIXER, &mixer) < 0)
|
||||
lt_info("%s: AUDIO_SET_MIXER failed (%m)\n", __func__);
|
||||
hal_info("%s: AUDIO_SET_MIXER failed (%m)\n", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cAudio::Start(void)
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
hal_debug("%s\n", __func__);
|
||||
int ret;
|
||||
ioctl(fd, AUDIO_CONTINUE);
|
||||
ret = ioctl(fd, AUDIO_PLAY);
|
||||
@@ -128,7 +128,7 @@ int cAudio::Start(void)
|
||||
|
||||
int cAudio::Stop(void)
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
hal_debug("%s\n", __func__);
|
||||
ioctl(fd, AUDIO_STOP);
|
||||
ioctl(fd, AUDIO_CONTINUE); /* no idea why we have to stop and then continue => enigma2 does it, too */
|
||||
return 0;
|
||||
@@ -141,7 +141,7 @@ bool cAudio::Pause(bool /*Pcm*/)
|
||||
|
||||
void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
|
||||
{
|
||||
lt_debug("%s %d\n", __func__, Mode);
|
||||
hal_debug("%s %d\n", __func__, Mode);
|
||||
ioctl(fd, AUDIO_SET_AV_SYNC, Mode);
|
||||
};
|
||||
|
||||
@@ -157,7 +157,7 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
|
||||
void cAudio::SetStreamType(AUDIO_FORMAT type)
|
||||
{
|
||||
int bypass = AUDIO_STREAMTYPE_MPEG;
|
||||
lt_debug("%s %d\n", __func__, type);
|
||||
hal_debug("%s %d\n", __func__, type);
|
||||
StreamType = type;
|
||||
|
||||
switch (type)
|
||||
@@ -176,7 +176,7 @@ void cAudio::SetStreamType(AUDIO_FORMAT type)
|
||||
// Normaly the encoding should be set using AUDIO_SET_ENCODING
|
||||
// But as we implemented the behavior to bypass (cause of e2) this is correct here
|
||||
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0)
|
||||
lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
||||
hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
||||
};
|
||||
|
||||
int cAudio::setChannel(int channel)
|
||||
@@ -190,9 +190,9 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
||||
unsigned int devmask, stereo, usable;
|
||||
const char *dsp_dev = getenv("DSP_DEVICE");
|
||||
const char *mix_dev = getenv("MIX_DEVICE");
|
||||
lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian);
|
||||
hal_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian);
|
||||
if (clipfd >= 0) {
|
||||
lt_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd);
|
||||
hal_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd);
|
||||
return -1;
|
||||
}
|
||||
mixer_num = -1;
|
||||
@@ -207,15 +207,15 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
||||
*/
|
||||
if ((!dsp_dev) || (access(dsp_dev, W_OK))) {
|
||||
if (dsp_dev)
|
||||
lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened,"
|
||||
hal_info("%s: DSP_DEVICE is set (%s) but cannot be opened,"
|
||||
" fall back to /dev/dsp1\n", __func__, dsp_dev);
|
||||
dsp_dev = "/dev/dsp1";
|
||||
}
|
||||
lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */
|
||||
hal_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */
|
||||
/* the tdoss dsp driver seems to work only on the second open(). really. */
|
||||
clipfd = open(dsp_dev, O_WRONLY|O_CLOEXEC);
|
||||
if (clipfd < 0) {
|
||||
lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__);
|
||||
hal_info("%s open %s: %m\n", dsp_dev, __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
/* no idea if we ever get little_endian == 0 */
|
||||
@@ -237,21 +237,21 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
||||
|
||||
mixer_fd = open(mix_dev, O_RDWR|O_CLOEXEC);
|
||||
if (mixer_fd < 0) {
|
||||
lt_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev);
|
||||
hal_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev);
|
||||
/* not a real error */
|
||||
return 0;
|
||||
}
|
||||
if (ioctl(mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
|
||||
lt_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__);
|
||||
hal_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__);
|
||||
devmask = 0;
|
||||
}
|
||||
if (ioctl(mixer_fd, SOUND_MIXER_READ_STEREODEVS, &stereo) == -1) {
|
||||
lt_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__);
|
||||
hal_info("%s: SOUND_MIXER_READ_STEREODEVS %m\n", __func__);
|
||||
stereo = 0;
|
||||
}
|
||||
usable = devmask & stereo;
|
||||
if (usable == 0) {
|
||||
lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n",
|
||||
hal_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n",
|
||||
__func__, devmask, stereo);
|
||||
close(mixer_fd);
|
||||
mixer_fd = -1;
|
||||
@@ -260,13 +260,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
||||
/* __builtin_popcount needs GCC, it counts the set bits... */
|
||||
if (__builtin_popcount (usable) != 1) {
|
||||
/* TODO: this code is not yet tested as I have only single-mixer devices... */
|
||||
lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n"
|
||||
hal_info("%s: more than one mixer control: devmask %08x stereo %08x\n"
|
||||
"%s: querying MIX_NUMBER environment variable...\n",
|
||||
__func__, devmask, stereo, __func__);
|
||||
const char *tmp = getenv("MIX_NUMBER");
|
||||
if (tmp)
|
||||
mixer_num = atoi(tmp);
|
||||
lt_info("%s: mixer_num is %d -> device %08x\n",
|
||||
hal_info("%s: mixer_num is %d -> device %08x\n",
|
||||
__func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0);
|
||||
/* no error checking, you'd better know what you are doing... */
|
||||
} else {
|
||||
@@ -284,22 +284,22 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
||||
int cAudio::WriteClip(unsigned char *buffer, int size)
|
||||
{
|
||||
int ret;
|
||||
// lt_debug("cAudio::%s\n", __FUNCTION__);
|
||||
// hal_debug("cAudio::%s\n", __FUNCTION__);
|
||||
if (clipfd <= 0) {
|
||||
lt_info("%s: clipfd not yet opened\n", __FUNCTION__);
|
||||
hal_info("%s: clipfd not yet opened\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
ret = write(clipfd, buffer, size);
|
||||
if (ret < 0)
|
||||
lt_info("%s: write error (%m)\n", __FUNCTION__);
|
||||
hal_info("%s: write error (%m)\n", __FUNCTION__);
|
||||
return ret;
|
||||
};
|
||||
|
||||
int cAudio::StopClip()
|
||||
{
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
hal_debug("%s\n", __FUNCTION__);
|
||||
if (clipfd <= 0) {
|
||||
lt_info("%s: clipfd not yet opened\n", __FUNCTION__);
|
||||
hal_info("%s: clipfd not yet opened\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
close(clipfd);
|
||||
@@ -313,7 +313,7 @@ int cAudio::StopClip()
|
||||
|
||||
void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &mode)
|
||||
{
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
hal_debug("%s\n", __FUNCTION__);
|
||||
type = 0;
|
||||
layer = 0;
|
||||
freq = 0;
|
||||
@@ -362,37 +362,37 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m
|
||||
|
||||
void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/)
|
||||
{
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
hal_debug("%s\n", __FUNCTION__);
|
||||
};
|
||||
|
||||
void cAudio::SetHdmiDD(bool enable)
|
||||
{
|
||||
lt_debug("%s %d\n", __func__, enable);
|
||||
hal_debug("%s %d\n", __func__, enable);
|
||||
};
|
||||
|
||||
void cAudio::SetSpdifDD(bool enable)
|
||||
{
|
||||
lt_debug("%s %d\n", __func__, enable);
|
||||
hal_debug("%s %d\n", __func__, enable);
|
||||
setBypassMode(!enable);
|
||||
};
|
||||
|
||||
void cAudio::ScheduleMute(bool On)
|
||||
{
|
||||
lt_debug("%s %d\n", __FUNCTION__, On);
|
||||
hal_debug("%s %d\n", __FUNCTION__, On);
|
||||
};
|
||||
|
||||
void cAudio::EnableAnalogOut(bool enable)
|
||||
{
|
||||
lt_debug("%s %d\n", __FUNCTION__, enable);
|
||||
hal_debug("%s %d\n", __FUNCTION__, enable);
|
||||
};
|
||||
|
||||
#define AUDIO_BYPASS_ON 0
|
||||
#define AUDIO_BYPASS_OFF 1
|
||||
void cAudio::setBypassMode(bool disable)
|
||||
{
|
||||
lt_debug("%s %d\n", __func__, disable);
|
||||
hal_debug("%s %d\n", __func__, disable);
|
||||
int mode = disable ? AUDIO_BYPASS_OFF : AUDIO_BYPASS_ON;
|
||||
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, mode) < 0)
|
||||
lt_info("%s AUDIO_SET_BYPASS_MODE %d: %m\n", __func__, mode);
|
||||
hal_info("%s AUDIO_SET_BYPASS_MODE %d: %m\n", __func__, mode);
|
||||
return;
|
||||
}
|
||||
|
@@ -32,18 +32,18 @@
|
||||
#include <string>
|
||||
#include <sys/ioctl.h>
|
||||
#include "dmx_hal.h"
|
||||
#include "lt_debug.h"
|
||||
#include "hal_debug.h"
|
||||
|
||||
#include "video_lib.h"
|
||||
/* needed for getSTC... */
|
||||
extern cVideo *videoDecoder;
|
||||
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args)
|
||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args)
|
||||
#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args)
|
||||
#define hal_debug(args...) _hal_debug(HAL_DEBUG_DEMUX, this, args)
|
||||
#define hal_info(args...) _hal_info(HAL_DEBUG_DEMUX, this, args)
|
||||
#define hal_info_c(args...) _hal_info(HAL_DEBUG_DEMUX, NULL, args)
|
||||
|
||||
#define dmx_err(_errfmt, _errstr, _revents) do { \
|
||||
lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \
|
||||
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); \
|
||||
} while(0);
|
||||
|
||||
@@ -77,7 +77,7 @@ cDemux::cDemux(int n)
|
||||
{
|
||||
if (n < 0 || n > 2)
|
||||
{
|
||||
lt_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n);
|
||||
hal_info("%s ERROR: n invalid (%d)\n", __FUNCTION__, n);
|
||||
num = 0;
|
||||
}
|
||||
else
|
||||
@@ -87,7 +87,7 @@ cDemux::cDemux(int n)
|
||||
|
||||
cDemux::~cDemux()
|
||||
{
|
||||
lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd);
|
||||
hal_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd);
|
||||
Close();
|
||||
/* in zapit.cpp, videoDemux is deleted after videoDecoder
|
||||
* in the video watchdog, we access videoDecoder
|
||||
@@ -108,7 +108,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe
|
||||
int devnum = num;
|
||||
int flags = O_RDWR|O_CLOEXEC;
|
||||
if (fd > -1)
|
||||
lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd);
|
||||
hal_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd);
|
||||
|
||||
if (pes_type != DMX_PSI_CHANNEL)
|
||||
flags |= O_NONBLOCK;
|
||||
@@ -116,28 +116,28 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe
|
||||
fd = open(devname[devnum], flags);
|
||||
if (fd < 0)
|
||||
{
|
||||
lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]);
|
||||
hal_info("%s %s: %m\n", __FUNCTION__, devname[devnum]);
|
||||
return false;
|
||||
}
|
||||
lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__,
|
||||
hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__,
|
||||
num, DMX_T[pes_type], pes_type, uBufferSize, fd);
|
||||
|
||||
dmx_type = pes_type;
|
||||
#if 0
|
||||
if (!pesfds.empty())
|
||||
{
|
||||
lt_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */
|
||||
hal_info("%s ERROR! pesfds not empty!\n", __FUNCTION__); /* TODO: error handling */
|
||||
return false;
|
||||
}
|
||||
int n = DMX_SOURCE_FRONT0;
|
||||
if (ioctl(fd, DMX_SET_SOURCE, &n) < 0)
|
||||
lt_info("%s DMX_SET_SOURCE failed!\n", __func__);
|
||||
hal_info("%s DMX_SET_SOURCE failed!\n", __func__);
|
||||
#endif
|
||||
if (uBufferSize > 0)
|
||||
{
|
||||
/* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */
|
||||
if (ioctl(fd, DMX_SET_BUFFER_SIZE, uBufferSize) < 0)
|
||||
lt_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__);
|
||||
hal_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__);
|
||||
}
|
||||
buffersize = uBufferSize;
|
||||
|
||||
@@ -146,10 +146,10 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe
|
||||
|
||||
void cDemux::Close(void)
|
||||
{
|
||||
lt_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd);
|
||||
hal_debug("%s #%d, fd = %d\n", __FUNCTION__, num, fd);
|
||||
if (fd < 0)
|
||||
{
|
||||
lt_info("%s #%d: not open!\n", __FUNCTION__, num);
|
||||
hal_info("%s #%d: not open!\n", __FUNCTION__, num);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ void cDemux::Close(void)
|
||||
dmx_tp_count--;
|
||||
if (dmx_tp_count < 0)
|
||||
{
|
||||
lt_info("%s dmx_tp_count < 0!!\n", __func__);
|
||||
hal_info("%s dmx_tp_count < 0!!\n", __func__);
|
||||
dmx_tp_count = 0;
|
||||
}
|
||||
}
|
||||
@@ -170,10 +170,10 @@ void cDemux::Close(void)
|
||||
|
||||
bool cDemux::Start(bool)
|
||||
{
|
||||
lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]);
|
||||
hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]);
|
||||
if (fd < 0)
|
||||
{
|
||||
lt_info("%s #%d: not open!\n", __FUNCTION__, num);
|
||||
hal_info("%s #%d: not open!\n", __FUNCTION__, num);
|
||||
return false;
|
||||
}
|
||||
ioctl(fd, DMX_START);
|
||||
@@ -182,10 +182,10 @@ bool cDemux::Start(bool)
|
||||
|
||||
bool cDemux::Stop(void)
|
||||
{
|
||||
lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]);
|
||||
hal_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]);
|
||||
if (fd < 0)
|
||||
{
|
||||
lt_info("%s #%d: not open!\n", __FUNCTION__, num);
|
||||
hal_info("%s #%d: not open!\n", __FUNCTION__, num);
|
||||
return false;
|
||||
}
|
||||
ioctl(fd, DMX_STOP);
|
||||
@@ -229,7 +229,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout)
|
||||
else if (rc < 0)
|
||||
{
|
||||
dmx_err("poll: %s,", strerror(errno), 0)
|
||||
//lt_info("%s poll: %m\n", __FUNCTION__);
|
||||
//hal_info("%s poll: %m\n", __FUNCTION__);
|
||||
/* happens, when running under gdb... */
|
||||
if (errno == EINTR)
|
||||
goto retry;
|
||||
@@ -273,7 +273,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt
|
||||
|
||||
if (len > DMX_FILTER_SIZE)
|
||||
{
|
||||
lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE);
|
||||
hal_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE);
|
||||
len = DMX_FILTER_SIZE;
|
||||
}
|
||||
s_flt.pid = pid;
|
||||
@@ -367,7 +367,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filt
|
||||
if (timeout == 0 && negmask == NULL)
|
||||
s_flt.timeout = to;
|
||||
|
||||
lt_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num,
|
||||
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 0
|
||||
fprintf(stderr,"filt: ");for(int i=0;i<DMX_FILTER_SIZE;i++)fprintf(stderr,"%02hhx ",s_flt.filter.filter[i]);fprintf(stderr,"\n");
|
||||
@@ -396,7 +396,7 @@ bool cDemux::pesFilter(const unsigned short _pid)
|
||||
if ((pid >= 0x0002 && pid <= 0x000f) || pid >= 0x1fff)
|
||||
return false;
|
||||
|
||||
lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]);
|
||||
hal_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]);
|
||||
|
||||
memset(&p_flt, 0, sizeof(p_flt));
|
||||
p_flt.pid = pid;
|
||||
@@ -422,7 +422,7 @@ bool cDemux::pesFilter(const unsigned short _pid)
|
||||
p_flt.output = DMX_OUT_TSDEMUX_TAP;
|
||||
break;
|
||||
default:
|
||||
lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type);
|
||||
hal_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type);
|
||||
return false;
|
||||
}
|
||||
return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0);
|
||||
@@ -430,39 +430,39 @@ bool cDemux::pesFilter(const unsigned short _pid)
|
||||
|
||||
void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/)
|
||||
{
|
||||
lt_debug("%s #%d\n", __FUNCTION__, num);
|
||||
hal_debug("%s #%d\n", __FUNCTION__, num);
|
||||
}
|
||||
|
||||
void *cDemux::getBuffer()
|
||||
{
|
||||
lt_debug("%s #%d\n", __FUNCTION__, num);
|
||||
hal_debug("%s #%d\n", __FUNCTION__, num);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *cDemux::getChannel()
|
||||
{
|
||||
lt_debug("%s #%d\n", __FUNCTION__, num);
|
||||
hal_debug("%s #%d\n", __FUNCTION__, num);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool cDemux::addPid(unsigned short Pid)
|
||||
{
|
||||
lt_debug("%s: pid 0x%04hx\n", __func__, Pid);
|
||||
hal_debug("%s: pid 0x%04hx\n", __func__, Pid);
|
||||
pes_pids pfd;
|
||||
int ret;
|
||||
if (dmx_type != DMX_TP_CHANNEL)
|
||||
{
|
||||
lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid);
|
||||
hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid);
|
||||
return false;
|
||||
}
|
||||
if (fd == -1)
|
||||
lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid);
|
||||
hal_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid);
|
||||
pfd.fd = fd; /* dummy */
|
||||
pfd.pid = Pid;
|
||||
pesfds.push_back(pfd);
|
||||
ret = (ioctl(fd, DMX_ADD_PID, &Pid));
|
||||
if (ret < 0)
|
||||
lt_info("%s: DMX_ADD_PID (%m)\n", __func__);
|
||||
hal_info("%s: DMX_ADD_PID (%m)\n", __func__);
|
||||
return (ret != -1);
|
||||
}
|
||||
|
||||
@@ -470,27 +470,27 @@ void cDemux::removePid(unsigned short Pid)
|
||||
{
|
||||
if (dmx_type != DMX_TP_CHANNEL)
|
||||
{
|
||||
lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid);
|
||||
hal_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid);
|
||||
return;
|
||||
}
|
||||
for (std::vector<pes_pids>::iterator i = pesfds.begin(); i != pesfds.end(); ++i)
|
||||
{
|
||||
if ((*i).pid == Pid) {
|
||||
lt_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid);
|
||||
hal_debug("removePid: removing demux fd %d pid 0x%04x\n", fd, Pid);
|
||||
if (ioctl(fd, DMX_REMOVE_PID, Pid) < 0)
|
||||
lt_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid);
|
||||
hal_info("%s: (DMX_REMOVE_PID, 0x%04hx): %m\n", __func__, Pid);
|
||||
pesfds.erase(i);
|
||||
return; /* TODO: what if the same PID is there multiple times */
|
||||
}
|
||||
}
|
||||
lt_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid);
|
||||
hal_info("%s pid 0x%04x not found\n", __FUNCTION__, Pid);
|
||||
}
|
||||
|
||||
void cDemux::getSTC(int64_t * STC)
|
||||
{
|
||||
/* apparently I can only get the PTS of the video decoder,
|
||||
* but that's good enough for dvbsub */
|
||||
lt_debug("%s #%d\n", __func__, num);
|
||||
hal_debug("%s #%d\n", __func__, num);
|
||||
int64_t pts = 0;
|
||||
if (videoDecoder)
|
||||
pts = videoDecoder->GetPTS();
|
||||
@@ -499,7 +499,7 @@ void cDemux::getSTC(int64_t * STC)
|
||||
|
||||
int cDemux::getUnit(void)
|
||||
{
|
||||
lt_debug("%s #%d\n", __FUNCTION__, num);
|
||||
hal_debug("%s #%d\n", __FUNCTION__, num);
|
||||
/* just guessed that this is the right thing to do.
|
||||
right now this is only used by the CA code which is stubbed out
|
||||
anyway */
|
||||
@@ -508,12 +508,12 @@ int cDemux::getUnit(void)
|
||||
|
||||
bool cDemux::SetSource(int unit, int source)
|
||||
{
|
||||
lt_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source);
|
||||
hal_info_c("%s(%d, %d): not implemented yet\n", __func__, unit, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
int cDemux::GetSource(int unit)
|
||||
{
|
||||
lt_info_c("%s(%d): not implemented yet\n", __func__, unit);
|
||||
hal_info_c("%s(%d): not implemented yet\n", __func__, unit);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -2,22 +2,22 @@
|
||||
|
||||
#include "init.h"
|
||||
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args)
|
||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args)
|
||||
#include "hal_debug.h"
|
||||
#define hal_debug(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args)
|
||||
#define hal_info(args...) _hal_info(HAL_DEBUG_INIT, NULL, args)
|
||||
|
||||
static bool initialized = false;
|
||||
|
||||
void init_td_api()
|
||||
{
|
||||
if (!initialized)
|
||||
lt_debug_init();
|
||||
lt_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel);
|
||||
hal_debug_init();
|
||||
hal_info("%s begin, initialized=%d, debug=0x%02x\n", __func__, (int)initialized, debuglevel);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void shutdown_td_api()
|
||||
{
|
||||
lt_info("%s, initialized = %d\n", __func__, (int)initialized);
|
||||
hal_info("%s, initialized = %d\n", __func__, (int)initialized);
|
||||
initialized = false;
|
||||
}
|
||||
|
@@ -38,10 +38,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PLAYBACK, this, args)
|
||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PLAYBACK, this, args)
|
||||
#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_PLAYBACK, NULL, args)
|
||||
#include "hal_debug.h"
|
||||
#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYBACK, this, args)
|
||||
#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYBACK, this, args)
|
||||
#define hal_info_c(args...) _hal_info(HAL_DEBUG_PLAYBACK, NULL, args)
|
||||
|
||||
#include <proc_tools.h>
|
||||
|
||||
@@ -76,7 +76,7 @@ static time_t monotonic_ms(void)
|
||||
/* the mutex makes sure that commands are not interspersed */
|
||||
bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int buflen)
|
||||
{
|
||||
lt_info("%s: %d %d %d %d\n", __func__, cmd, param, has_param, buflen);
|
||||
hal_info("%s: %d %d %d %d\n", __func__, cmd, param, has_param, buflen);
|
||||
bool ret = true;
|
||||
int fd;
|
||||
if (cmd == 222)
|
||||
@@ -101,7 +101,7 @@ bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int
|
||||
{
|
||||
while ((fd = open(OUT_FILE, O_RDONLY)) == -1) {
|
||||
if (++m > 500) { /* don't wait more than 5 seconds */
|
||||
lt_info("%s: timed out waiting for %s (cmd %d par %d buflen %d\n",
|
||||
hal_info("%s: timed out waiting for %s (cmd %d par %d buflen %d\n",
|
||||
__func__, OUT_FILE, cmd, param, buflen);
|
||||
ret = false;
|
||||
goto out;
|
||||
@@ -131,7 +131,7 @@ bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int
|
||||
out:
|
||||
pthread_mutex_unlock(&rmfp_cmd_mutex);
|
||||
if (cmd != 222) /* called tooo often :-) */
|
||||
lt_info("%s: reply: '%s' ret: %d m:%d\n", __func__, buf?buf:"(none)", ret, m);
|
||||
hal_info("%s: reply: '%s' ret: %d m:%d\n", __func__, buf?buf:"(none)", ret, m);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ bool cPlayback::rmfp_command(int cmd, int param, bool has_param, char *buf, int
|
||||
*/
|
||||
void cPlayback::run_rmfp()
|
||||
{
|
||||
lt_debug("%s: starting\n", __func__);
|
||||
hal_debug("%s: starting\n", __func__);
|
||||
thread_started = true;
|
||||
//Watch for the space at the end
|
||||
std::string base = "rmfp_player -dram 1 -ve 1 -waitexit ";
|
||||
@@ -163,7 +163,7 @@ void cPlayback::run_rmfp()
|
||||
pid = forkpty(&master, NULL, NULL, NULL);
|
||||
if (! pid) {
|
||||
execl("/bin/sh", "sh", "-c", final.c_str(), (char *)0);
|
||||
lt_info("%s: execl returned: %m\n", __func__);
|
||||
hal_info("%s: execl returned: %m\n", __func__);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -181,17 +181,17 @@ void cPlayback::run_rmfp()
|
||||
break;
|
||||
output[len] = '\0';
|
||||
}
|
||||
lt_info("%s out: '%s'\n", __func__, output);
|
||||
hal_info("%s out: '%s'\n", __func__, output);
|
||||
if (strstr(output, "Playback has started..."))
|
||||
{
|
||||
playing = 1;
|
||||
lt_info("%s: ===================> playing = true\n", __func__);
|
||||
hal_info("%s: ===================> playing = true\n", __func__);
|
||||
}
|
||||
else if (strstr(output, "End of file..."))
|
||||
{
|
||||
playing = 1; /* this can happen without "Playback has started..." */
|
||||
eof_reached = true;
|
||||
lt_info("%s: ===================> eof_reached = true\n", __func__);
|
||||
hal_info("%s: ===================> eof_reached = true\n", __func__);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
@@ -201,7 +201,7 @@ void cPlayback::run_rmfp()
|
||||
free(output);
|
||||
}
|
||||
|
||||
lt_info("%s: terminating\n", __func__);
|
||||
hal_info("%s: terminating\n", __func__);
|
||||
if (playing == 0) /* playback did not start */
|
||||
playing = 2;
|
||||
else
|
||||
@@ -214,7 +214,7 @@ void cPlayback::run_rmfp()
|
||||
void *execute_rua_thread(void *c)
|
||||
{
|
||||
cPlayback *obj = (cPlayback *)c;
|
||||
lt_info_c("%s\n", __func__);
|
||||
hal_info_c("%s\n", __func__);
|
||||
obj->run_rmfp();
|
||||
/* free(obj); // this is most likely wrong */
|
||||
|
||||
@@ -231,11 +231,11 @@ bool cPlayback::Open(playmode_t PlayMode)
|
||||
playMode = PlayMode;
|
||||
if (playMode > 1)
|
||||
{
|
||||
lt_info("%s: PlayMode %d out of range!\n", __func__, PlayMode);
|
||||
hal_info("%s: PlayMode %d out of range!\n", __func__, PlayMode);
|
||||
playMode = PLAYMODE_FILE;
|
||||
}
|
||||
|
||||
lt_info("%s: mode %d (%s)\n", __func__, PlayMode, aPLAYMODE[PlayMode]);
|
||||
hal_info("%s: mode %d (%s)\n", __func__, PlayMode, aPLAYMODE[PlayMode]);
|
||||
#if 0
|
||||
while (access("/tmp/continue", R_OK))
|
||||
sleep(1);
|
||||
@@ -252,7 +252,7 @@ bool cPlayback::Open(playmode_t PlayMode)
|
||||
i++;
|
||||
if (i > 10)
|
||||
{
|
||||
lt_info("%s: ERROR - player is not idle after 10 seconds!\n", __func__);
|
||||
hal_info("%s: ERROR - player is not idle after 10 seconds!\n", __func__);
|
||||
open_success = false;
|
||||
return false;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ bool cPlayback::Open(playmode_t PlayMode)
|
||||
}
|
||||
|
||||
proc_put("/proc/player", "2", 2);
|
||||
lt_info("%s: /proc/player switched to '2'\n", __func__);
|
||||
hal_info("%s: /proc/player switched to '2'\n", __func__);
|
||||
|
||||
unlink(CMD_FILE);
|
||||
unlink(IN_FILE);
|
||||
@@ -276,8 +276,8 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
lt_info("%s: filename=%s\n", __func__, filename);
|
||||
lt_info("%s: vpid=%u vtype=%d apid=%u ac3=%d duration=%i open_success=%d\n",
|
||||
hal_info("%s: filename=%s\n", __func__, filename);
|
||||
hal_info("%s: vpid=%u vtype=%d apid=%u ac3=%d duration=%i open_success=%d\n",
|
||||
__func__, vpid, vtype, _apid, ac3, duration, open_success);
|
||||
|
||||
if (!open_success)
|
||||
@@ -291,7 +291,7 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
|
||||
mduration = duration;
|
||||
if (pthread_create(&thread, 0, execute_rua_thread, this) != 0)
|
||||
{
|
||||
lt_info("%s: error creating rmfp_player thread! (out of memory?)\n", __func__);
|
||||
hal_info("%s: error creating rmfp_player thread! (out of memory?)\n", __func__);
|
||||
ret = false;
|
||||
}
|
||||
while (! playing)
|
||||
@@ -303,32 +303,32 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
|
||||
|
||||
void cPlayback::Close(void)
|
||||
{
|
||||
lt_info("%s: playing %d thread_started %d\n", __func__, playing, thread_started);
|
||||
hal_info("%s: playing %d thread_started %d\n", __func__, playing, thread_started);
|
||||
|
||||
if (thread_started)
|
||||
{
|
||||
rmfp_command(KEY_COMMAND_QUIT_ALL, 0, false, NULL, 0);
|
||||
|
||||
if (pthread_join(thread, NULL))
|
||||
lt_info("%s: error joining rmfp thread (%m)\n", __func__);
|
||||
hal_info("%s: error joining rmfp thread (%m)\n", __func__);
|
||||
playing = 0;
|
||||
thread_started = false;
|
||||
}
|
||||
else
|
||||
lt_info("%s: Warning: thread_started == false!\n", __func__);
|
||||
hal_info("%s: Warning: thread_started == false!\n", __func__);
|
||||
|
||||
if (open_success)
|
||||
{
|
||||
proc_put("/proc/player", "1", 2);
|
||||
open_success = false;
|
||||
lt_info("%s: /proc/player switched to '1'\n", __func__);
|
||||
hal_info("%s: /proc/player switched to '1'\n", __func__);
|
||||
usleep(1000000);
|
||||
}
|
||||
}
|
||||
|
||||
bool cPlayback::SetAPid(unsigned short pid, int /*ac3*/)
|
||||
{
|
||||
lt_info("%s: pid %i\n", __func__, pid);
|
||||
hal_info("%s: pid %i\n", __func__, pid);
|
||||
if (pid != apid) {
|
||||
rmfp_command(KEY_COMMAND_SWITCH_AUDIO, pid, true, NULL, 0);
|
||||
apid = pid;
|
||||
@@ -338,7 +338,7 @@ bool cPlayback::SetAPid(unsigned short pid, int /*ac3*/)
|
||||
|
||||
bool cPlayback::SelectSubtitles(int pid)
|
||||
{
|
||||
lt_info("%s: pid %i\n", __func__, pid);
|
||||
hal_info("%s: pid %i\n", __func__, pid);
|
||||
if (pid != subpid)
|
||||
{
|
||||
rmfp_command(KEY_COMMAND_SWITCH_SUBS, pid, true, NULL, 0);
|
||||
@@ -349,7 +349,7 @@ bool cPlayback::SelectSubtitles(int pid)
|
||||
|
||||
bool cPlayback::SetSpeed(int speed)
|
||||
{
|
||||
lt_info("%s: playing %d speed %d\n", __func__, playing, speed);
|
||||
hal_info("%s: playing %d speed %d\n", __func__, playing, speed);
|
||||
|
||||
if (!playing)
|
||||
return false;
|
||||
@@ -369,7 +369,7 @@ bool cPlayback::SetSpeed(int speed)
|
||||
bool cPlayback::GetSpeed(int &/*speed*/) const
|
||||
{
|
||||
#if 0
|
||||
lt_info("%s:\n", __func__);
|
||||
hal_info("%s:\n", __func__);
|
||||
speed = playback_speed;
|
||||
#endif
|
||||
return true;
|
||||
@@ -378,7 +378,7 @@ bool cPlayback::GetSpeed(int &/*speed*/) const
|
||||
// in milliseconds
|
||||
bool cPlayback::GetPosition(int &position, int &duration)
|
||||
{
|
||||
lt_debug("%s: playing %d\n", __func__, playing);
|
||||
hal_debug("%s: playing %d\n", __func__, playing);
|
||||
|
||||
if (eof_reached)
|
||||
{
|
||||
@@ -416,7 +416,7 @@ bool cPlayback::GetPosition(int &position, int &duration)
|
||||
|
||||
bool cPlayback::SetPosition(int position, bool absolute)
|
||||
{
|
||||
lt_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing);
|
||||
hal_info("%s: pos %d abs %d playing %d\n", __func__, position, absolute, playing);
|
||||
|
||||
if (!playing)
|
||||
return false;
|
||||
@@ -438,7 +438,7 @@ bool cPlayback::SetPosition(int position, bool absolute)
|
||||
|
||||
void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language)
|
||||
{
|
||||
lt_info("%s\n", __func__);
|
||||
hal_info("%s\n", __func__);
|
||||
char buf[32];
|
||||
rmfp_command(CUSTOM_COMMAND_AUDIO_COUNT, 0, false, buf, 3);
|
||||
unsigned int audio_count = atoi(buf);
|
||||
@@ -459,14 +459,14 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
|
||||
apids[aid] = atoi(streamidstring);
|
||||
ac3flags[aid] = 0;
|
||||
language[aid] = audio_lang;
|
||||
lt_info("%s: #%d apid:%d lang: %s\n", __func__, aid, apids[aid], audio_lang);
|
||||
hal_info("%s: #%d apid:%d lang: %s\n", __func__, aid, apids[aid], audio_lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cPlayback::FindAllSubs(uint16_t *spids, unsigned short *supported, uint16_t *numpids, std::string *language)
|
||||
{
|
||||
lt_info("%s\n", __func__);
|
||||
hal_info("%s\n", __func__);
|
||||
char buf[32];
|
||||
|
||||
rmfp_command(CUSTOM_COMMAND_SUBS_COUNT, 0, false, buf, 3);
|
||||
@@ -488,7 +488,7 @@ void cPlayback::FindAllSubs(uint16_t *spids, unsigned short *supported, uint16_t
|
||||
spids[sid] = atoi(streamidstring);
|
||||
language[sid] = spu_lang;
|
||||
supported[sid] = 1;
|
||||
lt_info("%s: #%d apid:%d lang: %s\n", __func__, sid, spids[sid], spu_lang);
|
||||
hal_info("%s: #%d apid:%d lang: %s\n", __func__, sid, spids[sid], spu_lang);
|
||||
}
|
||||
}
|
||||
//Add streamid -1 to be able to disable subtitles
|
||||
@@ -506,7 +506,7 @@ void cPlayback::GetChapters(std::vector<int> &positions, std::vector<std::string
|
||||
|
||||
cPlayback::cPlayback(int /*num*/)
|
||||
{
|
||||
lt_info("%s: constructor\n", __func__);
|
||||
hal_info("%s: constructor\n", __func__);
|
||||
playing = 0;
|
||||
thread_started = false;
|
||||
eof_reached = false;
|
||||
@@ -516,6 +516,6 @@ cPlayback::cPlayback(int /*num*/)
|
||||
|
||||
cPlayback::~cPlayback()
|
||||
{
|
||||
lt_info("%s\n", __func__);
|
||||
hal_info("%s\n", __func__);
|
||||
pthread_mutex_destroy(&rmfp_cmd_mutex);
|
||||
}
|
||||
|
@@ -39,19 +39,19 @@
|
||||
|
||||
#include "video_lib.h"
|
||||
#define VIDEO_DEVICE "/dev/dvb/adapter0/video0"
|
||||
#include "lt_debug.h"
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args)
|
||||
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args)
|
||||
#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, NULL, args)
|
||||
#define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_VIDEO, NULL, args)
|
||||
#include "hal_debug.h"
|
||||
#define hal_debug(args...) _hal_debug(HAL_DEBUG_VIDEO, this, args)
|
||||
#define hal_info(args...) _hal_info(HAL_DEBUG_VIDEO, this, args)
|
||||
#define hal_debug_c(args...) _hal_debug(HAL_DEBUG_VIDEO, NULL, args)
|
||||
#define hal_info_c(args...) _hal_info(HAL_DEBUG_VIDEO, NULL, args)
|
||||
|
||||
#define fop(cmd, args...) ({ \
|
||||
int _r; \
|
||||
if (fd >= 0) { \
|
||||
if ((_r = ::cmd(fd, args)) < 0) \
|
||||
lt_info(#cmd"(fd, "#args")\n"); \
|
||||
hal_info(#cmd"(fd, "#args")\n"); \
|
||||
else \
|
||||
lt_debug(#cmd"(fd, "#args")\n");\
|
||||
hal_debug(#cmd"(fd, "#args")\n");\
|
||||
} \
|
||||
else { _r = fd; } \
|
||||
_r; \
|
||||
@@ -76,7 +76,7 @@ static void show_iframe(int fd, unsigned char *iframe, size_t st_size);
|
||||
|
||||
cVideo::cVideo(int, void *, void *, unsigned int)
|
||||
{
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
hal_debug("%s\n", __FUNCTION__);
|
||||
|
||||
//croppingMode = VID_DISPMODE_NORM;
|
||||
//outputformat = VID_OUTFMT_RGBC_SVIDEO;
|
||||
@@ -92,7 +92,7 @@ cVideo::cVideo(int, void *, void *, unsigned int)
|
||||
blank_size = 0;
|
||||
blankfd = open(blankname, O_RDONLY|O_CLOEXEC);
|
||||
if (blankfd < 0)
|
||||
lt_info("%s cannot open %s: %m", __func__, blankname);
|
||||
hal_info("%s cannot open %s: %m", __func__, blankname);
|
||||
else
|
||||
{
|
||||
if (fstat(blankfd, &st) != -1 && st.st_size > 0)
|
||||
@@ -100,10 +100,10 @@ cVideo::cVideo(int, void *, void *, unsigned int)
|
||||
blank_size = st.st_size;
|
||||
blank_data = (unsigned char *)malloc(blank_size);
|
||||
if (! blank_data)
|
||||
lt_info("%s malloc failed (%m)\n", __func__);
|
||||
hal_info("%s malloc failed (%m)\n", __func__);
|
||||
else if (read(blankfd, blank_data, blank_size) != blank_size)
|
||||
{
|
||||
lt_info("%s short read (%m)\n", __func__);
|
||||
hal_info("%s short read (%m)\n", __func__);
|
||||
free(blank_data); /* don't leak... */
|
||||
blank_data = NULL;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ cVideo::~cVideo(void)
|
||||
void cVideo::openDevice(void)
|
||||
{
|
||||
int n = 0;
|
||||
lt_debug("%s\n", __func__);
|
||||
hal_debug("%s\n", __func__);
|
||||
/* todo: this fd checking is racy, should be protected by a lock */
|
||||
if (fd != -1) /* already open */
|
||||
return;
|
||||
@@ -138,14 +138,14 @@ retry:
|
||||
if (++n < 10)
|
||||
goto retry;
|
||||
}
|
||||
lt_info("%s cannot open %s: %m, retries %d\n", __func__, VIDEO_DEVICE, n);
|
||||
hal_info("%s cannot open %s: %m, retries %d\n", __func__, VIDEO_DEVICE, n);
|
||||
}
|
||||
playstate = VIDEO_STOPPED;
|
||||
}
|
||||
|
||||
void cVideo::closeDevice(void)
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
hal_debug("%s\n", __func__);
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
fd = -1;
|
||||
@@ -160,22 +160,22 @@ int cVideo::setAspectRatio(int aspect, int mode)
|
||||
int n;
|
||||
|
||||
int mo = (mode < 0||mode > 3) ? 4 : mode;
|
||||
lt_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mo]);
|
||||
hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mo]);
|
||||
|
||||
if (aspect > 3 || aspect == 0)
|
||||
lt_info("%s: invalid aspect: %d\n", __func__, aspect);
|
||||
hal_info("%s: invalid aspect: %d\n", __func__, aspect);
|
||||
else if (aspect > 0) /* -1 == don't set */
|
||||
{
|
||||
lt_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]);
|
||||
hal_debug("%s: /proc/stb/video/aspect -> %s\n", __func__, a[aspect]);
|
||||
n = proc_put("/proc/stb/video/aspect", a[aspect], strlen(a[aspect]));
|
||||
if (n < 0)
|
||||
lt_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__);
|
||||
hal_info("%s: proc_put /proc/stb/video/aspect (%m)\n", __func__);
|
||||
}
|
||||
|
||||
if (mode == -1)
|
||||
return 0;
|
||||
|
||||
lt_debug("%s: /proc/scalingmode -> %s\n", __func__, m[mo]);
|
||||
hal_debug("%s: /proc/scalingmode -> %s\n", __func__, m[mo]);
|
||||
n = proc_put("/proc/scalingmode", m[mo], strlen(m[mo]));
|
||||
if (n < 0)
|
||||
return 1;
|
||||
@@ -193,10 +193,10 @@ int cVideo::getAspectRatio(void)
|
||||
}
|
||||
if (fop(ioctl, VIDEO_GET_SIZE, &s) < 0)
|
||||
{
|
||||
lt_info("%s: VIDEO_GET_SIZE %m\n", __func__);
|
||||
hal_info("%s: VIDEO_GET_SIZE %m\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
lt_debug("%s: %d\n", __func__, s.aspect_ratio);
|
||||
hal_debug("%s: %d\n", __func__, s.aspect_ratio);
|
||||
return s.aspect_ratio * 2 + 1;
|
||||
}
|
||||
|
||||
@@ -211,14 +211,14 @@ int cVideo::setCroppingMode(int /*vidDispMode_t format*/)
|
||||
f = format_string[format];
|
||||
else
|
||||
f = "ILLEGAL format!";
|
||||
lt_debug("%s(%d) => %s\n", __FUNCTION__, format, f);
|
||||
hal_debug("%s(%d) => %s\n", __FUNCTION__, format, f);
|
||||
return fop(ioctl, MPEG_VID_SET_DISPMODE, format);
|
||||
#endif
|
||||
}
|
||||
|
||||
int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned short /*VideoPid*/, void * /*hChannel*/)
|
||||
{
|
||||
lt_debug("%s playstate=%d\n", __FUNCTION__, playstate);
|
||||
hal_debug("%s playstate=%d\n", __FUNCTION__, playstate);
|
||||
#if 0
|
||||
if (playstate == VIDEO_PLAYING)
|
||||
return 0;
|
||||
@@ -231,10 +231,10 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho
|
||||
|
||||
int cVideo::Stop(bool blank)
|
||||
{
|
||||
lt_debug("%s(%d)\n", __FUNCTION__, blank);
|
||||
hal_debug("%s(%d)\n", __FUNCTION__, blank);
|
||||
if (stillpicture)
|
||||
{
|
||||
lt_debug("%s: stillpicture == true\n", __func__);
|
||||
hal_debug("%s: stillpicture == true\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
/* blank parameter seems to not work on VIDEO_STOP */
|
||||
@@ -255,7 +255,7 @@ int cVideo::setBlank(int)
|
||||
|
||||
int cVideo::SetVideoSystem(int video_system, bool remember)
|
||||
{
|
||||
lt_debug("%s(%d, %d)\n", __func__, video_system, remember);
|
||||
hal_debug("%s(%d, %d)\n", __func__, video_system, remember);
|
||||
char current[32];
|
||||
static const char *modes[] = {
|
||||
"480i", // VIDEO_STD_NTSC
|
||||
@@ -276,16 +276,16 @@ int cVideo::SetVideoSystem(int video_system, bool remember)
|
||||
|
||||
if (video_system > VIDEO_STD_MAX)
|
||||
{
|
||||
lt_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX);
|
||||
hal_info("%s: video_system (%d) > VIDEO_STD_MAX (%d)\n", __func__, video_system, VIDEO_STD_MAX);
|
||||
return -1;
|
||||
}
|
||||
int ret = proc_get("/proc/stb/video/videomode", current, 32);
|
||||
if (strcmp(current, modes[video_system]) == 0)
|
||||
{
|
||||
lt_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current);
|
||||
hal_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current);
|
||||
return 0;
|
||||
}
|
||||
lt_info("%s: old: '%s' new: '%s'\n", __func__, current, modes[video_system]);
|
||||
hal_info("%s: old: '%s' new: '%s'\n", __func__, current, modes[video_system]);
|
||||
ret = proc_put("/proc/stb/video/videomode", modes[video_system],strlen(modes[video_system]));
|
||||
|
||||
return ret;
|
||||
@@ -298,10 +298,10 @@ int cVideo::getPlayState(void)
|
||||
|
||||
void cVideo::SetVideoMode(analog_mode_t mode)
|
||||
{
|
||||
lt_debug("%s(%d)\n", __func__, mode);
|
||||
hal_debug("%s(%d)\n", __func__, mode);
|
||||
if (!(mode & ANALOG_SCART_MASK))
|
||||
{
|
||||
lt_debug("%s: non-SCART mode ignored\n", __func__);
|
||||
hal_debug("%s: non-SCART mode ignored\n", __func__);
|
||||
return;
|
||||
}
|
||||
const char *m;
|
||||
@@ -314,7 +314,7 @@ void cVideo::SetVideoMode(analog_mode_t mode)
|
||||
m = "rgb";
|
||||
break;
|
||||
default:
|
||||
lt_info("%s unknown mode %d\n", __func__, mode);
|
||||
hal_info("%s unknown mode %d\n", __func__, mode);
|
||||
m = "rgb";
|
||||
break; /* default to rgb */
|
||||
}
|
||||
@@ -323,7 +323,7 @@ void cVideo::SetVideoMode(analog_mode_t mode)
|
||||
|
||||
void cVideo::ShowPicture(const char * fname)
|
||||
{
|
||||
lt_debug("%s(%s)\n", __func__, fname);
|
||||
hal_debug("%s(%s)\n", __func__, fname);
|
||||
char destname[512];
|
||||
char cmd[512];
|
||||
char *p;
|
||||
@@ -333,18 +333,18 @@ void cVideo::ShowPicture(const char * fname)
|
||||
if (video_standby)
|
||||
{
|
||||
/* does not work and the driver does not seem to like it */
|
||||
lt_info("%s: video_standby == true\n", __func__);
|
||||
hal_info("%s: video_standby == true\n", __func__);
|
||||
return;
|
||||
}
|
||||
if (fd < 0)
|
||||
{
|
||||
lt_info("%s: decoder not opened?\n", __func__);
|
||||
hal_info("%s: decoder not opened?\n", __func__);
|
||||
return;
|
||||
}
|
||||
strcpy(destname, "/var/cache");
|
||||
if (stat(fname, &st2))
|
||||
{
|
||||
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
||||
hal_info("%s: could not stat %s (%m)\n", __func__, fname);
|
||||
return;
|
||||
}
|
||||
mkdir(destname, 0755);
|
||||
@@ -379,7 +379,7 @@ void cVideo::ShowPicture(const char * fname)
|
||||
mfd = open(destname, O_RDONLY|O_CLOEXEC);
|
||||
if (mfd < 0)
|
||||
{
|
||||
lt_info("%s cannot open %s: %m", __func__, destname);
|
||||
hal_info("%s cannot open %s: %m", __func__, destname);
|
||||
goto out;
|
||||
}
|
||||
fstat(mfd, &st);
|
||||
@@ -389,7 +389,7 @@ void cVideo::ShowPicture(const char * fname)
|
||||
iframe = (unsigned char *)malloc(st.st_size);
|
||||
if (! iframe)
|
||||
{
|
||||
lt_info("%s: malloc failed (%m)\n", __func__);
|
||||
hal_info("%s: malloc failed (%m)\n", __func__);
|
||||
goto out;
|
||||
}
|
||||
read(mfd, iframe, st.st_size);
|
||||
@@ -403,13 +403,13 @@ void cVideo::ShowPicture(const char * fname)
|
||||
|
||||
void cVideo::StopPicture()
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
hal_debug("%s\n", __func__);
|
||||
stillpicture = false;
|
||||
}
|
||||
|
||||
void cVideo::Standby(unsigned int bOn)
|
||||
{
|
||||
lt_debug("%s(%d)\n", __func__, bOn);
|
||||
hal_debug("%s(%d)\n", __func__, bOn);
|
||||
if (bOn)
|
||||
{
|
||||
closeDevice();
|
||||
@@ -426,7 +426,7 @@ void cVideo::Standby(unsigned int bOn)
|
||||
int cVideo::getBlank(void)
|
||||
{
|
||||
int ret = proc_get_hex("/proc/stb/vmpeg/0/xres");
|
||||
lt_debug("%s => %d\n", __func__, !ret);
|
||||
hal_debug("%s => %d\n", __func__, !ret);
|
||||
return !ret;
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ void cVideo::VideoParamWatchdog(void)
|
||||
ioctl(fd, MPEG_VID_GET_V_INFO_RAW, &v_info);
|
||||
if (_v_info != v_info)
|
||||
{
|
||||
lt_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info);
|
||||
hal_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info);
|
||||
setAspectRatio(-1, -1);
|
||||
}
|
||||
_v_info = v_info;
|
||||
@@ -457,7 +457,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h)
|
||||
* TODO: check this in the driver sources */
|
||||
int xres = 720; /* proc_get_hex("/proc/stb/vmpeg/0/xres") */
|
||||
int yres = 576; /* proc_get_hex("/proc/stb/vmpeg/0/yres") */
|
||||
lt_debug("%s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", __func__, x, y, w, h, osd_w, osd_h);
|
||||
hal_debug("%s: x:%d y:%d w:%d h:%d ow:%d oh:%d\n", __func__, x, y, w, h, osd_w, osd_h);
|
||||
if (x == -1 && y == -1 && w == -1 && h == -1)
|
||||
{
|
||||
_w = xres;
|
||||
@@ -472,7 +472,7 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h)
|
||||
_y = y * yres / osd_h;
|
||||
_h = h * yres / osd_h;
|
||||
}
|
||||
lt_debug("%s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", __func__, _x, _y, _w, _h, xres, yres);
|
||||
hal_debug("%s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", __func__, _x, _y, _w, _h, xres, yres);
|
||||
sprintf(buffer, "%x", _x);
|
||||
proc_put("/proc/stb/vmpeg/0/dst_left", buffer, strlen(buffer));
|
||||
sprintf(buffer, "%x", _y);
|
||||
@@ -528,12 +528,12 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate)
|
||||
rate = rate2csapi(r);
|
||||
height = s.h;
|
||||
width = s.w;
|
||||
lt_debug("%s: rate: %d, width: %d height: %d\n", __func__, rate, width, height);
|
||||
hal_debug("%s: rate: %d, width: %d height: %d\n", __func__, rate, width, height);
|
||||
}
|
||||
|
||||
void cVideo::SetSyncMode(AVSYNC_TYPE mode)
|
||||
{
|
||||
lt_debug("%s %d\n", __func__, mode);
|
||||
hal_debug("%s %d\n", __func__, mode);
|
||||
/*
|
||||
* { 0, LOCALE_OPTIONS_OFF },
|
||||
* { 1, LOCALE_OPTIONS_ON },
|
||||
@@ -566,7 +566,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type)
|
||||
"VIDEO_FORMAT_PNG"
|
||||
};
|
||||
int t;
|
||||
lt_debug("%s type=%s\n", __FUNCTION__, VF[type]);
|
||||
hal_debug("%s type=%s\n", __FUNCTION__, VF[type]);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -583,7 +583,7 @@ int cVideo::SetStreamType(VIDEO_FORMAT type)
|
||||
}
|
||||
|
||||
if (ioctl(fd, VIDEO_SET_STREAMTYPE, t) < 0)
|
||||
lt_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t);
|
||||
hal_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ int64_t cVideo::GetPTS(void)
|
||||
{
|
||||
int64_t pts = 0;
|
||||
if (ioctl(fd, VIDEO_GET_PTS, &pts) < 0)
|
||||
lt_info("%s: GET_PTS failed (%m)\n", __func__);
|
||||
hal_info("%s: GET_PTS failed (%m)\n", __func__);
|
||||
return pts;
|
||||
}
|
||||
|
||||
@@ -604,7 +604,7 @@ static void show_iframe(int fd, unsigned char *iframe, size_t st_size)
|
||||
size_t pos = 0;
|
||||
int count = 7;
|
||||
if (ioctl(fd, VIDEO_SET_FORMAT, VIDEO_FORMAT_16_9) < 0)
|
||||
lt_info_c("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__);
|
||||
hal_info_c("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__);
|
||||
ioctl(fd, VIDEO_SET_STREAMTYPE, VIDEO_FORMAT_MPEG2);
|
||||
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
|
||||
ioctl(fd, VIDEO_PLAY);
|
||||
@@ -633,5 +633,5 @@ static void show_iframe(int fd, unsigned char *iframe, size_t st_size)
|
||||
|
||||
void cVideo::SetDemux(cDemux *)
|
||||
{
|
||||
lt_debug("%s: not implemented yet\n", __func__);
|
||||
hal_debug("%s: not implemented yet\n", __func__);
|
||||
}
|
||||
|
Reference in New Issue
Block a user