Origin commit data
------------------
Branch: master
Commit: 23bea61473
Author: martii <m4rtii@gmx.de>
Date: 2013-06-08 (Sat, 08 Jun 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-06-08 15:39:35 +02:00
parent aea027c163
commit 4cb0f441c9
22 changed files with 17 additions and 407 deletions

View File

@@ -151,12 +151,11 @@ void GLFramebuffer::initKeys()
mKeyMap['7'] = KEY_7; mKeyMap['7'] = KEY_7;
mKeyMap['8'] = KEY_8; mKeyMap['8'] = KEY_8;
mKeyMap['9'] = KEY_9; mKeyMap['9'] = KEY_9;
#ifdef MARTII
mKeyMap['r'] = KEY_RED; mKeyMap['r'] = KEY_RED;
mKeyMap['g'] = KEY_GREEN; mKeyMap['g'] = KEY_GREEN;
mKeyMap['y'] = KEY_YELLOW; mKeyMap['y'] = KEY_YELLOW;
mKeyMap['b'] = KEY_BLUE; mKeyMap['b'] = KEY_BLUE;
#endif
} }
void GLFramebuffer::run() void GLFramebuffer::run()

View File

@@ -13,11 +13,7 @@ void cPlayback::Close(void)
{ {
} }
#ifdef MARTII
bool cPlayback::Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration, bool /*noprobe*/) bool cPlayback::Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration, bool /*noprobe*/)
#else
bool cPlayback::Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration)
#endif
{ {
printf("%s:%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d duration=%i\n", printf("%s:%s - filename=%s vpid=%u vtype=%d apid=%u ac3=%d duration=%i\n",
FILENAME, __func__, filename, vpid, vtype, apid, ac3, duration); FILENAME, __func__, filename, vpid, vtype, apid, ac3, duration);
@@ -30,14 +26,6 @@ bool cPlayback::SetAPid(unsigned short pid, bool /*ac3*/)
return true; return true;
} }
#ifndef MARTII
bool cPlayback::SetSPid(int pid)
{
printf("%s:%s pid %i\n", FILENAME, __func__, pid);
return true;
}
#endif
bool cPlayback::SetSpeed(int speed) bool cPlayback::SetSpeed(int speed)
{ {
printf("%s:%s playing %d speed %d\n", FILENAME, __func__, playing, speed); printf("%s:%s playing %d speed %d\n", FILENAME, __func__, playing, speed);
@@ -68,7 +56,7 @@ void cPlayback::FindAllPids(uint16_t *, unsigned short *, uint16_t *numpida, std
printf("%s:%s\n", FILENAME, __func__); printf("%s:%s\n", FILENAME, __func__);
*numpida = 0; *numpida = 0;
} }
#ifdef MARTII
void cPlayback::FindAllSubtitlePids(uint16_t * /*pids*/, uint16_t *numpids, std::string * /*language*/) void cPlayback::FindAllSubtitlePids(uint16_t * /*pids*/, uint16_t *numpids, std::string * /*language*/)
{ {
*numpids = 0; *numpids = 0;
@@ -110,7 +98,6 @@ void cPlayback::RequestAbort()
unsigned short cPlayback::GetTeletextPid(void) unsigned short cPlayback::GetTeletextPid(void)
{ {
} }
#endif
cPlayback::cPlayback(int /*num*/) cPlayback::cPlayback(int /*num*/)
{ {

View File

@@ -13,27 +13,18 @@ class cPlayback
{ {
private: private:
bool playing; bool playing;
#ifdef MARTII
int mAudioStream; int mAudioStream;
int mSubtitleStream; int mSubtitleStream;
int mDvbsubtitleStream; int mDvbsubtitleStream;
int mTeletextStream; int mTeletextStream;
void (*framebuffer_callback)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *); void (*framebuffer_callback)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *);
#endif
public: public:
#ifdef MARTII
cPlayback(int num __attribute__((unused))= 0, void (* /*fbcb*/)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *) = NULL) { }; cPlayback(int num __attribute__((unused))= 0, void (* /*fbcb*/)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *) = NULL) { };
#endif
bool Open(playmode_t PlayMode); bool Open(playmode_t PlayMode);
void Close(void); void Close(void);
#ifdef MARTII
bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration, bool no_probe = true); bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration, bool no_probe = true);
#else
bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration);
#endif
bool Stop(void); bool Stop(void);
bool SetAPid(unsigned short pid, bool ac3); bool SetAPid(unsigned short pid, bool ac3);
#ifdef MARTII
bool SetSubtitlePid(unsigned short pid); bool SetSubtitlePid(unsigned short pid);
bool SetDvbsubtitlePid(unsigned short pid); bool SetDvbsubtitlePid(unsigned short pid);
bool SetTeletextPid(unsigned short pid); bool SetTeletextPid(unsigned short pid);
@@ -42,23 +33,16 @@ class cPlayback
unsigned short GetDvbsubtitlePid(void) { return mDvbsubtitleStream; } unsigned short GetDvbsubtitlePid(void) { return mDvbsubtitleStream; }
unsigned short GetTeletextPid(void); unsigned short GetTeletextPid(void);
void SuspendSubtitle(bool); void SuspendSubtitle(bool);
#else
bool SetSPid(int pid);
#endif
bool SetSpeed(int speed); bool SetSpeed(int speed);
bool GetSpeed(int &speed) const; bool GetSpeed(int &speed) const;
bool GetPosition(int &position, int &duration); bool GetPosition(int &position, int &duration);
bool SetPosition(int position, bool absolute = false); bool SetPosition(int position, bool absolute = false);
void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language);
#ifdef MARTII
void FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language);
void FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language);
void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage); void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage);
void RequestAbort(void); void RequestAbort(void);
#else
void FindAllSPids(int *spids, uint16_t *numpids, std::string *language);
#endif
// //
cPlayback(int num = 0); cPlayback(int num = 0);
~cPlayback(); ~cPlayback();

View File

@@ -326,11 +326,7 @@ int cVideo::getBlank(void)
return 0; return 0;
} }
#ifdef MARTII
void cVideo::Pig(int x, int y, int w, int h, int /*osd_w*/, int /*osd_h*/, int /*startx*/, int /*starty*/, int /*endx*/, int /*endy*/) void cVideo::Pig(int x, int y, int w, int h, int /*osd_w*/, int /*osd_h*/, int /*startx*/, int /*starty*/, int /*endx*/, int /*endy*/)
#else
void cVideo::Pig(int x, int y, int w, int h, int, int)
#endif
{ {
pig_x = x; pig_x = x;
pig_y = y; pig_y = y;

View File

@@ -181,11 +181,7 @@ class cVideo : public OpenThreads::Thread
void ShowPicture(const char * fname); void ShowPicture(const char * fname);
void StopPicture(); void StopPicture();
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
#ifdef MARTII
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719);
#else
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600);
#endif
void SetControl(int, int) { return; }; void SetControl(int, int) { return; };
void setContrast(int val); void setContrast(int val);
void SetVideoMode(analog_mode_t mode); void SetVideoMode(analog_mode_t mode);

View File

@@ -3,9 +3,7 @@
#include "../libtriple/audio_td.h" #include "../libtriple/audio_td.h"
#elif HAVE_SPARK_HARDWARE #elif HAVE_SPARK_HARDWARE
#include "../libspark/audio_lib.h" #include "../libspark/audio_lib.h"
#ifdef MARTII
#include "../libspark/audio_mixer.h" #include "../libspark/audio_mixer.h"
#endif
#elif HAVE_AZBOX_HARDWARE #elif HAVE_AZBOX_HARDWARE
#include "../azbox/audio_lib.h" #include "../azbox/audio_lib.h"
#elif HAVE_GENERIC_HARDWARE #elif HAVE_GENERIC_HARDWARE

View File

@@ -35,9 +35,7 @@ typedef struct hw_caps
int display_yres; int display_yres;
char boxvendor[64]; char boxvendor[64];
char boxname[64]; char boxname[64];
#ifdef MARTII
int boxtype; int boxtype;
#endif
} hw_caps_t; } hw_caps_t;
hw_caps_t *get_hwcaps(void); hw_caps_t *get_hwcaps(void);

