diff --git a/generic-pc/glfb.cpp b/generic-pc/glfb.cpp index 57807a9..cf6b77b 100644 --- a/generic-pc/glfb.cpp +++ b/generic-pc/glfb.cpp @@ -151,12 +151,11 @@ void GLFramebuffer::initKeys() mKeyMap['7'] = KEY_7; mKeyMap['8'] = KEY_8; mKeyMap['9'] = KEY_9; -#ifdef MARTII + mKeyMap['r'] = KEY_RED; mKeyMap['g'] = KEY_GREEN; mKeyMap['y'] = KEY_YELLOW; mKeyMap['b'] = KEY_BLUE; -#endif } void GLFramebuffer::run() diff --git a/generic-pc/playback.cpp b/generic-pc/playback.cpp index 4ca49e5..e70d8d0 100644 --- a/generic-pc/playback.cpp +++ b/generic-pc/playback.cpp @@ -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*/) -#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", FILENAME, __func__, filename, vpid, vtype, apid, ac3, duration); @@ -30,14 +26,6 @@ bool cPlayback::SetAPid(unsigned short pid, bool /*ac3*/) 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) { 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__); *numpida = 0; } -#ifdef MARTII + void cPlayback::FindAllSubtitlePids(uint16_t * /*pids*/, uint16_t *numpids, std::string * /*language*/) { *numpids = 0; @@ -110,7 +98,6 @@ void cPlayback::RequestAbort() unsigned short cPlayback::GetTeletextPid(void) { } -#endif cPlayback::cPlayback(int /*num*/) { diff --git a/generic-pc/playback.h b/generic-pc/playback.h index 46c84a1..be5d1fc 100644 --- a/generic-pc/playback.h +++ b/generic-pc/playback.h @@ -13,27 +13,18 @@ class cPlayback { private: bool playing; -#ifdef MARTII int mAudioStream; int mSubtitleStream; int mDvbsubtitleStream; int mTeletextStream; void (*framebuffer_callback)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *); -#endif public: -#ifdef MARTII cPlayback(int num __attribute__((unused))= 0, void (* /*fbcb*/)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *) = NULL) { }; -#endif bool Open(playmode_t PlayMode); 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); -#else - bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration); -#endif bool Stop(void); bool SetAPid(unsigned short pid, bool ac3); -#ifdef MARTII bool SetSubtitlePid(unsigned short pid); bool SetDvbsubtitlePid(unsigned short pid); bool SetTeletextPid(unsigned short pid); @@ -42,23 +33,16 @@ class cPlayback unsigned short GetDvbsubtitlePid(void) { return mDvbsubtitleStream; } unsigned short GetTeletextPid(void); void SuspendSubtitle(bool); -#else - bool SetSPid(int pid); -#endif bool SetSpeed(int speed); bool GetSpeed(int &speed) const; bool GetPosition(int &position, int &duration); bool SetPosition(int position, bool absolute = false); 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 FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage); void RequestAbort(void); -#else - void FindAllSPids(int *spids, uint16_t *numpids, std::string *language); -#endif // cPlayback(int num = 0); ~cPlayback(); diff --git a/generic-pc/video.cpp b/generic-pc/video.cpp index d0f9ef3..03b9af7 100644 --- a/generic-pc/video.cpp +++ b/generic-pc/video.cpp @@ -326,11 +326,7 @@ int cVideo::getBlank(void) 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*/) -#else -void cVideo::Pig(int x, int y, int w, int h, int, int) -#endif { pig_x = x; pig_y = y; diff --git a/generic-pc/video_lib.h b/generic-pc/video_lib.h index ad4ea40..f766c59 100644 --- a/generic-pc/video_lib.h +++ b/generic-pc/video_lib.h @@ -181,11 +181,7 @@ class cVideo : public OpenThreads::Thread void ShowPicture(const char * fname); void StopPicture(); 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); -#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 setContrast(int val); void SetVideoMode(analog_mode_t mode); diff --git a/include/audio_td.h b/include/audio_td.h index 19b4831..8e41401 100644 --- a/include/audio_td.h +++ b/include/audio_td.h @@ -3,9 +3,7 @@ #include "../libtriple/audio_td.h" #elif HAVE_SPARK_HARDWARE #include "../libspark/audio_lib.h" -#ifdef MARTII #include "../libspark/audio_mixer.h" -#endif #elif HAVE_AZBOX_HARDWARE #include "../azbox/audio_lib.h" #elif HAVE_GENERIC_HARDWARE diff --git a/include/hardware_caps.h b/include/hardware_caps.h index 79e070f..641ed88 100644 --- a/include/hardware_caps.h +++ b/include/hardware_caps.h @@ -35,9 +35,7 @@ typedef struct hw_caps int display_yres; char boxvendor[64]; char boxname[64]; -#ifdef MARTII int boxtype; -#endif } hw_caps_t; hw_caps_t *get_hwcaps(void); diff --git a/libspark/audio.cpp b/libspark/audio.cpp index 482b62a..a754f55 100644 --- a/libspark/audio.cpp +++ b/libspark/audio.cpp @@ -37,9 +37,6 @@ cAudio::cAudio(void *, void *, void *) mixer_fd = -1; openDevice(); Muted = false; -#ifdef MARTII - percent = 100; -#endif } 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); volume = (left + right) / 2; -#ifdef MARTII - int v = map_volume((volume * percent)/100); -#else int v = map_volume(volume); -#endif if (clipfd != -1 && mixer_fd != -1) { int tmp = 0; /* 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); 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]; sprintf(str, "%d", v); @@ -153,24 +139,17 @@ int cAudio::Stop(void) return ioctl(fd, AUDIO_STOP); } -#ifdef MARTII bool cAudio::Pause(bool Pcm) { ioctl(fd, Pcm ? AUDIO_PAUSE : AUDIO_CONTINUE, 1); return true; } -#else -bool cAudio::Pause(bool /*Pcm*/) -{ - return true; -}; -#endif void cAudio::SetSyncMode(AVSYNC_TYPE Mode) { lt_debug("%s %d\n", __func__, Mode); ioctl(fd, AUDIO_SET_AV_SYNC, Mode); -}; +} //AUDIO_ENCODING_AC3 #define AUDIO_STREAMTYPE_AC3 0 @@ -184,9 +163,6 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) void cAudio::SetStreamType(AUDIO_FORMAT type) { int bypass = AUDIO_STREAMTYPE_MPEG; -#ifndef MARTII - bool update_volume = (StreamType != type); -#endif lt_debug("%s %d\n", __FUNCTION__, 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 if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) 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) { lt_debug("%s %d\n", __FUNCTION__, channel); return 0; -}; +} 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); return 0; -}; +} int cAudio::WriteClip(unsigned char *buffer, int size) { @@ -412,17 +384,17 @@ void cAudio::SetSpdifDD(bool enable) { lt_debug("%s %d\n", __func__, enable); setBypassMode(!enable); -}; +} void cAudio::ScheduleMute(bool On) { lt_debug("%s %d\n", __FUNCTION__, On); -}; +} void cAudio::EnableAnalogOut(bool enable) { lt_debug("%s %d\n", __FUNCTION__, enable); -}; +} #define AUDIO_BYPASS_ON 0 #define AUDIO_BYPASS_OFF 1 @@ -432,20 +404,3 @@ void cAudio::setBypassMode(bool disable) lt_debug("%s %d\n", __func__, 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 diff --git a/libspark/audio_lib.h b/libspark/audio_lib.h index 0703761..a8b5362 100644 --- a/libspark/audio_lib.h +++ b/libspark/audio_lib.h @@ -57,9 +57,6 @@ class cAudio int do_mute(bool enable, bool remember); void setBypassMode(bool disable); -#ifdef MARTII - int percent; -#endif public: /* construct & destruct */ cAudio(void *, void *, void *); @@ -94,10 +91,6 @@ class cAudio void SetSpdifDD(bool enable); void ScheduleMute(bool On); void EnableAnalogOut(bool enable); -#ifdef MARTII - int getPercent(void); - int setPercent(int perc); -#endif }; #endif diff --git a/libspark/dmx.cpp b/libspark/dmx.cpp index a5fd075..3d51a91 100644 --- a/libspark/dmx.cpp +++ b/libspark/dmx.cpp @@ -208,10 +208,8 @@ bool cDemux::_open(void) else init[devnum] = true; } -#ifdef MARTII if (buffersize == 0) buffersize = 0xffff; // may or may not be reasonable --martii -#endif if (buffersize > 0) { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ diff --git a/libspark/hardware_caps.c b/libspark/hardware_caps.c index 9c70bc3..1d2937b 100644 --- a/libspark/hardware_caps.c +++ b/libspark/hardware_caps.c @@ -30,9 +30,7 @@ hw_caps_t *get_hwcaps(void) memset(&caps, 0, sizeof(hw_caps_t)); initialized = 1; -#ifdef MARTII caps.can_cec = 1; -#endif caps.can_shutdown = 1; caps.display_type = HW_DISPLAY_LED_NUM; caps.has_HDMI = 1; @@ -139,12 +137,10 @@ hw_caps_t *get_hwcaps(void) default: tmp = p; } -#ifdef MARTII if ((sys_id & 0xff0000) == 0x090000) caps.boxtype = 7111; else caps.boxtype = 7162; -#endif } else tmp = "(NO STB_ID FOUND)"; strcpy(caps.boxname, tmp); diff --git a/libspark/init.cpp b/libspark/init.cpp index a07876f..f316eac 100644 --- a/libspark/init.cpp +++ b/libspark/init.cpp @@ -11,16 +11,12 @@ #include -#ifndef MARTII -#include "lirmp_input.h" -#endif #include "pwrmngr.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) -#ifdef MARTII #include #include #include @@ -267,8 +263,6 @@ void stop_inmux_thread(void) inmux_thread_running = 0; } -#endif - static bool initialized = false; void init_td_api() @@ -280,17 +274,9 @@ void init_td_api() { cCpuFreqManager f; f.SetCpuFreq(0); /* CPUFREQ == 0 is the trigger for leaving standby */ -#ifdef MARTII count_input_devices(); create_input_devices(); 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 * demux0 has been used once. After that, we can use demux1,2,... */ @@ -309,11 +295,8 @@ void init_td_api() ioctl(dmx, DMX_STOP); close(dmx); } - } -#ifdef MARTII - else + } else reopen_input_devices(); -#endif initialized = true; lt_info("%s end\n", __FUNCTION__); } @@ -321,14 +304,9 @@ void init_td_api() void shutdown_td_api() { lt_info("%s, initialized = %d\n", __FUNCTION__, (int)initialized); -#ifdef MARTII if (initialized) { stop_inmux_thread(); close_input_devices(); } -#else - if (initialized) - stop_input_thread(); -#endif initialized = false; } diff --git a/libspark/lirmp_input.cpp b/libspark/lirmp_input.cpp index 4f46953..73dcc06 100644 --- a/libspark/lirmp_input.cpp +++ b/libspark/lirmp_input.cpp @@ -38,9 +38,7 @@ #include #include -#ifdef MARTII #include -#endif #include "lirmp_input.h" extern "C" { @@ -196,19 +194,13 @@ static void *input_thread(void *) uint32_t lircdata; /* lirc_t to be correct... */ unsigned int count = 0; /* how many timeouts? */ unsigned int nodec = 0; /* how many timeouts since last decoded? */ -#ifdef MARTII int aotom_fd = -1; -#endif IRMP_DATA d; lt_info("LIRC/IRMP input converter thread starting...\n"); /* modprobe does not complain if the module is already loaded... */ -#ifdef MARTII - system("/sbin/insmod /lib/modules/uinput.ko"); -#else system("/sbin/modprobe uinput"); -#endif do { usleep(100000); /* mdev needs some time to create the device? */ uinput = open("/dev/uinput", O_WRONLY|O_NDELAY); @@ -309,9 +301,7 @@ static void *input_thread(void *) #define LIRC_PULSE_MASK 0x00FFFFFF lt_info("LIRC/IRMP input converter going into main loop...\n"); -#ifdef MARTII aotom_fd = open("/dev/vfd", O_RDONLY); -#endif /* TODO: ioctl to find out if we have a compatible LIRC_MODE2 device */ 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); last_code = u.code; write(uinput, &u, sizeof(u)); -#ifdef MARTII if (aotom_fd > -1) { struct aotom_ioctl_data vfd_data; vfd_data.u.led.led_nr = 1; vfd_data.u.led.on = 10; ioctl(aotom_fd, VFDSETLED, &vfd_data); } -#endif break; } } @@ -425,10 +413,8 @@ static void *input_thread(void *) /* clean up */ close (lircfd); -#ifdef MARTII if (aotom_fd > -1) close(aotom_fd); -#endif out: ioctl(uinput, UI_DEV_DESTROY); diff --git a/libspark/playback_libeplayer3.cpp b/libspark/playback_libeplayer3.cpp index d8eeaa3..57f2d43 100644 --- a/libspark/playback_libeplayer3.cpp +++ b/libspark/playback_libeplayer3.cpp @@ -13,9 +13,7 @@ extern ContainerHandler_t ContainerHandler; extern ManagerHandler_t ManagerHandler; #include "playback_libeplayer3.h" -#ifdef MARTII #include "subtitle.h" -#endif static Context_t *player; @@ -61,11 +59,7 @@ bool cPlayback::Open(playmode_t PlayMode) player->container = &ContainerHandler; player->manager = &ManagerHandler; -#ifdef MARTII fprintf(stderr, "player output name: %s\n", player->output->Name); -#else - printf("%s\n", player->output->Name); -#endif } //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*)"video"); 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*)"teletext"); @@ -84,7 +77,6 @@ bool cPlayback::Open(playmode_t PlayMode) so.shareFramebuffer = 1; player->output->subtitle->Command(player, OUTPUT_SET_SUBTITLE_OUTPUT, (void*)&so); } -#endif } return 0; @@ -106,11 +98,7 @@ void cPlayback::Close(void) } //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) -#else -bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, int ac3, unsigned int) -#endif { bool ret = false; bool isHTTP = false; @@ -121,22 +109,17 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s init_jump = -1; //create playback path mAudioStream=0; -#ifdef MARTII mSubtitleStream=-1; mDvbsubtitleStream=-1; mTeletextStream=-1; char *file = (char *) alloca(strlen(filename) + 1); *file = 0; -#else - char file[400] = {""}; -#endif if(!strncmp("http://", filename, 7)) { printf("http://\n"); isHTTP = true; } -#ifdef MARTII else if(!strncmp("rtmp://", filename, 7)) { printf("rtmp://\n"); @@ -147,7 +130,6 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s printf("mss://\n"); isHTTP = true; } -#endif else if(!strncmp("file://", filename, 7)) { printf("file://\n"); @@ -157,11 +139,7 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s printf("upnp://\n"); isHTTP = true; } -#ifdef MARTII else if (pm == PLAYMODE_TS && no_probe) -#else - else if (pm == PLAYMODE_TS) -#endif strcat(file, "myts://"); else strcat(file, "file://"); @@ -201,7 +179,6 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s free(TrackList); } } -#ifdef MARTII //DVBSUB if(player && player->manager && player->manager->dvbsubtitle) { char ** TrackList = NULL; @@ -233,7 +210,6 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s free(TrackList); } } -#endif if (pm != PLAYMODE_TS && player && player->output && player->playback) { 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*)"video"); 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*)"teletext"); -#endif } if(player && player->playback) @@ -319,11 +293,7 @@ bool cPlayback::Stop(void) return true; } -#ifdef MARTII 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__); int i=pid; @@ -334,7 +304,7 @@ bool cPlayback::SetAPid(unsigned short pid, bool ac3) } return true; } -#ifdef MARTII + bool cPlayback::SetSubtitlePid(unsigned short pid) { printf("%s:%s\n", FILENAME, __FUNCTION__); @@ -346,6 +316,7 @@ bool cPlayback::SetSubtitlePid(unsigned short pid) } return true; } + bool cPlayback::SetDvbsubtitlePid(unsigned short pid) { printf("%s:%s\n", FILENAME, __FUNCTION__); @@ -357,6 +328,7 @@ bool cPlayback::SetDvbsubtitlePid(unsigned short pid) } return true; } + bool cPlayback::SetTeletextPid(unsigned short pid) { printf("%s:%s\n", FILENAME, __FUNCTION__); @@ -368,7 +340,6 @@ bool cPlayback::SetTeletextPid(unsigned short pid) } return true; } -#endif bool cPlayback::SetSpeed(int speed) { @@ -461,9 +432,6 @@ bool cPlayback::GetSpeed(int &speed) const bool cPlayback::GetPosition(int &position, int &duration) { 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 * 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) { printf("cPlayback::%s !!!!EOF!!!! < -1\n", __func__); position = duration + 1000; - // duration = 0; - // this is stupid -#ifdef MARTII return false; -#else - return true; -#endif } unsigned long long int vpts = 0; @@ -545,21 +507,15 @@ bool cPlayback::SetPosition(int position, bool absolute) } float pos = (position/1000.0); if(player && player->playback) -#ifdef MARTII player->playback->Command(player, absolute ? PLAYBACK_SEEK_ABS : PLAYBACK_SEEK, (void*)&pos); -#else - player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos); -#endif return true; } void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) { printf("%s:%s\n", FILENAME, __FUNCTION__); -#ifdef MARTII int max_numpida = *numpida; *numpida = 0; -#endif if(player && player->manager && player->manager->audio) { char ** TrackList = NULL; 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; for (i = 0,j=0; TrackList[i] != NULL; i+=2,j++) { printf("\t%s - %s\n", TrackList[i], TrackList[i+1]); -#ifdef MARTII if (j < max_numpida) { -#endif apids[j]=j; // atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC 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 else ac3flags[j] = 0; //todo -#ifdef MARTII language[j]=std::string(TrackList[i]); -#else - language[j]=TrackList[i]; -#endif -#ifdef MARTII } -#endif free(TrackList[i]); 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) { 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); return (unsigned short)pid; } -#endif -// -#ifdef MARTII 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__); playing=false; -#ifdef MARTII framebuffer_callback = fbcb; -#endif } cPlayback::~cPlayback() @@ -739,7 +679,6 @@ cPlayback::~cPlayback() printf("%s:%s\n", FILENAME, __FUNCTION__); } -#ifdef MARTII void cPlayback::SuspendSubtitle(bool b) { if (b) @@ -752,7 +691,6 @@ void cPlayback::RequestAbort() { if (player->playback) player->playback->abortRequested = 1; } -#endif #if 0 bool cPlayback::IsPlaying(void) const { diff --git a/libspark/playback_libeplayer3.h b/libspark/playback_libeplayer3.h index b2ef1bb..a13c446 100644 --- a/libspark/playback_libeplayer3.h +++ b/libspark/playback_libeplayer3.h @@ -15,31 +15,20 @@ class cPlayback bool playing; int nPlaybackSpeed; int mAudioStream; -#ifdef MARTII int mSubtitleStream; int mDvbsubtitleStream; int mTeletextStream; void (*framebuffer_callback)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *); -#endif bool Stop(void); public: -#ifdef MARTII cPlayback(int num = 0, void (*fbcb)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *) = NULL); -#else - cPlayback(int num = 0); -#endif ~cPlayback(); bool Open(playmode_t PlayMode); void Close(void); bool Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, -#ifdef MARTII int ac3, unsigned int duration, bool no_probe = true); -#else - int ac3, unsigned int duration); -#endif bool SetAPid(unsigned short pid, bool ac3); -#ifdef MARTII bool SetSubtitlePid(unsigned short pid); bool SetDvbsubtitlePid(unsigned short pid); bool SetTeletextPid(unsigned short pid); @@ -48,19 +37,16 @@ class cPlayback unsigned short GetDvbsubtitlePid(void) { return mDvbsubtitleStream; } unsigned short GetTeletextPid(void); void SuspendSubtitle(bool); -#endif bool SetSpeed(int speed); bool GetSpeed(int &speed) const; bool GetPosition(int &position, int &duration); bool SetPosition(int position, bool absolute = false); 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 FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage); void RequestAbort(void); -#endif #if 0 // Functions that are not used by movieplayer.cpp: bool GetOffset(off64_t &offset); diff --git a/libspark/pwrmngr.cpp b/libspark/pwrmngr.cpp index e67ad34..d51074b 100644 --- a/libspark/pwrmngr.cpp +++ b/libspark/pwrmngr.cpp @@ -14,7 +14,7 @@ void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); } void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } /* those function dummies return true or "harmless" values */ bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } -#ifdef MARTII +#if HAVE_SPARK_HARDWARE unsigned long cCpuFreqManager::GetCpuFreq(void) { int freq = 0; 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) { -#ifdef MARTII +#if HAVE_SPARK_HARDWARE if (f) { FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w"); if (pll0) { diff --git a/libspark/record.cpp b/libspark/record.cpp index 54b5855..ad8a5cf 100644 --- a/libspark/record.cpp +++ b/libspark/record.cpp @@ -3,9 +3,7 @@ #include #include #include -#ifdef MARTII #include -#endif #include #include #include @@ -25,11 +23,7 @@ void *execute_record_thread(void *c) return NULL; } -#ifdef MARTII cRecord::cRecord(int num, int bs_dmx, int bs) -#else -cRecord::cRecord(int num) -#endif { lt_info("%s %d\n", __func__, num); dmx = NULL; @@ -37,12 +31,10 @@ cRecord::cRecord(int num) file_fd = -1; exit_flag = RECORD_STOPPED; dmx_num = num; -#ifdef MARTII bufsize = bs; bufsize_dmx = bs_dmx; failureCallback = NULL; failureData = NULL; -#endif } cRecord::~cRecord() @@ -75,11 +67,7 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump if (!dmx) dmx = new cDemux(dmx_num); -#ifdef MARTII dmx->Open(DMX_TP_CHANNEL, NULL, bufsize_dmx); -#else - dmx->Open(DMX_TP_CHANNEL, NULL, 512*1024); -#endif dmx->pesFilter(vpid); for (i = 0; i < numpids; i++) @@ -189,36 +177,25 @@ bool cRecord::AddPid(unsigned short pid) void cRecord::RecordThread() { lt_info("%s: begin\n", __func__); -#ifdef MARTII char threadname[17]; strncpy(threadname, "RecordThread", sizeof(threadname)); threadname[16] = 0; prctl (PR_SET_NAME, (unsigned long)&threadname); int readsize = bufsize/16; -#else -#define BUFSIZE (1 << 20) /* 1MB */ -#define READSIZE (BUFSIZE / 16) -#endif int buf_pos = 0; int queued = 0; uint8_t *buf; struct aiocb a; -#ifdef MARTII buf = (uint8_t *)malloc(bufsize); -#else - buf = (uint8_t *)malloc(BUFSIZE); -#endif if (!buf) { exit_flag = RECORD_FAILED_MEMORY; lt_info("%s: unable to allocate buffer! (out of memory)\n", __func__); -#ifdef MARTII if (failureCallback) failureCallback(failureData); lt_info("%s: end\n", __func__); pthread_exit(NULL); -#endif } int val = fcntl(file_fd, F_GETFL); @@ -230,20 +207,13 @@ void cRecord::RecordThread() a.aio_sigevent.sigev_notify = SIGEV_NONE; dmx->Start(); -#ifdef MARTII int overflow_count = 0; -#endif bool overflow = false; int r = 0; while (exit_flag == RECORD_RUNNING) { -#ifdef MARTII if (buf_pos < bufsize) -#else - if (buf_pos < BUFSIZE) -#endif { -#ifdef MARTII if (overflow_count) { lt_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count); overflow_count = 0; @@ -254,14 +224,6 @@ void cRecord::RecordThread() 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); -#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 (errno != EAGAIN && (errno != EOVERFLOW || !overflow)) @@ -270,9 +232,6 @@ void cRecord::RecordThread() exit_flag = RECORD_FAILED_READ; break; } -#ifndef MARTII - lt_info("%s: %s\n", __func__, errno == EOVERFLOW ? "EOVERFLOW" : "EAGAIN"); -#endif } else { @@ -282,52 +241,28 @@ void cRecord::RecordThread() } else { -#ifdef MARTII if (!overflow) overflow_count = 0; -#endif overflow = true; -#ifdef MARTII if (!(overflow_count % 10)) 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); if (r == EINPROGRESS) { -#ifdef MARTII 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; } -#ifdef MARTII // not calling aio_return causes a memory leak --martii r = aio_return(&a); if (r < 0) -#else - if (r) -#endif { exit_flag = RECORD_FAILED_FILE; -#ifdef MARTII lt_debug("%s: aio_return = %d (%m)\n", __func__, r); -#else - lt_info("%s: aio_error != EINPROGRESS: %d (%m)\n", __func__, r); -#endif break; } -#ifdef MARTII else 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)) perror("posix_fadvise"); if (queued) @@ -356,19 +291,11 @@ void cRecord::RecordThread() usleep(50000); continue; } -#ifdef MARTII r = aio_return(&a); if (r < 0) -#else - if (r) -#endif { exit_flag = RECORD_FAILED_FILE; -#ifdef MARTII lt_info("%s: aio_result: %d (%m)\n", __func__, r); -#else - lt_info("%s: aio_error != EINPROGRESS: %d (%m)\n", __func__, r); -#endif break; } 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); #endif -#ifdef MARTII if ((exit_flag != RECORD_STOPPED) && failureCallback) failureCallback(failureData); -#endif lt_info("%s: end\n", __func__); pthread_exit(NULL); } int cRecord::GetStatus() { -#ifdef MARTII return (exit_flag == RECORD_STOPPED) ? REC_STATUS_STOPPED : REC_STATUS_OK; -#else - /* dummy for now */ - return REC_STATUS_OK; -#endif } void cRecord::ResetStatus() diff --git a/libspark/record_lib.h b/libspark/record_lib.h index d0c8500..e7c5772 100644 --- a/libspark/record_lib.h +++ b/libspark/record_lib.h @@ -7,9 +7,7 @@ #define REC_STATUS_OK 0 #define REC_STATUS_SLOW 1 #define REC_STATUS_OVERFLOW 2 -#ifdef MARTII #define REC_STATUS_STOPPED 4 -#endif typedef enum { RECORD_RUNNING, @@ -30,19 +28,13 @@ class cRecord bool record_thread_running; record_state_t exit_flag; int state; -#ifdef MARTII int bufsize; int bufsize_dmx; void (*failureCallback)(void *); void *failureData; -#endif public: -#ifdef MARTII 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; } -#else - cRecord(int num = 0); -#endif ~cRecord(); bool Open(); diff --git a/libspark/video.cpp b/libspark/video.cpp index cbda5f9..e641e95 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -282,12 +282,10 @@ int cVideo::Stop(bool blank) int cVideo::setBlank(int) { -#ifdef MARTII fop(ioctl, VIDEO_PLAY); fop(ioctl, VIDEO_CONTINUE); video_still_picture sp = { NULL, 0 }; fop(ioctl, VIDEO_STILLPICTURE, &sp); -#endif return Stop(1); } @@ -373,10 +371,6 @@ void cVideo::SetVideoMode(analog_mode_t mode) void cVideo::ShowPicture(const char * 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 cmd[512]; char *p; @@ -388,12 +382,10 @@ void cVideo::ShowPicture(const char * fname) lt_info("%s: video_standby == true\n", __func__); return; } -#ifdef MARTII const char *lastDot = strrchr(fname, '.'); if (lastDot && !strcasecmp(lastDot + 1, "m2v")) strncpy(destname, fname, sizeof(destname)); else { -#endif strcpy(destname, "/var/cache"); if (stat(fname, &st2)) { @@ -422,17 +414,11 @@ void cVideo::ShowPicture(const char * fname) system(cmd); /* TODO: use libavcodec to directly convert it */ utime(destname, &u); } -#ifdef MARTII } -#endif mfd = open(destname, O_RDONLY); if (mfd < 0) { -#ifdef MARTII lt_info("%s cannot open %s: %m\n", __func__, destname); -#else - lt_info("%s cannot open %s: %m", __func__, destname); -#endif goto out; } fstat(mfd, &st); @@ -446,45 +432,17 @@ void cVideo::ShowPicture(const char * fname) if (ioctl(fd, VIDEO_SET_FORMAT, VIDEO_FORMAT_16_9) < 0) lt_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__); -#ifdef MARTII 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) { lt_info("%s: malloc failed (%m)\n", __func__); goto out; } read(mfd, iframe, st.st_size); -#ifdef MARTII fop(ioctl, VIDEO_PLAY); fop(ioctl, VIDEO_CONTINUE); video_still_picture sp = { iframe, st.st_size }; 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); } out: @@ -573,11 +531,7 @@ void cVideo::VideoParamWatchdog(void) #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) -#else -void cVideo::Pig(int x, int y, int w, int h, int osd_w, int osd_h) -#endif { char buffer[64]; 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 { -#ifdef MARTII // need to do some additional adjustments because osd border is handled by blitter x += startx; 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; w *= endx - startx + 1; h *= endy - starty + 1; -#endif _x = x * xres / osd_w; _w = w * xres / osd_w; _y = y * yres / osd_h; _h = h * yres / osd_h; -#ifdef MARTII _x /= 1280; _y /= 720; _w /= 1280; _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); 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__); return pts; } -#ifdef MARTII + void cVideo::SetControl(int control, int value) { const char *p = NULL; switch (control) { @@ -746,4 +696,3 @@ void cVideo::SetControl(int control, int value) { proc_put(p, buf, len); } } -#endif diff --git a/libspark/video_lib.h b/libspark/video_lib.h index caf8026..e73fcca 100644 --- a/libspark/video_lib.h +++ b/libspark/video_lib.h @@ -177,13 +177,8 @@ class cVideo void ShowPicture(const char * fname); void StopPicture(); 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 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 setContrast(int val); void SetVideoMode(analog_mode_t mode); diff --git a/tools/pic2m2v.c b/tools/pic2m2v.c index 49b8c82..11b98ea 100644 --- a/tools/pic2m2v.c +++ b/tools/pic2m2v.c @@ -72,13 +72,8 @@ int main(int argc, char **argv) u.modtime = st2.st_mtime; printf("converting %s -> %s\n", fname, destname); /* 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' : set FP time (time = 0: use current time)\n"); -#ifdef MARTII printf("\t-w