From 502d002c213bf4173e04c910cf4a26776fc8fb56 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 7 Nov 2021 00:57:01 +0100 Subject: [PATCH] libarmbox/libmipsbox: some manual code nicenings Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/6591fe32fc1b1673e8d7bd112d4517fce061a046 Author: vanhofen Date: 2021-11-07 (Sun, 07 Nov 2021) Origin message was: ------------------ - libarmbox/libmipsbox: some manual code nicenings ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/audio.cpp | 40 +++--- libarmbox/dmx.cpp | 44 +++---- libarmbox/hdmi_cec.cpp | 26 ++-- libarmbox/init.cpp | 2 +- libarmbox/playback_libeplayer3.cpp | 190 +++++++++++++++-------------- libarmbox/record.cpp | 6 +- libarmbox/video.cpp | 52 ++++---- libmipsbox/hardware_caps.c | 2 +- 8 files changed, 182 insertions(+), 180 deletions(-) diff --git a/libarmbox/audio.cpp b/libarmbox/audio.cpp index 3c5fe71..fecdd74 100644 --- a/libarmbox/audio.cpp +++ b/libarmbox/audio.cpp @@ -17,16 +17,16 @@ #define hal_debug(args...) _hal_debug(HAL_DEBUG_AUDIO, this, args) #define hal_info(args...) _hal_info(HAL_DEBUG_AUDIO, this, args) -#define fop(cmd, args...) ({ \ - int _r; \ - if (fd >= 0) { \ - if ((_r = ::cmd(fd, args)) < 0) \ +#define fop(cmd, args...) ({ \ + int _r; \ + if (fd >= 0) { \ + if ((_r = ::cmd(fd, args)) < 0) \ hal_info(#cmd"(fd, "#args")\n");\ - else \ + else \ hal_debug(#cmd"(fd, "#args")\n");\ - } \ - else { _r = fd; } \ - _r; \ + } \ + else { _r = fd; } \ + _r; \ }) #include @@ -287,14 +287,14 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) { if (dsp_dev) hal_info("%s: DSP_DEVICE is set (%s) but cannot be opened," - " fall back to /dev/dsp\n", __func__, dsp_dev); + " fall back to /dev/dsp\n", __func__, dsp_dev); dsp_dev = "/dev/dsp"; } if ((!mix_dev) || (access(mix_dev, W_OK))) { if (mix_dev) hal_info("%s: MIX_DEVICE is set (%s) but cannot be opened," - " fall back to /dev/mixer\n", __func__, dsp_dev); + " fall back to /dev/mixer\n", __func__, dsp_dev); mix_dev = "/dev/mixer"; } hal_info("cAudio::%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ @@ -346,7 +346,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) if (usable == 0) { hal_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", - __func__, devmask, stereo); + __func__, devmask, stereo); close(mixer_fd); mixer_fd = -1; return 0; /* TODO: should we treat this as error? */ @@ -356,13 +356,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) { /* TODO: this code is not yet tested as I have only single-mixer devices... */ hal_info("%s: more than one mixer control: devmask %08x stereo %08x\n" - "%s: querying MIX_NUMBER environment variable...\n", - __func__, devmask, stereo, __func__); + "%s: querying MIX_NUMBER environment variable...\n", + __func__, devmask, stereo, __func__); const char *tmp = getenv("MIX_NUMBER"); if (tmp) mixer_num = atoi(tmp); hal_info("%s: mixer_num is %d -> device %08x\n", - __func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0); + __func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0); /* no error checking, you'd better know what you are doing... */ } else @@ -457,13 +457,13 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m /* this does not work, some of the values are negative?? */ AMPEGStatus A; memcpy(&A, &i.word00, sizeof(i.word00)); - layer = A.audio_mpeg_layer; - mode = A.audio_mpeg_mode; + layer = A.audio_mpeg_layer; + mode = A.audio_mpeg_mode; bitrate = A.audio_mpeg_bitrate; switch (A.audio_mpeg_frequency) #endif /* layer and bitrate are not used anyway... */ - layer = 0; //(i.word00 >> 17) & 3; + layer = 0; //(i.word00 >> 17) & 3; bitrate = 0; //(i.word00 >> 12) & 3; switch (type) { @@ -490,7 +490,7 @@ void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int void cAudio::SetHdmiDD(bool enable) { - const char *opt[] = { "downmix", "passthrough" }; + const char *opt[] = { "downmix", "passthrough" }; hal_debug("%s %d\n", __func__, enable); proc_put("/proc/stb/audio/ac3", opt[enable], strlen(opt[enable])); } @@ -498,7 +498,7 @@ void cAudio::SetHdmiDD(bool enable) void cAudio::SetSpdifDD(bool enable) { //using this function for dts passthrough - const char *opt[] = { "downmix", "passthrough" }; + const char *opt[] = { "downmix", "passthrough" }; hal_debug("%s %d\n", __func__, enable); proc_put("/proc/stb/audio/dts", opt[enable], strlen(opt[enable])); } @@ -513,7 +513,7 @@ void cAudio::EnableAnalogOut(bool enable) hal_debug("%s %d\n", __FUNCTION__, enable); } -#define AUDIO_BYPASS_ON 0 +#define AUDIO_BYPASS_ON 0 #define AUDIO_BYPASS_OFF 1 void cAudio::setBypassMode(bool disable) { diff --git a/libarmbox/dmx.cpp b/libarmbox/dmx.cpp index 8f3bcab..c54338d 100644 --- a/libarmbox/dmx.cpp +++ b/libarmbox/dmx.cpp @@ -51,7 +51,7 @@ extern cVideo *videoDecoder; #define dmx_err(_errfmt, _errstr, _revents) do { \ hal_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ - __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ + __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); cDemux *videoDemux = NULL; @@ -185,7 +185,7 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ { /* we changed source -> close and reopen the fd */ hal_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", - __func__, num, fd, last_source, devnum); + __func__, num, fd, last_source, devnum); close(fd); } @@ -198,8 +198,8 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ hal_info_z("%s %s: %m\n", __FUNCTION__, devname(0, devnum)); return false; } - hal_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, - num, DMX_T[dmx_type], dmx_type, buffersize, fd); + hal_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", + __func__, num, DMX_T[dmx_type], dmx_type, buffersize, fd); /* this would actually need locking, but the worst that weill happen is, that * we'll DMX_SET_SOURCE twice per device, so don't bother... */ @@ -214,7 +214,7 @@ static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_ init[devnum] = true; } if (buffersize == 0) - buffersize = 0xffff; // may or may not be reasonable --martii + buffersize = 0xffff; // may or may not be reasonable --martii if (buffersize > 0) { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ @@ -270,7 +270,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) #if 0 if (len != 4095 && timeout != 10) fprintf(stderr, "cDemux::%s #%d fd: %d type: %s len: %d timeout: %d\n", - __FUNCTION__, num, fd, DMX_T[dmx_type], len, timeout); + __FUNCTION__, num, fd, DMX_T[dmx_type], len, timeout); #endif if (fd < 0) { @@ -339,7 +339,7 @@ retry: return 0; } } - if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */ + if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */ { /* read(-1,...) will just return EBADF anyway... */ hal_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); @@ -355,8 +355,8 @@ retry: } bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filter, - const unsigned char *const mask, int len, int timeout, - const unsigned char *const negmask) + const unsigned char *const mask, int len, int timeout, + const unsigned char *const negmask) { struct dmx_sct_filter_params s_flt; memset(&s_flt, 0, sizeof(s_flt)); @@ -373,7 +373,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte s_flt.pid = pid; s_flt.timeout = timeout; memcpy(s_flt.filter.filter, filter, len); - memcpy(s_flt.filter.mask, mask, len); + memcpy(s_flt.filter.mask, mask, len); if (negmask != NULL) memcpy(s_flt.filter.mode, negmask, len); @@ -424,7 +424,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte case 0x70: /* time_date_section */ s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ s_flt.flags |= DMX_ONESHOT; - //s_flt.pid = 0x0014; + //s_flt.pid = 0x0014; to = 30000; break; case 0x71: /* running_status_section */ @@ -437,7 +437,7 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte break; case 0x73: /* time_offset_section */ s_flt.flags |= DMX_ONESHOT; - //s_flt.pid = 0x0014; + //s_flt.pid = 0x0014; to = 30000; break; case 0x74: /* application_information_section */ @@ -465,8 +465,8 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte if (timeout == 0 && negmask == NULL) s_flt.timeout = to; - hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num, - pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]); + hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", + __func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]); if (debuglevel == 2) { @@ -474,10 +474,10 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.filter[i]); fprintf(stderr, "\n"); fprintf(stderr, "mask: "); - for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mask [i]); + for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mask[i]); fprintf(stderr, "\n"); fprintf(stderr, "mode: "); - for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mode [i]); + for (int i = 0; i < len; i++) fprintf(stderr, "%02hhx ", s_flt.filter.mode[i]); fprintf(stderr, "\n"); } @@ -497,7 +497,7 @@ bool cDemux::pesFilter(const unsigned short _pid) * this check originally is from tuxbox cvs but I'm not sure * what it is good for... if (pid <= 0x0001 && dmx_type != DMX_PCR_ONLY_CHANNEL) - return false; + return false; */ if ((pid >= 0x0002 && pid <= 0x000f) || pid >= 0x1fff) return false; @@ -507,10 +507,10 @@ bool cDemux::pesFilter(const unsigned short _pid) _open(this, num, fd, P->last_source, dmx_type, buffersize); memset(&p_flt, 0, sizeof(p_flt)); - p_flt.pid = pid; - p_flt.input = DMX_IN_FRONTEND; + p_flt.pid = pid; + p_flt.input = DMX_IN_FRONTEND; p_flt.output = DMX_OUT_DECODER; - p_flt.flags = 0; + p_flt.flags = 0; switch (dmx_type) { @@ -534,7 +534,7 @@ bool cDemux::pesFilter(const unsigned short _pid) break; case DMX_PES_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TAP; + p_flt.output = DMX_OUT_TAP; break; #if 0 case DMX_PSI_CHANNEL: @@ -542,7 +542,7 @@ bool cDemux::pesFilter(const unsigned short _pid) #endif case DMX_TP_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TSDEMUX_TAP; + p_flt.output = DMX_OUT_TSDEMUX_TAP; break; case DMX_PCR_ONLY_CHANNEL: switch (num) diff --git a/libarmbox/hdmi_cec.cpp b/libarmbox/hdmi_cec.cpp index 9111062..8e2e16d 100644 --- a/libarmbox/hdmi_cec.cpp +++ b/libarmbox/hdmi_cec.cpp @@ -52,24 +52,24 @@ #define hal_debug_c(args...) _hal_debug(HAL_DEBUG_INIT, NULL, args) #define hal_info_c(args...) _hal_info(HAL_DEBUG_INIT, NULL, args) -#define fop(cmd, args...) ({ \ - int _r; \ - if (fd >= 0) { \ - if ((_r = ::cmd(fd, args)) < 0) \ - hal_info(#cmd"(fd, "#args")\n"); \ - else \ +#define fop(cmd, args...) ({ \ + int _r; \ + if (fd >= 0) { \ + if ((_r = ::cmd(fd, args)) < 0) \ + hal_info(#cmd"(fd, "#args")\n");\ + else \ hal_debug(#cmd"(fd, "#args")\n");\ - } \ - else { _r = fd; } \ - _r; \ + } \ + else { _r = fd; } \ + _r; \ }) #define CEC_FALLBACK_DEVICE "/dev/cec0" #define CEC_HDMIDEV "/dev/hdmi_cec" #if BOXMODEL_H7 -#define RC_DEVICE "/dev/input/event2" +#define RC_DEVICE "/dev/input/event2" #else -#define RC_DEVICE "/dev/input/event1" +#define RC_DEVICE "/dev/input/event1" #endif hdmi_cec *hdmi_cec::hdmi_cec_instance = NULL; @@ -689,9 +689,7 @@ void hdmi_cec::Receive(int what) case CEC_OPCODE_DEVICE_VENDOR_ID: case CEC_OPCODE_VENDOR_COMMAND_WITH_ID: { - uint64_t iVendorId = ((uint64_t)rxmessage.data[1] << 16) + - ((uint64_t)rxmessage.data[2] << 8) + - (uint64_t)rxmessage.data[3]; + uint64_t iVendorId = ((uint64_t)rxmessage.data[1] << 16) + ((uint64_t)rxmessage.data[2] << 8) + (uint64_t)rxmessage.data[3]; hal_info(GREEN "[CEC] decoded message '%s' (%s)\n" NORMAL, ToString((cec_opcode)rxmessage.opcode), ToString((cec_vendor_id)iVendorId)); break; } diff --git a/libarmbox/init.cpp b/libarmbox/init.cpp index 6d6944c..bbdcca7 100644 --- a/libarmbox/init.cpp +++ b/libarmbox/init.cpp @@ -27,7 +27,7 @@ void hal_api_init() if (!initialized) { cCpuFreqManager f; - f.SetCpuFreq(0); /* CPUFREQ == 0 is the trigger for leaving standby */ + f.SetCpuFreq(0); /* CPUFREQ == 0 is the trigger for leaving standby */ char buffer[64]; sprintf(buffer, "%x", 0); proc_put("/proc/stb/fb/dst_top", buffer, strlen(buffer)); diff --git a/libarmbox/playback_libeplayer3.cpp b/libarmbox/playback_libeplayer3.cpp index ddf9cf2..d52a95d 100644 --- a/libarmbox/playback_libeplayer3.cpp +++ b/libarmbox/playback_libeplayer3.cpp @@ -11,10 +11,10 @@ extern "C" { #include - extern OutputHandler_t OutputHandler; - extern PlaybackHandler_t PlaybackHandler; - extern ContainerHandler_t ContainerHandler; - extern ManagerHandler_t ManagerHandler; + extern OutputHandler_t OutputHandler; + extern PlaybackHandler_t PlaybackHandler; + extern ContainerHandler_t ContainerHandler; + extern ManagerHandler_t ManagerHandler; extern int32_t ffmpeg_av_dict_set(const char *key, const char *value, int32_t flags); } @@ -63,10 +63,10 @@ bool cPlayback::Open(playmode_t PlayMode) if (player) { - player->playback = &PlaybackHandler; - player->output = &OutputHandler; - player->container = &ContainerHandler; - player->manager = &ManagerHandler; + player->playback = &PlaybackHandler; + player->output = &OutputHandler; + player->container = &ContainerHandler; + player->manager = &ManagerHandler; hal_info("%s - player output name: %s PlayMode: %s\n", __func__, player->output->Name, aPLAYMODE[PlayMode]); } @@ -129,7 +129,7 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in if (file.substr(0, 7) == "file://") { - if (file.substr(file.length() - 3) == ".ts") + if (file.substr(file.length() - 3) == ".ts") { fn_ts = file.substr(7); fn_xml = file.substr(7, file.length() - 9); @@ -221,23 +221,23 @@ bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, in //Teletext if (player && player->manager && player->manager->teletext) { - char ** TrackList = NULL; - player->manager->teletext->Command(player, MANAGER_LIST, &TrackList); - if (TrackList != NULL) - { - printf("TeletextTrack List\n"); - int i = 0; - for (i = 0; TrackList[i] != NULL; i += 2) - { - printf("\t%s - %s\n", TrackList[i], TrackList[i + 1]); - free(TrackList[i]); - free(TrackList[i + 1]); - } - free(TrackList); - } + char ** TrackList = NULL; + player->manager->teletext->Command(player, MANAGER_LIST, &TrackList); + if (TrackList != NULL) + { + printf("TeletextTrack List\n"); + int i = 0; + for (i = 0; TrackList[i] != NULL; i += 2) + { + printf("\t%s - %s\n", TrackList[i], TrackList[i + 1]); + free(TrackList[i]); + free(TrackList[i + 1]); + } + free(TrackList); + } } - */ + //Chapters if (player && player->manager && player->manager->chapter) { @@ -336,7 +336,7 @@ bool cPlayback::SetTeletextPid(int pid) if (pid != mTeletextStream) { //if (player && player->playback) - // player->playback->Command(player, PLAYBACK_SWITCH_TELETEXT, (void*)&i); + // player->playback->Command(player, PLAYBACK_SWITCH_TELETEXT, (void*)&i); mTeletextStream = pid; } return true; @@ -569,26 +569,26 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t { apids[j] = _pid; // 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)) ac3flags[j] = 3; - if (!strncmp("A_MP3", TrackList[i + 1], 5)) + if (!strncmp("A_MP3", TrackList[i + 1], 5)) ac3flags[j] = 4; - else if (!strncmp("A_AC3", TrackList[i + 1], 5)) + else if (!strncmp("A_AC3", TrackList[i + 1], 5)) ac3flags[j] = 1; - else if (!strncmp("A_EAC3", TrackList[i + 1], 6)) + else if (!strncmp("A_EAC3", TrackList[i + 1], 6)) ac3flags[j] = 7; - else if (!strncmp("A_DTS", TrackList[i + 1], 5)) + else if (!strncmp("A_DTS", TrackList[i + 1], 5)) ac3flags[j] = 6; - else if (!strncmp("A_AAC", TrackList[i + 1], 5)) + else if (!strncmp("A_AAC", TrackList[i + 1], 5)) ac3flags[j] = 5; - else if (!strncmp("A_PCM", TrackList[i + 1], 5)) - ac3flags[j] = 0; //todo - else if (!strncmp("A_VORBIS", TrackList[i + 1], 8)) - ac3flags[j] = 0; //todo - else if (!strncmp("A_FLAC", TrackList[i + 1], 6)) - ac3flags[j] = 0; //todo + else if (!strncmp("A_PCM", TrackList[i + 1], 5)) + ac3flags[j] = 0; // todo + else if (!strncmp("A_VORBIS", TrackList[i + 1], 8)) + ac3flags[j] = 0; // todo + else if (!strncmp("A_FLAC", TrackList[i + 1], 6)) + ac3flags[j] = 0; // todo else - ac3flags[j] = 0; //todo + ac3flags[j] = 0; // todo std::string _language = ""; _language += std::string(_lang); if (_language.compare("und") == 0) @@ -652,36 +652,38 @@ void cPlayback::FindAllTeletextsubtitlePids(int */*pids*/, unsigned int *numpids //int max_numpids = *numpids; *numpids = 0; - /* if (player && player->manager && player->manager->teletext) - { - char **TrackList = NULL; - player->manager->teletext->Command(player, MANAGER_LIST, &TrackList); - if (TrackList != NULL) - { - printf("Teletext List\n"); - int i = 0, j = 0; - for (i = 0, j = 0; TrackList[i] != NULL; i += 2) - { - int type = 0; - printf("\t%s - %s\n", TrackList[i], TrackList[i + 1]); - if (j < max_numpids) - { - int _pid; - if (2 != sscanf(TrackList[i], "%d %*s %d %*d %*d", &_pid, &type)) - continue; - if (type != 2 && type != 5) // return subtitles only - continue; - pids[j] = _pid; - language[j] = std::string(TrackList[i]); - j++; - } - free(TrackList[i]); - free(TrackList[i + 1]); - } - free(TrackList); - *numpids = j; - } - } */ + /* + if (player && player->manager && player->manager->teletext) + { + char **TrackList = NULL; + player->manager->teletext->Command(player, MANAGER_LIST, &TrackList); + if (TrackList != NULL) + { + printf("Teletext List\n"); + int i = 0, j = 0; + for (i = 0, j = 0; TrackList[i] != NULL; i += 2) + { + int type = 0; + printf("\t%s - %s\n", TrackList[i], TrackList[i + 1]); + if (j < max_numpids) + { + int _pid; + if (2 != sscanf(TrackList[i], "%d %*s %d %*d %*d", &_pid, &type)) + continue; + if (type != 2 && type != 5) // return subtitles only + continue; + pids[j] = _pid; + language[j] = std::string(TrackList[i]); + j++; + } + free(TrackList[i]); + free(TrackList[i + 1]); + } + free(TrackList); + *numpids = j; + } + } + */ } int cPlayback::GetTeletextPid(void) @@ -689,31 +691,33 @@ int cPlayback::GetTeletextPid(void) hal_info("%s\n", __func__); int pid = -1; - /* if (player && player->manager && player->manager->teletext) - { - char **TrackList = NULL; - player->manager->teletext->Command(player, MANAGER_LIST, &TrackList); - if (TrackList != NULL) - { - printf("Teletext List\n"); - int i = 0; - for (i = 0; TrackList[i] != NULL; i += 2) - { - int type = 0; - printf("\t%s - %s\n", TrackList[i], TrackList[i+1]); - if (pid < 0) - { - if (2 != sscanf(TrackList[i], "%*d %d %*s %d %*d %*d", &pid, &type)) - continue; - if (type != 1) - pid = -1; - } - free(TrackList[i]); - free(TrackList[i + 1]); - } - free(TrackList); - } - } */ + /* + if (player && player->manager && player->manager->teletext) + { + char **TrackList = NULL; + player->manager->teletext->Command(player, MANAGER_LIST, &TrackList); + if (TrackList != NULL) + { + printf("Teletext List\n"); + int i = 0; + for (i = 0; TrackList[i] != NULL; i += 2) + { + int type = 0; + printf("\t%s - %s\n", TrackList[i], TrackList[i + 1]); + if (pid < 0) + { + if (2 != sscanf(TrackList[i], "%*d %d %*s %d %*d %*d", &pid, &type)) + continue; + if (type != 1) + pid = -1; + } + free(TrackList[i]); + free(TrackList[i + 1]); + } + free(TrackList); + } + } + */ printf("teletext pid id %d (0x%x)\n", pid, pid); return pid; diff --git a/libarmbox/record.cpp b/libarmbox/record.cpp index fd9946c..321d830 100644 --- a/libarmbox/record.cpp +++ b/libarmbox/record.cpp @@ -286,8 +286,8 @@ void cRecord::RecordThread() if (toread > readsize) toread = readsize; ssize_t s = dmx->Read(buf + buf_pos, toread, 50); - hal_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, - buf_pos, (int)s, bufsize - buf_pos); + hal_debug("%s: buf_pos %6d s %6d / %6d\n", + __func__, buf_pos, (int)s, bufsize - buf_pos); if (s < 0) { if (errno != EAGAIN && (errno != EOVERFLOW || !overflow)) @@ -328,7 +328,7 @@ void cRecord::RecordThread() hal_debug("%s: aio in progress, free: %d\n", __func__, bufsize - buf_pos); continue; } - // not calling aio_return causes a memory leak --martii + // not calling aio_return causes a memory leak --martii r = aio_return(&a); if (r < 0) { diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 8e13820..aaac76d 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -54,23 +54,23 @@ extern "C" #define hal_debug_c(args...) _hal_debug(HAL_DEBUG_VIDEO, NULL, args) #define hal_info_c(args...) _hal_info(HAL_DEBUG_VIDEO, NULL, args) -#define fop(cmd, args...) ({ \ - int _r; \ - if (fd >= 0) { \ - if ((_r = ::cmd(fd, args)) < 0) \ +#define fop(cmd, args...) ({ \ + int _r; \ + if (fd >= 0) { \ + if ((_r = ::cmd(fd, args)) < 0) \ hal_info(#cmd"(fd, "#args")\n");\ - else \ + else \ hal_debug(#cmd"(fd, "#args")\n");\ - } \ - else { _r = fd; } \ - _r; \ + } \ + else { _r = fd; } \ + _r; \ }) #ifndef VIDEO_GET_SIZE -#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) +#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) #endif #ifndef VIDEO_GET_FRAME_RATE -#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int) +#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int) #endif enum @@ -189,8 +189,8 @@ static const char *vid_modes[] = "1080p25", // VIDEO_STD_1080P25 "1080p50", // VIDEO_STD_1080P50 "1080p60", // VIDEO_STD_1080P60 - "1080p2397", // VIDEO_STD_1080P2397 - "1080p2997", // VIDEO_STD_1080P2997 + "1080p2397",// VIDEO_STD_1080P2397 + "1080p2997",// VIDEO_STD_1080P2997 "2160p24", // VIDEO_STD_2160P24 "2160p25", // VIDEO_STD_2160P25 "2160p30", // VIDEO_STD_2160P30 @@ -209,11 +209,11 @@ static const char *vid_modes[] = #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100) static void get_packet_defaults(AVPacket *pkt) { - memset(pkt, 0, sizeof(*pkt)); + memset(pkt, 0, sizeof(*pkt)); - pkt->pts = AV_NOPTS_VALUE; - pkt->dts = AV_NOPTS_VALUE; - pkt->pos = -1; + pkt->pts = AV_NOPTS_VALUE; + pkt->dts = AV_NOPTS_VALUE; + pkt->pos = -1; } #endif ssize_t write_all(int fd, const void *buf, size_t count) @@ -607,7 +607,7 @@ int cVideo::setAspectRatio(int aspect, int mode) int n; int mo = (mode < 0 || mode > 3) ? 4 : mode; - hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[mo]); + hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[mo]); if (aspect > 3 || aspect == 0) hal_info("%s: invalid aspect: %d\n", __func__, aspect); @@ -673,7 +673,7 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho #if 0 if (playstate == VIDEO_PLAYING) return 0; - if (playstate == VIDEO_FREEZED) /* in theory better, but not in practice :-) */ + if (playstate == VIDEO_FREEZED) /* in theory better, but not in practice :-) */ fop(ioctl, MPEG_VID_CONTINUE); #endif /* implicitly do StopPicture() on video->Start() */ @@ -1048,9 +1048,9 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate) int n = proc_get(VMPEG_framerate[devnum], buf, 16); if (n > 0) sscanf(buf, "%i", &r); - width = proc_get_hex(VMPEG_xres[devnum]); + width = proc_get_hex(VMPEG_xres[devnum]); height = proc_get_hex(VMPEG_yres[devnum]); - rate = rate2csapi(r); + rate = rate2csapi(r); return; } ioctl(fd, VIDEO_GET_SIZE, &s); @@ -1236,7 +1236,7 @@ void cVideo::SetColorFormat(COLOR_FORMAT color_format) bool getvideo2(unsigned char *video, int xres, int yres) { bool ret = false; - if (video == NULL) + if (video == NULL) return ret; char videosnapshot[] = "/dev/dvb/adapter0/video0"; int fd_video = open(videosnapshot, O_RDONLY); @@ -1380,7 +1380,7 @@ void get_osd_buf(unsigned char *osd_data) close(fb); } -inline void rgb24torgb32(unsigned char *src, unsigned char *dest, int picsize) +inline void rgb24torgb32(unsigned char *src, unsigned char *dest, int picsize) { for (int i = 0; i < picsize; i++) { @@ -1397,7 +1397,7 @@ bool cVideo::GetScreenImage(unsigned char *&out_data, int &xres, int &yres, bool #define VDEC_PIXFMT AV_PIX_FMT_BGR24 hal_info("%s: out_data 0x%p xres %d yres %d vid %d osd %d scale %d\n", - __func__, out_data, xres, yres, get_video, get_osd, scale_to_video); + __func__, out_data, xres, yres, get_video, get_osd, scale_to_video); int aspect = 0; getPictureInfo(xres, yres, aspect); /* aspect is dummy here */ aspect = getAspectRatio(); @@ -1440,7 +1440,7 @@ bool cVideo::GetScreenImage(unsigned char *&out_data, int &xres, int &yres, bool free(video_src); return false; } - if (grab_w != xres || grab_h != yres) /* scale video into data... */ + if (grab_w != xres || grab_h != yres) /* scale video into data... */ { bool ret = swscale(video_src, out_data, grab_w, grab_h, xres, yres, VDEC_PIXFMT); if (!ret) @@ -1450,7 +1450,7 @@ bool cVideo::GetScreenImage(unsigned char *&out_data, int &xres, int &yres, bool return false; } } - else /* get_video and no fancy scaling needed */ + else /* get_video and no fancy scaling needed */ { rgb24torgb32(video_src, out_data, grab_w * grab_h); } @@ -1506,7 +1506,7 @@ bool cVideo::GetScreenImage(unsigned char *&out_data, int &xres, int &yres, bool { uint8_t *in = (uint8_t *)(pixpos); uint8_t *out = (uint8_t *)d; - int a = in[3]; /* TODO: big/little endian? */ + int a = in[3]; /* TODO: big/little endian? */ *out = (*out + ((*in - *out) * a) / 256); in++; out++; diff --git a/libmipsbox/hardware_caps.c b/libmipsbox/hardware_caps.c index 8e810d2..cabfd08 100644 --- a/libmipsbox/hardware_caps.c +++ b/libmipsbox/hardware_caps.c @@ -43,7 +43,7 @@ hw_caps_t *get_hwcaps(void) caps.display_type = HW_DISPLAY_LINE_TEXT; caps.display_can_deepstandby = 1; caps.display_can_set_brightness = 1; - caps.display_can_umlauts = 0; /* need test */ + caps.display_can_umlauts = 0; /* need test */ caps.display_has_statusline = 0; caps.display_has_colon = 0; caps.has_button_timer = 1;