View File

@@ -37,9 +37,6 @@ cAudio::cAudio(void *, void *, void *)
mixer_fd = -1; mixer_fd = -1;
openDevice(); openDevice();
Muted = false; Muted = false;
#ifdef MARTII
percent = 100;
#endif
} }
cAudio::~cAudio(void) cAudio::~cAudio(void)
@@ -111,11 +108,7 @@ int cAudio::setVolume(unsigned int left, unsigned int right)
lt_debug("%s(%d, %d)\n", __func__, left, right); lt_debug("%s(%d, %d)\n", __func__, left, right);
volume = (left + right) / 2; volume = (left + right) / 2;
#ifdef MARTII
int v = map_volume((volume * percent)/100);
#else
int v = map_volume(volume); int v = map_volume(volume);
#endif
if (clipfd != -1 && mixer_fd != -1) { if (clipfd != -1 && mixer_fd != -1) {
int tmp = 0; int tmp = 0;
/* not sure if left / right is correct here, but it is always the same anyways ;-) */ /* not sure if left / right is correct here, but it is always the same anyways ;-) */
@@ -126,13 +119,6 @@ int cAudio::setVolume(unsigned int left, unsigned int right)
lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp);
return ret; return ret;
} }
#ifndef MARTII
/* compensate for different decoding volume of mpeg and ac3 streams
* TODO: check if this is correct for all channels
* and if we need to do something with DTS? */
if (StreamType == AUDIO_FMT_MPEG)
v = map_volume(volume * 30 / 53);
#endif
char str[4]; char str[4];
sprintf(str, "%d", v); sprintf(str, "%d", v);
@@ -153,24 +139,17 @@ int cAudio::Stop(void)
return ioctl(fd, AUDIO_STOP); return ioctl(fd, AUDIO_STOP);
} }
#ifdef MARTII
bool cAudio::Pause(bool Pcm) bool cAudio::Pause(bool Pcm)
{ {
ioctl(fd, Pcm ? AUDIO_PAUSE : AUDIO_CONTINUE, 1); ioctl(fd, Pcm ? AUDIO_PAUSE : AUDIO_CONTINUE, 1);
return true; return true;
} }
#else
bool cAudio::Pause(bool /*Pcm*/)
{
return true;
};
#endif
void cAudio::SetSyncMode(AVSYNC_TYPE Mode) void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
{ {
lt_debug("%s %d\n", __func__, Mode); lt_debug("%s %d\n", __func__, Mode);
ioctl(fd, AUDIO_SET_AV_SYNC, Mode); ioctl(fd, AUDIO_SET_AV_SYNC, Mode);
}; }
//AUDIO_ENCODING_AC3 //AUDIO_ENCODING_AC3
#define AUDIO_STREAMTYPE_AC3 0 #define AUDIO_STREAMTYPE_AC3 0
@@ -184,9 +163,6 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
void cAudio::SetStreamType(AUDIO_FORMAT type) void cAudio::SetStreamType(AUDIO_FORMAT type)
{ {
int bypass = AUDIO_STREAMTYPE_MPEG; int bypass = AUDIO_STREAMTYPE_MPEG;
#ifndef MARTII
bool update_volume = (StreamType != type);
#endif
lt_debug("%s %d\n", __FUNCTION__, type); lt_debug("%s %d\n", __FUNCTION__, type);
StreamType = type; StreamType = type;
@@ -207,17 +183,13 @@ void cAudio::SetStreamType(AUDIO_FORMAT type)
// But as we implemented the behavior to bypass (cause of e2) this is correct here // But as we implemented the behavior to bypass (cause of e2) this is correct here
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0)
lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
#ifndef MARTII }
if (update_volume)
setVolume(volume, volume);
#endif
};
int cAudio::setChannel(int channel) int cAudio::setChannel(int channel)
{ {
lt_debug("%s %d\n", __FUNCTION__, channel); lt_debug("%s %d\n", __FUNCTION__, channel);
return 0; return 0;
}; }
int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
{ {
@@ -315,7 +287,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
setVolume(volume, volume); setVolume(volume, volume);
return 0; return 0;
}; }
int cAudio::WriteClip(unsigned char *buffer, int size) int cAudio::WriteClip(unsigned char *buffer, int size)
{ {
@@ -412,17 +384,17 @@ void cAudio::SetSpdifDD(bool enable)
{ {
lt_debug("%s %d\n", __func__, enable); lt_debug("%s %d\n", __func__, enable);
setBypassMode(!enable); setBypassMode(!enable);
}; }
void cAudio::ScheduleMute(bool On) void cAudio::ScheduleMute(bool On)
{ {
lt_debug("%s %d\n", __FUNCTION__, On); lt_debug("%s %d\n", __FUNCTION__, On);
}; }
void cAudio::EnableAnalogOut(bool enable) void cAudio::EnableAnalogOut(bool enable)
{ {
lt_debug("%s %d\n", __FUNCTION__, enable); lt_debug("%s %d\n", __FUNCTION__, enable);
}; }
#define AUDIO_BYPASS_ON 0 #define AUDIO_BYPASS_ON 0
#define AUDIO_BYPASS_OFF 1 #define AUDIO_BYPASS_OFF 1
@@ -432,20 +404,3 @@ void cAudio::setBypassMode(bool disable)
lt_debug("%s %d\n", __func__, disable); lt_debug("%s %d\n", __func__, disable);
proc_put("/proc/stb/audio/ac3", opt[disable], strlen(opt[disable])); proc_put("/proc/stb/audio/ac3", opt[disable], strlen(opt[disable]));
} }
#ifdef MARTII
int cAudio::getPercent(void) {
return percent;
}
int cAudio::setPercent(int perc) {
lt_debug("%s %d (muted: %d)\n", __func__, perc, Muted);
int old_percent = percent;
percent = perc;
if (percent < 0 || percent > 999)
percent = 100;
if(!Muted)
setVolume(volume, volume);
return old_percent;
}
#endif

View File

@@ -57,9 +57,6 @@ class cAudio
int do_mute(bool enable, bool remember); int do_mute(bool enable, bool remember);
void setBypassMode(bool disable); void setBypassMode(bool disable);
#ifdef MARTII
int percent;
#endif
public: public:
/* construct & destruct */ /* construct & destruct */
cAudio(void *, void *, void *); cAudio(void *, void *, void *);
@@ -94,10 +91,6 @@ class cAudio
void SetSpdifDD(bool enable); void SetSpdifDD(bool enable);
void ScheduleMute(bool On); void ScheduleMute(bool On);
void EnableAnalogOut(bool enable); void EnableAnalogOut(bool enable);
#ifdef MARTII
int getPercent(void);
int setPercent(int perc);
#endif
}; };
#endif #endif

View File

@@ -208,10 +208,8 @@ bool cDemux::_open(void)
else else
init[devnum] = true; init[devnum] = true;
} }
#ifdef MARTII
if (buffersize == 0) if (buffersize == 0)
buffersize = 0xffff; // may or may not be reasonable --martii buffersize = 0xffff; // may or may not be reasonable --martii
#endif
if (buffersize > 0) if (buffersize > 0)
{ {
/* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */

View File

@@ -30,9 +30,7 @@ hw_caps_t *get_hwcaps(void)
memset(&caps, 0, sizeof(hw_caps_t)); memset(&caps, 0, sizeof(hw_caps_t));
initialized = 1; initialized = 1;
#ifdef MARTII
caps.can_cec = 1; caps.can_cec = 1;
#endif
caps.can_shutdown = 1; caps.can_shutdown = 1;
caps.display_type = HW_DISPLAY_LED_NUM; caps.display_type = HW_DISPLAY_LED_NUM;
caps.has_HDMI = 1; caps.has_HDMI = 1;
@@ -139,12 +137,10 @@ hw_caps_t *get_hwcaps(void)
default: default:
tmp = p; tmp = p;
} }
#ifdef MARTII
if ((sys_id & 0xff0000) == 0x090000) if ((sys_id & 0xff0000) == 0x090000)
caps.boxtype = 7111; caps.boxtype = 7111;
else else
caps.boxtype = 7162; caps.boxtype = 7162;
#endif
} else } else
tmp = "(NO STB_ID FOUND)"; tmp = "(NO STB_ID FOUND)";
strcpy(caps.boxname, tmp); strcpy(caps.boxname, tmp);

