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); 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/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; -} diff --git a/src/driver/record.cpp b/src/driver/record.cpp index d642b051a..a0248e4cc 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2284,7 +2284,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; } @@ -2293,7 +2293,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 799ee1b5b..46745626b 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -909,7 +909,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; } @@ -918,7 +918,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); diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 253581528..9a8c29db3 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -3536,14 +3536,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(); diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index 5cf092095..ff15f2534 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -441,7 +441,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() @@ -473,7 +473,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() @@ -481,7 +481,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: ); } - yresult += string_printf("" + yresult += string_printf("" "\"Stream\"" "\n" , channel->getChannelID() diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index 203ccd5d1..6878137f5 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) diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index 590023cf6..30ff88d49 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,11 +117,13 @@ 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); fe->setName("DuTu - The dummy tuner"); 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 9c6fee4aa..b72ee0ac8 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) { diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 243c0b484..d19fae601 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -973,7 +973,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 */ @@ -995,11 +995,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 */