From 53f09bab39b29fdf27026bd83f2ead0808635fb2 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 23 Oct 2016 13:51:12 +0200 Subject: [PATCH 1/8] remove dead fader.cpp code Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/274a5935c8bbbb4ba70c901ff9a944e7e60a7b9a Author: Stefan Seyfried Date: 2016-10-23 (Sun, 23 Oct 2016) --- src/driver/fader.cpp | 98 -------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 src/driver/fader.cpp diff --git a/src/driver/fader.cpp b/src/driver/fader.cpp deleted file mode 100644 index cdb6a4985..000000000 --- a/src/driver/fader.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - Neutrino-HD GUI, COSDFader implementation - Copyright (C) 2011 Stefan Seyfried - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include -#include - -COSDFader::COSDFader(int trans) -{ - fb = CFrameBuffer::getInstance(); - target_trans = trans; - timer = 0; - step = 0; -} - -COSDFader::~COSDFader() -{ - Stop(); -} - -void COSDFader::StartFadeIn() -{ - transparency = 100; - step = -FADE_STEP; - Fade(); -} - -/* returns true if fade out was not started before and fade is enabled */ -bool COSDFader::StartFadeOut() -{ - if (!g_settings.widget_fade) /* disabled */ - return false; - if (step == FADE_STEP) /* already fading out... */ - return false; - - /* start fading */ - step = FADE_STEP; - Fade(); - return true; -} - -void COSDFader::Stop() -{ - if (!step) - return; - - g_RCInput->killTimer(timer); - fb->setBlendMode(1); /* per pixel alpha */ -} - -/* returns true if fade out is finished */ -bool COSDFader::Fade() -{ - if (!g_settings.widget_fade) - return false; - - if (timer == 0) - timer = g_RCInput->addTimer(FADE_TIME, false); - - if (transparency == 100 || transparency == target_trans) - { - fb->setBlendMode(2); /* 2 == "global alpha x pixel alpha" */ - fb->setBlendLevel(transparency); - transparency += step; - return false; - } - transparency += step; - if (step > 0 && transparency >= 100) /* finished fading out */ - { - transparency = target_trans; - g_RCInput->killTimer(timer); - return true; - } - if (step < 0 && transparency <= target_trans) /* finished fading in */ - { - transparency = target_trans; - g_RCInput->killTimer(timer); - fb->setBlendMode(1); /* 1 == "per pixel alpha" */ - return false; - } - fb->setBlendLevel(transparency); - return false; -} From 3d1f276fb3dc277cb63cb69c9ee9406d2081a0ce Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 23 Oct 2016 16:59:32 +0200 Subject: [PATCH 2/8] libmd5sum: use tuxbox upstream code Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/727d56d69ae6b8e4875429b68e1a8534ec85ce36 Author: Stefan Seyfried Date: 2016-10-23 (Sun, 23 Oct 2016) --- lib/libmd5sum/md5.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libmd5sum/md5.c b/lib/libmd5sum/md5.c index 3e7aa83ed..e433782e8 100644 --- a/lib/libmd5sum/md5.c +++ b/lib/libmd5sum/md5.c @@ -96,8 +96,8 @@ md5_finish_ctx (ctx, resbuf) { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; + md5_uint32 swap_bytes; size_t pad; - md5_uint32 *p; /* Now count remaining bytes. */ ctx->total[0] += bytes; @@ -107,11 +107,13 @@ md5_finish_ctx (ctx, resbuf) pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memmove (&ctx->buffer[bytes], fillbuf, pad); - /* Put the 64-bit file length in *bits* at the end of the buffer. */ - p = (md5_uint32 *)&ctx->buffer[bytes + pad]; - *p = SWAP (ctx->total[0] << 3); - p++; - *p = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); + /* Put the 64-bit file length in *bits* at the end of the buffer. + Use memcpy to avoid aliasing problems. On most systems, this + will be optimized away to the same code. */ + swap_bytes = SWAP (ctx->total[0] << 3); + memcpy (&ctx->buffer[bytes + pad], &swap_bytes, sizeof (swap_bytes)); + swap_bytes = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); + memcpy (&ctx->buffer[bytes + pad + 4], &swap_bytes, sizeof (swap_bytes)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); From 21970bd10215f822a4e570938de87e45cd9ca3e7 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 30 Oct 2016 10:56:13 +0100 Subject: [PATCH 3/8] zapit/frontend: improve SIMULATE_FE code Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5257d14c1336474b1a7be301cfd52ef477e1bd76 Author: Stefan Seyfried Date: 2016-10-30 (Sun, 30 Oct 2016) --- src/zapit/src/femanager.cpp | 6 ++++-- src/zapit/src/frontend.cpp | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index 2f49b2485..08af9e5c8 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -2,7 +2,7 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2011 CoolStream International Ltd - Copyright (C) 2012,2013,2014 Stefan Seyfried + Copyright (C) 2012-2016 Stefan Seyfried License: GPLv2 @@ -117,10 +117,12 @@ bool CFEManager::Init() /* for testing without a frontend, export SIMULATE_FE=1 */ if (femap.empty() && getenv("SIMULATE_FE")) { INFO("SIMULATE_FE is set, adding dummy frontend for testing"); - fe = new CFrontend(0,0); + fe = new CFrontend(0, -1); fekey = MAKE_FE_KEY(0, 0); femap.insert(std::pair (fekey, fe)); + fe->Open(); livefe = fe; + have_sat = true; } if (femap.empty()) return false; diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 543959a73..762a99261 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -3,7 +3,7 @@ * * (C) 2002-2003 Andreas Oberritter * - * (C) 2007-2013,2015 Stefan Seyfried + * (C) 2007-2013,2015-2016 Stefan Seyfried * Copyright (C) 2011 CoolStream International Ltd * * This program is free software; you can redistribute it and/or modify @@ -232,6 +232,14 @@ bool CFrontend::Open(bool init) snprintf(filename, sizeof(filename), "/dev/dvb/adapter%d/frontend%d", adapter, fenumber); DBG("[fe%d] open %s\n", fenumber, filename); + if (adapter == -1) { + deliverySystemMask |= DVB_S; + deliverySystemMask |= DVB_S2; + info.type = FE_QPSK; + strcpy(info.name, "dummyfe"); + return false; + } + mutex.lock(); if (fd < 0) { if ((fd = open(filename, O_RDWR | O_NONBLOCK | O_CLOEXEC)) < 0) { From b1af01a476be68181dab116769953878f2bfd51b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 11 Nov 2016 16:35:50 +0100 Subject: [PATCH 4/8] moviebrowser: reset m_pcInfo1 box to default height, ... when turning m_settings.browserAdditional off Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ad7947d11a7c5c133b912474503e687cbf20e363 Author: vanhofen Date: 2016-11-11 (Fri, 11 Nov 2016) Origin message was: ------------------ - moviebrowser: reset m_pcInfo1 box to default height, ... when turning m_settings.browserAdditional off --- src/gui/moviebrowser/mb.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index e7b840fce..42d995daf 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -3438,14 +3438,17 @@ bool CMovieBrowser::showMenu(bool calledExternally) if (reInitFrames) { #if 1 - if (m_settings.browserAdditional && oldAdditional != m_settings.browserAdditional) + if (oldAdditional != m_settings.browserAdditional) { /* Bad 'hack' to force a smaller m_pcInfo1 box. This can be reconfigured by user later. It's just to align view to channellist's view. */ - m_settings.browserFrameHeight = 75; + if (m_settings.browserAdditional) + m_settings.browserFrameHeight = 75; + else + m_settings.browserFrameHeight = 65; } #endif initFrames(); From df635f87a12a940a376f2ecfcd6eebf91f7c8eb2 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 12 Nov 2016 18:24:14 +0100 Subject: [PATCH 5/8] neutrinoyparser: fix string literal warning with newer gcc Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/bc0605298548dbce8cbb14f3ec4a83fcba5d5f15 Author: Stefan Seyfried Date: 2016-11-12 (Sat, 12 Nov 2016) --- src/nhttpd/tuxboxapi/neutrinoyparser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index f08d246a6..d58b79406 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -429,7 +429,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: if (channel->getChannelID() == current_channel) yresult += "\n"; - yresult += string_printf("" + yresult += string_printf("" "%d. %s%s" "\n" , channel->getChannelID() @@ -461,7 +461,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: } if (event.eventID) { - yresult += string_printf("" + yresult += string_printf("" "\"Program" "\n" , channel->getChannelID() @@ -469,7 +469,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: ); } - yresult += string_printf("" + yresult += string_printf("" "\"Stream\"" "\n" , channel->getChannelID() From 8634dfb240fe9c8b16d2071b6aae78be6fa32cad Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 12 Nov 2016 18:25:06 +0100 Subject: [PATCH 6/8] timermanager: fix -Waddress warning with newer gcc The address of Events (wich is checked against NULL) can never be NULL, because Events is passed by reference. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4bd8696a84e4a011b3bdc549df7ec0edf9b4f226 Author: Stefan Seyfried Date: 2016-11-12 (Sat, 12 Nov 2016) --- src/timerd/timermanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index cfb509c8e..6e17a1c01 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -292,9 +292,10 @@ int CTimerManager::unlockEvents() bool CTimerManager::listEvents(CTimerEventMap &Events) { +/* events is passed as reference and thus its address is never NULL if(!&Events) return false; - + */ Events.clear(); for (CTimerEventMap::iterator pos = events.begin(); pos != events.end(); ++pos) From a40212a5ebe6d9c9b0a1e56f624d9b911c621f6b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 12 Nov 2016 22:16:42 +0100 Subject: [PATCH 7/8] driver: use newer ffmpeg API Reduce the "deprecated function" warnings a bit when compiling against recent ffmpeg releases. Just the drop-in-replacement "av_packet_unref" which works with both old and new ffmpeg versions. The other stuff needs rewrites which are not compatible with all ffmpeg releases :-( Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4a400c909a9ecb276a0b529ea7e9190a7b8ac94b Author: Stefan Seyfried Date: 2016-11-12 (Sat, 12 Nov 2016) --- src/driver/audiodec/ffmpegdec.cpp | 6 +++--- src/driver/record.cpp | 4 ++-- src/driver/streamts.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 625aef79f..3262a0a95 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -310,7 +310,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, } if (rpacket.stream_index != best_stream) { - av_free_packet(&rpacket); + av_packet_unref(&rpacket); continue; } @@ -369,7 +369,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, } if (time_played && avc->streams[best_stream]->time_base.den) *time_played = (pts - start_pts) * avc->streams[best_stream]->time_base.num / avc->streams[best_stream]->time_base.den; - av_free_packet(&rpacket); + av_packet_unref(&rpacket); } while (*state!=STOP_REQ && Status==OK); audioDecoder->StopClip(); @@ -377,7 +377,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state, swr_free(&swr); av_free(outbuf); - av_free_packet(&rpacket); + av_packet_unref(&rpacket); av_frame_free(&frame); avcodec_close(c); //av_free(avcc); diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 1f9b33172..146ba5d2a 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2206,7 +2206,7 @@ void CStreamRec::run() AVPacket newpkt = pkt; if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { - av_free_packet(&pkt); + av_packet_unref(&pkt); newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); pkt = newpkt; } @@ -2215,7 +2215,7 @@ void CStreamRec::run() pkt.dts = av_rescale_q(pkt.dts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); av_write_frame(ofcx, &pkt); - av_free_packet(&pkt); + av_packet_unref(&pkt); if (pkt.stream_index == stream_index) { total += (double) 1000 * pkt.duration * av_q2d(ifcx->streams[stream_index]->time_base); diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index aebb0e168..f04cd70bc 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -903,7 +903,7 @@ void CStreamStream::run() AVPacket newpkt = pkt; if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) { - av_free_packet(&pkt); + av_packet_unref(&pkt); newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0); pkt = newpkt; } @@ -912,7 +912,7 @@ void CStreamStream::run() pkt.dts = av_rescale_q(pkt.dts, ifcx->streams[pkt.stream_index]->time_base, ofcx->streams[pkt.stream_index]->time_base); av_write_frame(ofcx, &pkt); - av_free_packet(&pkt); + av_packet_unref(&pkt); } av_read_pause(ifcx); From 4e0ce4622cf768084b13244c7265da1da12cf472 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 12 Nov 2016 22:19:33 +0100 Subject: [PATCH 8/8] zapit: fix "comparison is always false" warnings demux Start() Stop() and pesFilter() are bool, so comparing < 0 really does not make sense. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/71457a0b171d63ba7c7120d37ab417bf592293c6 Author: Stefan Seyfried Date: 2016-11-12 (Sat, 12 Nov 2016) --- src/zapit/src/zapit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index f2af9fdea..e31b8ce15 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -974,7 +974,7 @@ bool CZapit::ChangeAudioPid(uint8_t index) return false; /* stop demux filter */ - if (audioDemux->Stop() < 0) + if (audioDemux->Stop() == false) return false; /* stop audio playback */ @@ -996,11 +996,11 @@ bool CZapit::ChangeAudioPid(uint8_t index) SetAudioStreamType(currentAudioChannel->audioChannelType); /* set demux filter */ - if (audioDemux->pesFilter(current_channel->getAudioPid()) < 0) + if (audioDemux->pesFilter(current_channel->getAudioPid()) == false) return false; /* start demux filter */ - if (audioDemux->Start() < 0) + if (audioDemux->Start() == false) return false; /* start audio playback */