View File

@@ -11,16 +11,12 @@
#include <linux/dvb/dmx.h> #include <linux/dvb/dmx.h>
#ifndef MARTII
#include "lirmp_input.h"
#endif
#include "pwrmngr.h" #include "pwrmngr.h"
#include "lt_debug.h" #include "lt_debug.h"
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args)
#define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args)
#ifdef MARTII
#include <stdio.h> #include <stdio.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
@@ -267,8 +263,6 @@ void stop_inmux_thread(void)
inmux_thread_running = 0; inmux_thread_running = 0;
} }
#endif
static bool initialized = false; static bool initialized = false;
void init_td_api() void init_td_api()
@@ -280,17 +274,9 @@ void init_td_api()
{ {
cCpuFreqManager f; cCpuFreqManager f;
f.SetCpuFreq(0); /* CPUFREQ == 0 is the trigger for leaving standby */ f.SetCpuFreq(0); /* CPUFREQ == 0 is the trigger for leaving standby */
#ifdef MARTII
count_input_devices(); count_input_devices();
create_input_devices(); create_input_devices();
start_inmux_thread(); start_inmux_thread();
#else
/* hack: if lircd pidfile is present, don't start input thread */
if (access("/var/run/lirc/lircd.pid", R_OK))
start_input_thread();
else
lt_info("%s: lircd pidfile present, not starting input thread\n", __func__);
#endif
/* this is a strange hack: the drivers seem to only work correctly after /* this is a strange hack: the drivers seem to only work correctly after
* demux0 has been used once. After that, we can use demux1,2,... */ * demux0 has been used once. After that, we can use demux1,2,... */
@@ -309,11 +295,8 @@ void init_td_api()
ioctl(dmx, DMX_STOP); ioctl(dmx, DMX_STOP);
close(dmx); close(dmx);
} }
} } else
#ifdef MARTII
else
reopen_input_devices(); reopen_input_devices();
#endif
initialized = true; initialized = true;
lt_info("%s end\n", __FUNCTION__); lt_info("%s end\n", __FUNCTION__);
} }
@@ -321,14 +304,9 @@ void init_td_api()
void shutdown_td_api() void shutdown_td_api()
{ {
lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized);
#ifdef MARTII
if (initialized) { if (initialized) {
stop_inmux_thread(); stop_inmux_thread();
close_input_devices(); close_input_devices();
} }
#else
if (initialized)
stop_input_thread();
#endif
initialized = false; initialized = false;
} }

View File

@@ -38,9 +38,7 @@
#include <inttypes.h> #include <inttypes.h>
#include <errno.h> #include <errno.h>
#ifdef MARTII
#include <aotom_main.h> #include <aotom_main.h>
#endif
#include "lirmp_input.h" #include "lirmp_input.h"
extern "C" { extern "C" {
@@ -196,19 +194,13 @@ static void *input_thread(void *)
uint32_t lircdata; /* lirc_t to be correct... */ uint32_t lircdata; /* lirc_t to be correct... */
unsigned int count = 0; /* how many timeouts? */ unsigned int count = 0; /* how many timeouts? */
unsigned int nodec = 0; /* how many timeouts since last decoded? */ unsigned int nodec = 0; /* how many timeouts since last decoded? */
#ifdef MARTII
int aotom_fd = -1; int aotom_fd = -1;
#endif
IRMP_DATA d; IRMP_DATA d;
lt_info("LIRC/IRMP input converter thread starting...\n"); lt_info("LIRC/IRMP input converter thread starting...\n");
/* modprobe does not complain if the module is already loaded... */ /* modprobe does not complain if the module is already loaded... */
#ifdef MARTII
system("/sbin/insmod /lib/modules/uinput.ko");
#else
system("/sbin/modprobe uinput"); system("/sbin/modprobe uinput");
#endif
do { do {
usleep(100000); /* mdev needs some time to create the device? */ usleep(100000); /* mdev needs some time to create the device? */
uinput = open("/dev/uinput", O_WRONLY|O_NDELAY); uinput = open("/dev/uinput", O_WRONLY|O_NDELAY);
@@ -309,9 +301,7 @@ static void *input_thread(void *)
#define LIRC_PULSE_MASK 0x00FFFFFF #define LIRC_PULSE_MASK 0x00FFFFFF
lt_info("LIRC/IRMP input converter going into main loop...\n"); lt_info("LIRC/IRMP input converter going into main loop...\n");
#ifdef MARTII
aotom_fd = open("/dev/vfd", O_RDONLY); aotom_fd = open("/dev/vfd", O_RDONLY);
#endif
/* TODO: ioctl to find out if we have a compatible LIRC_MODE2 device */ /* TODO: ioctl to find out if we have a compatible LIRC_MODE2 device */
thread_running = 1; thread_running = 1;
@@ -407,14 +397,12 @@ static void *input_thread(void *)
//lt_debug("uinput write: value: %d code: %d\n", u.value, u.code); //lt_debug("uinput write: value: %d code: %d\n", u.value, u.code);
last_code = u.code; last_code = u.code;
write(uinput, &u, sizeof(u)); write(uinput, &u, sizeof(u));
#ifdef MARTII
if (aotom_fd > -1) { if (aotom_fd > -1) {
struct aotom_ioctl_data vfd_data; struct aotom_ioctl_data vfd_data;
vfd_data.u.led.led_nr = 1; vfd_data.u.led.led_nr = 1;
vfd_data.u.led.on = 10; vfd_data.u.led.on = 10;
ioctl(aotom_fd, VFDSETLED, &vfd_data); ioctl(aotom_fd, VFDSETLED, &vfd_data);
} }
#endif
break; break;
} }
} }
@@ -425,10 +413,8 @@ static void *input_thread(void *)
/* clean up */ /* clean up */
close (lircfd); close (lircfd);
#ifdef MARTII
if (aotom_fd > -1) if (aotom_fd > -1)
close(aotom_fd); close(aotom_fd);
#endif
out: out:
ioctl(uinput, UI_DEV_DESTROY); ioctl(uinput, UI_DEV_DESTROY);

View File

@@ -13,9 +13,7 @@ extern ContainerHandler_t ContainerHandler;
extern ManagerHandler_t ManagerHandler; extern ManagerHandler_t ManagerHandler;
#include "playback_libeplayer3.h" #include "playback_libeplayer3.h"
#ifdef MARTII
#include "subtitle.h" #include "subtitle.h"
#endif
static Context_t *player; static Context_t *player;
@@ -61,11 +59,7 @@ bool cPlayback::Open(playmode_t PlayMode)
player->container = &ContainerHandler; player->container = &ContainerHandler;
player->manager = &ManagerHandler; player->manager = &ManagerHandler;
#ifdef MARTII
fprintf(stderr, "player output name: %s\n", player->output->Name); fprintf(stderr, "player output name: %s\n", player->output->Name);
#else
printf("%s\n", player->output->Name);
#endif
} }
//Registration of output devices //Registration of output devices
@@ -73,7 +67,6 @@ bool cPlayback::Open(playmode_t PlayMode)
player->output->Command(player,OUTPUT_ADD, (void*)"audio"); player->output->Command(player,OUTPUT_ADD, (void*)"audio");
player->output->Command(player,OUTPUT_ADD, (void*)"video"); player->output->Command(player,OUTPUT_ADD, (void*)"video");
player->output->Command(player,OUTPUT_ADD, (void*)"subtitle"); player->output->Command(player,OUTPUT_ADD, (void*)"subtitle");
#ifdef MARTII
player->output->Command(player,OUTPUT_ADD, (void*)"dvbsubtitle"); player->output->Command(player,OUTPUT_ADD, (void*)"dvbsubtitle");
player->output->Command(player,OUTPUT_ADD, (void*)"teletext"); player->output->Command(player,OUTPUT_ADD, (void*)"teletext");
@@ -84,7 +77,6 @@ bool cPlayback::Open(playmode_t PlayMode)
so.shareFramebuffer = 1; so.shareFramebuffer = 1;
player->output->subtitle->Command(player, OUTPUT_SET_SUBTITLE_OUTPUT, (void*)&so); player->output->subtitle->Command(player, OUTPUT_SET_SUBTITLE_OUTPUT, (void*)&so);
} }
#endif
} }
return 0; return 0;
@@ -106,11 +98,7 @@ void cPlayback::Close(void)
} }
//Used by Fileplay //Used by Fileplay
#ifdef MARTII
bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, int ac3, unsigned int, bool no_probe) bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, int ac3, unsigned int, bool no_probe)
#else
bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, int ac3, unsigned int)
#endif
{ {
bool ret = false; bool ret = false;
bool isHTTP = false; bool isHTTP = false;
@@ -121,22 +109,17 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
init_jump = -1; init_jump = -1;
//create playback path //create playback path
mAudioStream=0; mAudioStream=0;
#ifdef MARTII
mSubtitleStream=-1; mSubtitleStream=-1;
mDvbsubtitleStream=-1; mDvbsubtitleStream=-1;
mTeletextStream=-1; mTeletextStream=-1;
char *file = (char *) alloca(strlen(filename) + 1); char *file = (char *) alloca(strlen(filename) + 1);
*file = 0; *file = 0;
#else
char file[400] = {""};
#endif
if(!strncmp("http://", filename, 7)) if(!strncmp("http://", filename, 7))
{ {
printf("http://\n"); printf("http://\n");
isHTTP = true; isHTTP = true;
} }
#ifdef MARTII
else if(!strncmp("rtmp://", filename, 7)) else if(!strncmp("rtmp://", filename, 7))
{ {
printf("rtmp://\n"); printf("rtmp://\n");
@@ -147,7 +130,6 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
printf("mss://\n"); printf("mss://\n");
isHTTP = true; isHTTP = true;
} }
#endif
else if(!strncmp("file://", filename, 7)) else if(!strncmp("file://", filename, 7))
{ {
printf("file://\n"); printf("file://\n");
@@ -157,11 +139,7 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
printf("upnp://\n"); printf("upnp://\n");
isHTTP = true; isHTTP = true;
} }
#ifdef MARTII
else if (pm == PLAYMODE_TS && no_probe) else if (pm == PLAYMODE_TS && no_probe)
#else
else if (pm == PLAYMODE_TS)
#endif
strcat(file, "myts://"); strcat(file, "myts://");
else else
strcat(file, "file://"); strcat(file, "file://");
@@ -201,7 +179,6 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
free(TrackList); free(TrackList);
} }
} }
#ifdef MARTII
//DVBSUB //DVBSUB
if(player && player->manager && player->manager->dvbsubtitle) { if(player && player->manager && player->manager->dvbsubtitle) {
char ** TrackList = NULL; char ** TrackList = NULL;
@@ -233,7 +210,6 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
free(TrackList); free(TrackList);
} }
} }
#endif
if (pm != PLAYMODE_TS && player && player->output && player->playback) { if (pm != PLAYMODE_TS && player && player->output && player->playback) {
player->output->Command(player, OUTPUT_OPEN, NULL); player->output->Command(player, OUTPUT_OPEN, NULL);
@@ -302,10 +278,8 @@ bool cPlayback::Stop(void)
player->output->Command(player,OUTPUT_DEL, (void*)"audio"); player->output->Command(player,OUTPUT_DEL, (void*)"audio");
player->output->Command(player,OUTPUT_DEL, (void*)"video"); player->output->Command(player,OUTPUT_DEL, (void*)"video");
player->output->Command(player,OUTPUT_DEL, (void*)"subtitle"); player->output->Command(player,OUTPUT_DEL, (void*)"subtitle");
#ifdef MARTII
player->output->Command(player,OUTPUT_DEL, (void*)"dvbsubtitle"); player->output->Command(player,OUTPUT_DEL, (void*)"dvbsubtitle");
player->output->Command(player,OUTPUT_DEL, (void*)"teletext"); player->output->Command(player,OUTPUT_DEL, (void*)"teletext");
#endif
} }
if(player && player->playback) if(player && player->playback)
@@ -319,11 +293,7 @@ bool cPlayback::Stop(void)
return true; return true;
} }
#ifdef MARTII
bool cPlayback::SetAPid(unsigned short pid, bool ac3 __attribute__((unused))) bool cPlayback::SetAPid(unsigned short pid, bool ac3 __attribute__((unused)))
#else
bool cPlayback::SetAPid(unsigned short pid, bool ac3)
#endif
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
int i=pid; int i=pid;
@@ -334,7 +304,7 @@ bool cPlayback::SetAPid(unsigned short pid, bool ac3)
} }
return true; return true;
} }
#ifdef MARTII
bool cPlayback::SetSubtitlePid(unsigned short pid) bool cPlayback::SetSubtitlePid(unsigned short pid)
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
@@ -346,6 +316,7 @@ bool cPlayback::SetSubtitlePid(unsigned short pid)
} }
return true; return true;
} }
bool cPlayback::SetDvbsubtitlePid(unsigned short pid) bool cPlayback::SetDvbsubtitlePid(unsigned short pid)
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
@@ -357,6 +328,7 @@ bool cPlayback::SetDvbsubtitlePid(unsigned short pid)
} }
return true; return true;
} }
bool cPlayback::SetTeletextPid(unsigned short pid) bool cPlayback::SetTeletextPid(unsigned short pid)
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
@@ -368,7 +340,6 @@ bool cPlayback::SetTeletextPid(unsigned short pid)
} }
return true; return true;
} }
#endif
bool cPlayback::SetSpeed(int speed) bool cPlayback::SetSpeed(int speed)
{ {
@@ -461,9 +432,6 @@ bool cPlayback::GetSpeed(int &speed) const
bool cPlayback::GetPosition(int &position, int &duration) bool cPlayback::GetPosition(int &position, int &duration)
{ {
bool got_duration = false; bool got_duration = false;
#ifndef MARTII
printf("%s:%s %d %d\n", FILENAME, __FUNCTION__, position, duration);
#endif
/* hack: if the file is growing (timeshift), then determine its length /* hack: if the file is growing (timeshift), then determine its length
* by comparing the mtime with the mtime of the xml file */ * by comparing the mtime with the mtime of the xml file */
@@ -492,13 +460,7 @@ bool cPlayback::GetPosition(int &position, int &duration)
if (player && player->playback && !player->playback->isPlaying) { if (player && player->playback && !player->playback->isPlaying) {
printf("cPlayback::%s !!!!EOF!!!! < -1\n", __func__); printf("cPlayback::%s !!!!EOF!!!! < -1\n", __func__);
position = duration + 1000; position = duration + 1000;
// duration = 0;
// this is stupid
#ifdef MARTII
return false; return false;
#else
return true;
#endif
} }
unsigned long long int vpts = 0; unsigned long long int vpts = 0;
@@ -545,21 +507,15 @@ bool cPlayback::SetPosition(int position, bool absolute)
} }
float pos = (position/1000.0); float pos = (position/1000.0);
if(player && player->playback) if(player && player->playback)
#ifdef MARTII
player->playback->Command(player, absolute ? PLAYBACK_SEEK_ABS : PLAYBACK_SEEK, (void*)&pos); player->playback->Command(player, absolute ? PLAYBACK_SEEK_ABS : PLAYBACK_SEEK, (void*)&pos);
#else
player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos);
#endif
return true; return true;
} }
void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language)
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
#ifdef MARTII
int max_numpida = *numpida; int max_numpida = *numpida;
*numpida = 0; *numpida = 0;
#endif
if(player && player->manager && player->manager->audio) { if(player && player->manager && player->manager->audio) {
char ** TrackList = NULL; char ** TrackList = NULL;
player->manager->audio->Command(player, MANAGER_LIST, &TrackList); player->manager->audio->Command(player, MANAGER_LIST, &TrackList);
@@ -568,9 +524,7 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
int i = 0,j=0; int i = 0,j=0;
for (i = 0,j=0; TrackList[i] != NULL; i+=2,j++) { for (i = 0,j=0; TrackList[i] != NULL; i+=2,j++) {
printf("\t%s - %s\n", TrackList[i], TrackList[i+1]); printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
#ifdef MARTII
if (j < max_numpida) { if (j < max_numpida) {
#endif
apids[j]=j; apids[j]=j;
// atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC // atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
if( !strncmp("A_MPEG/L3", TrackList[i+1], 9)) if( !strncmp("A_MPEG/L3", TrackList[i+1], 9))
@@ -589,14 +543,8 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
ac3flags[j] = 0; //todo ac3flags[j] = 0; //todo
else else
ac3flags[j] = 0; //todo ac3flags[j] = 0; //todo
#ifdef MARTII
language[j]=std::string(TrackList[i]); language[j]=std::string(TrackList[i]);
#else
language[j]=TrackList[i];
#endif
#ifdef MARTII
} }
#endif
free(TrackList[i]); free(TrackList[i]);
free(TrackList[i+1]); free(TrackList[i+1]);
} }
@@ -605,7 +553,7 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t
} }
} }
} }
#ifdef MARTII
void cPlayback::FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language) void cPlayback::FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language)
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
@@ -718,20 +666,12 @@ unsigned short cPlayback::GetTeletextPid(void)
printf("teletext pid id %d (0x%x)\n", pid, pid); printf("teletext pid id %d (0x%x)\n", pid, pid);
return (unsigned short)pid; return (unsigned short)pid;
} }
#endif
//
#ifdef MARTII
cPlayback::cPlayback(int num __attribute__((unused)), void (*fbcb)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *)) cPlayback::cPlayback(int num __attribute__((unused)), void (*fbcb)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *))
#else
cPlayback::cPlayback(int num)
#endif
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
playing=false; playing=false;
#ifdef MARTII
framebuffer_callback = fbcb; framebuffer_callback = fbcb;
#endif
} }
cPlayback::~cPlayback() cPlayback::~cPlayback()
@@ -739,7 +679,6 @@ cPlayback::~cPlayback()
printf("%s:%s\n", FILENAME, __FUNCTION__); printf("%s:%s\n", FILENAME, __FUNCTION__);
} }
#ifdef MARTII
void cPlayback::SuspendSubtitle(bool b) void cPlayback::SuspendSubtitle(bool b)
{ {
if (b) if (b)
@@ -752,7 +691,6 @@ void cPlayback::RequestAbort() {
if (player->playback) if (player->playback)
player->playback->abortRequested = 1; player->playback->abortRequested = 1;
} }
#endif
#if 0 #if 0
bool cPlayback::IsPlaying(void) const bool cPlayback::IsPlaying(void) const
{ {

View File

@@ -15,31 +15,20 @@ class cPlayback
bool playing; bool playing;
int nPlaybackSpeed; int nPlaybackSpeed;
int mAudioStream; int mAudioStream;
#ifdef MARTII
int mSubtitleStream; int mSubtitleStream;
int mDvbsubtitleStream; int mDvbsubtitleStream;
int mTeletextStream; int mTeletextStream;
void (*framebuffer_callback)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *); void (*framebuffer_callback)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *);
#endif
bool Stop(void); bool Stop(void);
public: public:
#ifdef MARTII
cPlayback(int num = 0, void (*fbcb)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *) = NULL); cPlayback(int num = 0, void (*fbcb)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *) = NULL);
#else
cPlayback(int num = 0);
#endif
~cPlayback(); ~cPlayback();
bool Open(playmode_t PlayMode); bool Open(playmode_t PlayMode);
void Close(void); void Close(void);
bool Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, bool Start(char *filename, unsigned short vpid, int vtype, unsigned short apid,
#ifdef MARTII
int ac3, unsigned int duration, bool no_probe = true); int ac3, unsigned int duration, bool no_probe = true);
#else
int ac3, unsigned int duration);
#endif
bool SetAPid(unsigned short pid, bool ac3); bool SetAPid(unsigned short pid, bool ac3);
#ifdef MARTII
bool SetSubtitlePid(unsigned short pid); bool SetSubtitlePid(unsigned short pid);
bool SetDvbsubtitlePid(unsigned short pid); bool SetDvbsubtitlePid(unsigned short pid);
bool SetTeletextPid(unsigned short pid); bool SetTeletextPid(unsigned short pid);
@@ -48,19 +37,16 @@ class cPlayback
unsigned short GetDvbsubtitlePid(void) { return mDvbsubtitleStream; } unsigned short GetDvbsubtitlePid(void) { return mDvbsubtitleStream; }
unsigned short GetTeletextPid(void); unsigned short GetTeletextPid(void);
void SuspendSubtitle(bool); void SuspendSubtitle(bool);
#endif
bool SetSpeed(int speed); bool SetSpeed(int speed);
bool GetSpeed(int &speed) const; bool GetSpeed(int &speed) const;
bool GetPosition(int &position, int &duration); bool GetPosition(int &position, int &duration);
bool SetPosition(int position, bool absolute = false); bool SetPosition(int position, bool absolute = false);
void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language);
#ifdef MARTII
void FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language);
void FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language);
void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage); void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage);
void RequestAbort(void); void RequestAbort(void);
#endif
#if 0 #if 0
// Functions that are not used by movieplayer.cpp: // Functions that are not used by movieplayer.cpp:
bool GetOffset(off64_t &offset); bool GetOffset(off64_t &offset);

View File

@@ -14,7 +14,7 @@ void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); }
void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); }
/* those function dummies return true or "harmless" values */ /* those function dummies return true or "harmless" values */
bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; }
#ifdef MARTII #if HAVE_SPARK_HARDWARE
unsigned long cCpuFreqManager::GetCpuFreq(void) { unsigned long cCpuFreqManager::GetCpuFreq(void) {
int freq = 0; int freq = 0;
if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) { if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) {
@@ -48,7 +48,7 @@ bool cPowerManager::SetStandby(bool Active, bool Passive)
bool cCpuFreqManager::SetCpuFreq(unsigned long f) bool cCpuFreqManager::SetCpuFreq(unsigned long f)
{ {
#ifdef MARTII #if HAVE_SPARK_HARDWARE
if (f) { if (f) {
FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w"); FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w");
if (pll0) { if (pll0) {

View File

@@ -3,9 +3,7 @@
#include <malloc.h> #include <malloc.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef MARTII
#include <sys/prctl.h> #include <sys/prctl.h>
#endif
#include <inttypes.h> #include <inttypes.h>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
@@ -25,11 +23,7 @@ void *execute_record_thread(void *c)
return NULL; return NULL;
} }
#ifdef MARTII
cRecord::cRecord(int num, int bs_dmx, int bs) cRecord::cRecord(int num, int bs_dmx, int bs)
#else
cRecord::cRecord(int num)
#endif
{ {
lt_info("%s %d\n", __func__, num); lt_info("%s %d\n", __func__, num);
dmx = NULL; dmx = NULL;
@@ -37,12 +31,10 @@ cRecord::cRecord(int num)
file_fd = -1; file_fd = -1;
exit_flag = RECORD_STOPPED; exit_flag = RECORD_STOPPED;
dmx_num = num; dmx_num = num;
#ifdef MARTII
bufsize = bs; bufsize = bs;
bufsize_dmx = bs_dmx; bufsize_dmx = bs_dmx;
failureCallback = NULL; failureCallback = NULL;
failureData = NULL; failureData = NULL;
#endif
} }
cRecord::~cRecord() cRecord::~cRecord()
@@ -75,11 +67,7 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump
if (!dmx) if (!dmx)
dmx = new cDemux(dmx_num); dmx = new cDemux(dmx_num);
#ifdef MARTII
dmx->Open(DMX_TP_CHANNEL, NULL, bufsize_dmx); dmx->Open(DMX_TP_CHANNEL, NULL, bufsize_dmx);
#else
dmx->Open(DMX_TP_CHANNEL, NULL, 512*1024);
#endif
dmx->pesFilter(vpid); dmx->pesFilter(vpid);
for (i = 0; i < numpids; i++) for (i = 0; i < numpids; i++)
@@ -189,36 +177,25 @@ bool cRecord::AddPid(unsigned short pid)
void cRecord::RecordThread() void cRecord::RecordThread()
{ {
lt_info("%s: begin\n", __func__); lt_info("%s: begin\n", __func__);
#ifdef MARTII
char threadname[17]; char threadname[17];
strncpy(threadname, "RecordThread", sizeof(threadname)); strncpy(threadname, "RecordThread", sizeof(threadname));
threadname[16] = 0; threadname[16] = 0;
prctl (PR_SET_NAME, (unsigned long)&threadname); prctl (PR_SET_NAME, (unsigned long)&threadname);
int readsize = bufsize/16; int readsize = bufsize/16;
#else
#define BUFSIZE (1 << 20) /* 1MB */
#define READSIZE (BUFSIZE / 16)
#endif
int buf_pos = 0; int buf_pos = 0;
int queued = 0; int queued = 0;
uint8_t *buf; uint8_t *buf;
struct aiocb a; struct aiocb a;
#ifdef MARTII
buf = (uint8_t *)malloc(bufsize); buf = (uint8_t *)malloc(bufsize);
#else
buf = (uint8_t *)malloc(BUFSIZE);
#endif
if (!buf) if (!buf)
{ {
exit_flag = RECORD_FAILED_MEMORY; exit_flag = RECORD_FAILED_MEMORY;
lt_info("%s: unable to allocate buffer! (out of memory)\n", __func__); lt_info("%s: unable to allocate buffer! (out of memory)\n", __func__);
#ifdef MARTII
if (failureCallback) if (failureCallback)
failureCallback(failureData); failureCallback(failureData);
lt_info("%s: end\n", __func__); lt_info("%s: end\n", __func__);
pthread_exit(NULL); pthread_exit(NULL);
#endif
} }
int val = fcntl(file_fd, F_GETFL); int val = fcntl(file_fd, F_GETFL);
@@ -230,20 +207,13 @@ void cRecord::RecordThread()
a.aio_sigevent.sigev_notify = SIGEV_NONE; a.aio_sigevent.sigev_notify = SIGEV_NONE;
dmx->Start(); dmx->Start();
#ifdef MARTII
int overflow_count = 0; int overflow_count = 0;
#endif
bool overflow = false; bool overflow = false;
int r = 0; int r = 0;
while (exit_flag == RECORD_RUNNING) while (exit_flag == RECORD_RUNNING)
{ {
#ifdef MARTII
if (buf_pos < bufsize) if (buf_pos < bufsize)
#else
if (buf_pos < BUFSIZE)
#endif
{ {
#ifdef MARTII
if (overflow_count) { if (overflow_count) {
lt_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count); lt_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count);
overflow_count = 0; overflow_count = 0;
@@ -254,14 +224,6 @@ void cRecord::RecordThread()
ssize_t s = dmx->Read(buf + buf_pos, toread, 50); ssize_t s = dmx->Read(buf + buf_pos, toread, 50);
lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__,
buf_pos, (int)s, bufsize - buf_pos); buf_pos, (int)s, bufsize - buf_pos);
#else
int toread = BUFSIZE - buf_pos;
if (toread > READSIZE)
toread = READSIZE;
ssize_t s = dmx->Read(buf + buf_pos, toread, 50);
lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__,
buf_pos, (int)s, BUFSIZE - buf_pos);
#endif
if (s < 0) if (s < 0)
{ {
if (errno != EAGAIN && (errno != EOVERFLOW || !overflow)) if (errno != EAGAIN && (errno != EOVERFLOW || !overflow))
@@ -270,9 +232,6 @@ void cRecord::RecordThread()
exit_flag = RECORD_FAILED_READ; exit_flag = RECORD_FAILED_READ;
break; break;
} }
#ifndef MARTII
lt_info("%s: %s\n", __func__, errno == EOVERFLOW ? "EOVERFLOW" : "EAGAIN");
#endif
} }
else else
{ {
@@ -282,52 +241,28 @@ void cRecord::RecordThread()
} }
else else
{ {
#ifdef MARTII
if (!overflow) if (!overflow)
overflow_count = 0; overflow_count = 0;
#endif
overflow = true; overflow = true;
#ifdef MARTII
if (!(overflow_count % 10)) if (!(overflow_count % 10))
lt_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count); lt_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count);
#else
lt_info("%s: buffer full! Overflow?\n", __func__);
#endif
} }
r = aio_error(&a); r = aio_error(&a);
if (r == EINPROGRESS) if (r == EINPROGRESS)
{ {
#ifdef MARTII
lt_debug("%s: aio in progress, free: %d\n", __func__, bufsize - buf_pos); lt_debug("%s: aio in progress, free: %d\n", __func__, bufsize - buf_pos);
#else
lt_debug("%s: aio in progress...\n", __func__);
if (overflow) /* rate-limit the message */
usleep(100000);
#endif
continue; continue;
} }
#ifdef MARTII
// not calling aio_return causes a memory leak --martii // not calling aio_return causes a memory leak --martii
r = aio_return(&a); r = aio_return(&a);
if (r < 0) if (r < 0)
#else
if (r)
#endif
{ {
exit_flag = RECORD_FAILED_FILE; exit_flag = RECORD_FAILED_FILE;
#ifdef MARTII
lt_debug("%s: aio_return = %d (%m)\n", __func__, r); lt_debug("%s: aio_return = %d (%m)\n", __func__, r);
#else
lt_info("%s: aio_error != EINPROGRESS: %d (%m)\n", __func__, r);
#endif
break; break;
} }
#ifdef MARTII
else else
lt_debug("%s: aio_return = %d, free: %d\n", __func__, r, bufsize - buf_pos); lt_debug("%s: aio_return = %d, free: %d\n", __func__, r, bufsize - buf_pos);
#else
lt_debug("%s: buf_pos %6d w %6d\n", __func__, buf_pos, (int)queued);
#endif
if (posix_fadvise(file_fd, 0, 0, POSIX_FADV_DONTNEED)) if (posix_fadvise(file_fd, 0, 0, POSIX_FADV_DONTNEED))
perror("posix_fadvise"); perror("posix_fadvise");
if (queued) if (queued)
@@ -356,19 +291,11 @@ void cRecord::RecordThread()
usleep(50000); usleep(50000);
continue; continue;
} }
#ifdef MARTII
r = aio_return(&a); r = aio_return(&a);
if (r < 0) if (r < 0)
#else
if (r)
#endif
{ {
exit_flag = RECORD_FAILED_FILE; exit_flag = RECORD_FAILED_FILE;
#ifdef MARTII
lt_info("%s: aio_result: %d (%m)\n", __func__, r); lt_info("%s: aio_result: %d (%m)\n", __func__, r);
#else
lt_info("%s: aio_error != EINPROGRESS: %d (%m)\n", __func__, r);
#endif
break; break;
} }
if (!queued) if (!queued)
@@ -396,22 +323,15 @@ void cRecord::RecordThread()
printf("[stream2file]: pthreads exit code: %i, dir: '%s', filename: '%s' myfilename: '%s'\n", exit_flag, s.dir, s.filename, myfilename); printf("[stream2file]: pthreads exit code: %i, dir: '%s', filename: '%s' myfilename: '%s'\n", exit_flag, s.dir, s.filename, myfilename);
#endif #endif
#ifdef MARTII
if ((exit_flag != RECORD_STOPPED) && failureCallback) if ((exit_flag != RECORD_STOPPED) && failureCallback)
failureCallback(failureData); failureCallback(failureData);
#endif
lt_info("%s: end\n", __func__); lt_info("%s: end\n", __func__);
pthread_exit(NULL); pthread_exit(NULL);
} }
int cRecord::GetStatus() int cRecord::GetStatus()
{ {
#ifdef MARTII
return (exit_flag == RECORD_STOPPED) ? REC_STATUS_STOPPED : REC_STATUS_OK; return (exit_flag == RECORD_STOPPED) ? REC_STATUS_STOPPED : REC_STATUS_OK;
#else
/* dummy for now */
return REC_STATUS_OK;
#endif
} }
void cRecord::ResetStatus() void cRecord::ResetStatus()

View File

@@ -7,9 +7,7 @@
#define REC_STATUS_OK 0 #define REC_STATUS_OK 0
#define REC_STATUS_SLOW 1 #define REC_STATUS_SLOW 1
#define REC_STATUS_OVERFLOW 2 #define REC_STATUS_OVERFLOW 2
#ifdef MARTII
#define REC_STATUS_STOPPED 4 #define REC_STATUS_STOPPED 4
#endif
typedef enum { typedef enum {
RECORD_RUNNING, RECORD_RUNNING,
@@ -30,19 +28,13 @@ class cRecord
bool record_thread_running; bool record_thread_running;
record_state_t exit_flag; record_state_t exit_flag;
int state; int state;
#ifdef MARTII
int bufsize; int bufsize;
int bufsize_dmx; int bufsize_dmx;
void (*failureCallback)(void *); void (*failureCallback)(void *);
void *failureData; void *failureData;
#endif
public: public:
#ifdef MARTII
cRecord(int num = 0, int bs_dmx = 100 * 188 * 1024, int bs = 100 * 188 * 1024); cRecord(int num = 0, int bs_dmx = 100 * 188 * 1024, int bs = 100 * 188 * 1024);
void setFailureCallback(void (*f)(void *), void *d) { failureCallback = f; failureData = d; } void setFailureCallback(void (*f)(void *), void *d) { failureCallback = f; failureData = d; }
#else
cRecord(int num = 0);
#endif
~cRecord(); ~cRecord();
bool Open(); bool Open();

View File

@@ -282,12 +282,10 @@ int cVideo::Stop(bool blank)
int cVideo::setBlank(int) int cVideo::setBlank(int)
{ {
#ifdef MARTII
fop(ioctl, VIDEO_PLAY); fop(ioctl, VIDEO_PLAY);
fop(ioctl, VIDEO_CONTINUE); fop(ioctl, VIDEO_CONTINUE);
video_still_picture sp = { NULL, 0 }; video_still_picture sp = { NULL, 0 };
fop(ioctl, VIDEO_STILLPICTURE, &sp); fop(ioctl, VIDEO_STILLPICTURE, &sp);
#endif
return Stop(1); return Stop(1);
} }
@@ -373,10 +371,6 @@ void cVideo::SetVideoMode(analog_mode_t mode)
void cVideo::ShowPicture(const char * fname) void cVideo::ShowPicture(const char * fname)
{ {
lt_debug("%s(%s)\n", __func__, fname); lt_debug("%s(%s)\n", __func__, fname);
#ifndef MARTII
static const unsigned char pes_header[] = { 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x80, 0x00, 0x00 };
static const unsigned char seq_end[] = { 0x00, 0x00, 0x01, 0xB7 };
#endif
char destname[512]; char destname[512];
char cmd[512]; char cmd[512];
char *p; char *p;
@@ -388,12 +382,10 @@ void cVideo::ShowPicture(const char * fname)
lt_info("%s: video_standby == true\n", __func__); lt_info("%s: video_standby == true\n", __func__);
return; return;
} }
#ifdef MARTII
const char *lastDot = strrchr(fname, '.'); const char *lastDot = strrchr(fname, '.');
if (lastDot && !strcasecmp(lastDot + 1, "m2v")) if (lastDot && !strcasecmp(lastDot + 1, "m2v"))
strncpy(destname, fname, sizeof(destname)); strncpy(destname, fname, sizeof(destname));
else { else {
#endif
strcpy(destname, "/var/cache"); strcpy(destname, "/var/cache");
if (stat(fname, &st2)) if (stat(fname, &st2))
{ {
@@ -422,17 +414,11 @@ void cVideo::ShowPicture(const char * fname)
system(cmd); /* TODO: use libavcodec to directly convert it */ system(cmd); /* TODO: use libavcodec to directly convert it */
utime(destname, &u); utime(destname, &u);
} }
#ifdef MARTII
} }
#endif
mfd = open(destname, O_RDONLY); mfd = open(destname, O_RDONLY);
if (mfd < 0) if (mfd < 0)
{ {
#ifdef MARTII
lt_info("%s cannot open %s: %m\n", __func__, destname); lt_info("%s cannot open %s: %m\n", __func__, destname);
#else
lt_info("%s cannot open %s: %m", __func__, destname);
#endif
goto out; goto out;
} }
fstat(mfd, &st); fstat(mfd, &st);
@@ -446,45 +432,17 @@ void cVideo::ShowPicture(const char * fname)
if (ioctl(fd, VIDEO_SET_FORMAT, VIDEO_FORMAT_16_9) < 0) if (ioctl(fd, VIDEO_SET_FORMAT, VIDEO_FORMAT_16_9) < 0)
lt_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__); lt_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__);
#ifdef MARTII
char *iframe = (char *)malloc(st.st_size); char *iframe = (char *)malloc(st.st_size);
#else
bool seq_end_avail = false;
size_t pos=0;
unsigned char *iframe = (unsigned char *)malloc((st.st_size < 8192) ? 8192 : st.st_size);
#endif
if (! iframe) if (! iframe)
{ {
lt_info("%s: malloc failed (%m)\n", __func__); lt_info("%s: malloc failed (%m)\n", __func__);
goto out; goto out;
} }
read(mfd, iframe, st.st_size); read(mfd, iframe, st.st_size);
#ifdef MARTII
fop(ioctl, VIDEO_PLAY); fop(ioctl, VIDEO_PLAY);
fop(ioctl, VIDEO_CONTINUE); fop(ioctl, VIDEO_CONTINUE);
video_still_picture sp = { iframe, st.st_size }; video_still_picture sp = { iframe, st.st_size };
fop(ioctl, VIDEO_STILLPICTURE, &sp); fop(ioctl, VIDEO_STILLPICTURE, &sp);
#else
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
ioctl(fd, VIDEO_PLAY);
ioctl(fd, VIDEO_CONTINUE);
ioctl(fd, VIDEO_CLEAR_BUFFER);
#ifdef MARTII
while ((pos + 4) <= st.st_size && !(seq_end_avail = (!iframe[pos] && !iframe[pos+1] && iframe[pos+2] == 1 && iframe[pos+3] == 0xB7)))
#else
while (pos <= (st.st_size-4) && !(seq_end_avail = (!iframe[pos] && !iframe[pos+1] && iframe[pos+2] == 1 && iframe[pos+3] == 0xB7)))
#endif
++pos;
if ((iframe[3] >> 4) != 0xE) // no pes header
write(fd, pes_header, sizeof(pes_header));
write(fd, iframe, st.st_size);
if (!seq_end_avail)
write(fd, seq_end, sizeof(seq_end));
memset(iframe, 0, 8192);
write(fd, iframe, 8192);
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
#endif
free(iframe); free(iframe);
} }
out: out:
@@ -573,11 +531,7 @@ void cVideo::VideoParamWatchdog(void)
#endif #endif
} }
#ifdef MARTII
void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h, int startx, int starty, int endx, int endy) void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h, int startx, int starty, int endx, int endy)
#else
void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h)
#endif
{ {
char buffer[64]; char buffer[64];
int _x, _y, _w, _h; int _x, _y, _w, _h;
@@ -595,7 +549,6 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h)
} }
else else
{ {
#ifdef MARTII
// need to do some additional adjustments because osd border is handled by blitter // need to do some additional adjustments because osd border is handled by blitter
x += startx; x += startx;
x *= endx - startx + 1; x *= endx - startx + 1;
@@ -603,17 +556,14 @@ void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h)
y *= endy - starty + 1; y *= endy - starty + 1;
w *= endx - startx + 1; w *= endx - startx + 1;
h *= endy - starty + 1; h *= endy - starty + 1;
#endif
_x = x * xres / osd_w; _x = x * xres / osd_w;
_w = w * xres / osd_w; _w = w * xres / osd_w;
_y = y * yres / osd_h; _y = y * yres / osd_h;
_h = h * yres / osd_h; _h = h * yres / osd_h;
#ifdef MARTII
_x /= 1280; _x /= 1280;
_y /= 720; _y /= 720;
_w /= 1280; _w /= 1280;
_h /= 720; _h /= 720;
#endif
} }
lt_debug("%s: x:%d y:%d w:%d h:%d xr:%d yr:%d\n", __func__, _x, _y, _w, _h, xres, yres); lt_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 %x %x", _x, _y, _w, _h); sprintf(buffer, "%x %x %x %x", _x, _y, _w, _h);
@@ -722,7 +672,7 @@ int64_t cVideo::GetPTS(void)
lt_info("%s: GET_PTS failed (%m)\n", __func__); lt_info("%s: GET_PTS failed (%m)\n", __func__);
return pts; return pts;
} }
#ifdef MARTII
void cVideo::SetControl(int control, int value) { void cVideo::SetControl(int control, int value) {
const char *p = NULL; const char *p = NULL;
switch (control) { switch (control) {
@@ -746,4 +696,3 @@ void cVideo::SetControl(int control, int value) {
proc_put(p, buf, len); proc_put(p, buf, len);
} }
} }
#endif

View File

@@ -177,13 +177,8 @@ class cVideo
void ShowPicture(const char * fname); void ShowPicture(const char * fname);
void StopPicture(); void StopPicture();
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
#ifdef MARTII
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719);
void SetControl(int, int); void SetControl(int, int);
#else
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600);
void SetControl(int, int) { return; };
#endif
void VideoParamWatchdog(void); void VideoParamWatchdog(void);
void setContrast(int val); void setContrast(int val);
void SetVideoMode(analog_mode_t mode); void SetVideoMode(analog_mode_t mode);

View File

@@ -72,13 +72,8 @@ int main(int argc, char **argv)
u.modtime = st2.st_mtime; u.modtime = st2.st_mtime;
printf("converting %s -> %s\n", fname, destname); printf("converting %s -> %s\n", fname, destname);
/* it does not exist or has a different date, so call ffmpeg... */ /* it does not exist or has a different date, so call ffmpeg... */
#ifdef MARTII
sprintf(cmd, "ffmpeg -y -f mjpeg -i '%s' -s %s '%s' </dev/null", sprintf(cmd, "ffmpeg -y -f mjpeg -i '%s' -s %s '%s' </dev/null",
fname, TARGETRES, destname); fname, TARGETRES, destname);
#else
sprintf(cmd, "ffmpeg -v 31 -y -f mjpeg -i '%s' -s %s '%s' </dev/null",
fname, TARGETRES, destname);
#endif
system(cmd); /* TODO: use libavcodec to directly convert it */ system(cmd); /* TODO: use libavcodec to directly convert it */
utime(destname, &u); utime(destname, &u);
} }

View File

@@ -41,16 +41,12 @@ void usage()
printf("\t-T: get FP display type (1 = VFD, 2 = LCD, 4 = LED, 8 = LBD)\n"); printf("\t-T: get FP display type (1 = VFD, 2 = LCD, 4 = LED, 8 = LBD)\n");
printf("\t-t: get current FP time\n"); printf("\t-t: get current FP time\n");
printf("\t-s <time>: set FP time (time = 0: use current time)\n"); printf("\t-s <time>: set FP time (time = 0: use current time)\n");
#ifdef MARTII
printf("\t-w <time>: set FP wakeup time (time = 1: no wakeup)\n"); printf("\t-w <time>: set FP wakeup time (time = 1: no wakeup)\n");
printf("\t-P: power down\n"); printf("\t-P: power down\n");
printf("\t-B <n>: show blue RC code (n = 0..4 or \"all\")\n"); printf("\t-B <n>: show blue RC code (n = 0..4 or \"all\")\n");
printf("\t-S <n>: show standby RC code (n = 0..4 or \"all\")\n"); printf("\t-S <n>: show standby RC code (n = 0..4 or \"all\")\n");
printf("\t-B <n>:<predata><code>: set blue RC code (n = 0..4)\n"); printf("\t-B <n>:<predata><code>: set blue RC code (n = 0..4)\n");
printf("\t-S <n>:<predata><code>: set standby RC code\n"); printf("\t-S <n>:<predata><code>: set standby RC code\n");
#else
printf("\t-w <time>: set FP wakeup time and power down (time = 1: no wakeup)\n");
#endif
printf("\t-l <n>: set LED <n> on\n"); printf("\t-l <n>: set LED <n> on\n");
printf("\t-L <n>: set LED <n> off\n"); printf("\t-L <n>: set LED <n> off\n");
printf("times are given in unix time (UTC, seconds since 1970-01-01 00:00:00)\n"); printf("times are given in unix time (UTC, seconds since 1970-01-01 00:00:00)\n");
@@ -147,11 +143,7 @@ int main(int argc, char **argv)
} }
ret = 0; ret = 0;
#ifdef MARTII
while ((c = getopt (argc, argv, "gs:tw:Tl:L:P:S:B:")) != -1) while ((c = getopt (argc, argv, "gs:tw:Tl:L:P:S:B:")) != -1)
#else
while ((c = getopt (argc, argv, "gs:tw:Tl:L:")) != -1)
#endif
{ {
switch (c) switch (c)
{ {
@@ -196,16 +188,6 @@ int main(int argc, char **argv)
if (ret < 0) if (ret < 0)
break; break;
diff = t - t2; diff = t - t2;
#ifndef MARTII
/* green LED off */
aotom.u.led.on = LOG_OFF;
aotom.u.led.led_nr = 1;
ioctl(fd, VFDSETLED, &aotom);
/* red LED on */
aotom.u.led.on = LOG_ON;
aotom.u.led.led_nr = 0;
ioctl(fd, VFDSETLED, &aotom);
#endif
if (t == 1) if (t == 1)
t = 0; /* t = 1 is magic for "no time" -> clear... */ t = 0; /* t = 1 is magic for "no time" -> clear... */
else else
@@ -230,19 +212,10 @@ int main(int argc, char **argv)
tmp = gmtime(&t); tmp = gmtime(&t);
fprintf(stderr, "wakeup time: %04d-%02d-%02d %02d:%02d:%02d\n", tmp->tm_year + 1900, fprintf(stderr, "wakeup time: %04d-%02d-%02d %02d:%02d:%02d\n", tmp->tm_year + 1900,
tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
#ifdef MARTII
ret = ioctl(fd, VFDSETPOWERONTIME, &t); ret = ioctl(fd, VFDSETPOWERONTIME, &t);
break; break;
case 'P': case 'P':
ret = ioctl(fd, VFDPOWEROFF); ret = ioctl(fd, VFDPOWEROFF);
#else
ret = ioctl(fd, VFDSTANDBY, &t);
/* driver always returns einval here...
if (ret < 0)
perror("ioctl VFDSTANDBY");
*/
sleep(2); /* not reached... */
#endif
break; break;
case 'l': /* LED on */ case 'l': /* LED on */
aotom.u.led.on = LOG_ON; aotom.u.led.on = LOG_ON;
@@ -264,7 +237,6 @@ int main(int argc, char **argv)
ret = val; ret = val;
} }
break; break;
#ifdef MARTII
// Reminder to myself, here's a semi-sane default for Pingulux boxes: // Reminder to myself, here's a semi-sane default for Pingulux boxes:
// spark_fp -S 0:9966da25 -S 1:11eeda25 -S 2:cc33ba45 -S 3:dd227887 -S 4:aa557887 -B 0:996640bf -B 1:11ee40bf -B 2:cc33b847 -B 3:dd2228d7 -B 4:aa5528d7 // spark_fp -S 0:9966da25 -S 1:11eeda25 -S 2:cc33ba45 -S 3:dd227887 -S 4:aa557887 -B 0:996640bf -B 1:11ee40bf -B 2:cc33b847 -B 3:dd2228d7 -B 4:aa5528d7
// Not sure whether these are the original settings. --martii // Not sure whether these are the original settings. --martii
@@ -311,7 +283,6 @@ int main(int argc, char **argv)
} }
} }
break; break;
#endif
default: default:
usage(); usage();
return 0; return 0;