mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
Merge branch 'master' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/tuxbox
Origin commit data
------------------
Commit: 336e0f4c66
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-04-19 (Wed, 19 Apr 2017)
This commit is contained in:
@@ -223,7 +223,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state,
|
||||
Status=DATA_ERR;
|
||||
return Status;
|
||||
}
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
AVCodecContext *c = avc->streams[best_stream]->codec;
|
||||
#else
|
||||
AVCodecContext *c = avcodec_alloc_context3(codec);
|
||||
@@ -460,7 +460,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
||||
if (!is_stream) {
|
||||
GetMeta(avc->metadata);
|
||||
for(unsigned int i = 0; i < avc->nb_streams; i++) {
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
if (avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
#else
|
||||
if (avc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
@@ -481,7 +481,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
||||
DeInit();
|
||||
return false;
|
||||
}
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
if (!codec)
|
||||
codec = avcodec_find_decoder(avc->streams[best_stream]->codec->codec_id);
|
||||
samplerate = avc->streams[best_stream]->codec->sample_rate;
|
||||
@@ -511,7 +511,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
||||
printf("CFfmpegDec: format %s (%s) duration %ld\n", avc->iformat->name, type_info.c_str(), total_time);
|
||||
|
||||
for(unsigned int i = 0; i < avc->nb_streams; i++) {
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
if (avc->streams[i]->codec->bit_rate > 0)
|
||||
bitrate += avc->streams[i]->codec->bit_rate;
|
||||
#else
|
||||
|
@@ -123,6 +123,7 @@ std::string CPictureViewer::DownloadImage(std::string url)
|
||||
curl_easy_setopt(ch, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT, 3);
|
||||
curl_easy_setopt(ch, CURLOPT_TIMEOUT, 4);
|
||||
curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
CURLcode res = curl_easy_perform(ch);
|
||||
if (res != CURLE_OK){
|
||||
printf("[%s] curl_easy_perform() failed:%s\n",__func__, curl_easy_strerror(res));
|
||||
|
@@ -2025,7 +2025,7 @@ void CStreamRec::FillMovieInfo(CZapitChannel * /*channel*/, APIDList & /*apid_li
|
||||
|
||||
for (unsigned i = 0; i < ofcx->nb_streams; i++) {
|
||||
AVStream *st = ofcx->streams[i];
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
AVCodecContext * codec = st->codec;
|
||||
#else
|
||||
AVCodecParameters * codec = st->codecpar;
|
||||
@@ -2258,7 +2258,7 @@ bool CStreamRec::Open(CZapitChannel * channel)
|
||||
stream_index = -1;
|
||||
int stid = 0x200;
|
||||
for (unsigned i = 0; i < ifcx->nb_streams; i++) {
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
AVCodecContext * iccx = ifcx->streams[i]->codec;
|
||||
AVStream *ost = avformat_new_stream(ofcx, iccx->codec);
|
||||
avcodec_copy_context(ost->codec, iccx);
|
||||
@@ -2314,7 +2314,7 @@ void CStreamRec::run()
|
||||
break;
|
||||
if (pkt.stream_index < 0)
|
||||
continue;
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec;
|
||||
#else
|
||||
AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;
|
||||
|
@@ -846,7 +846,7 @@ bool CStreamStream::Open()
|
||||
av_dict_copy(&ofcx->metadata, ifcx->metadata, 0);
|
||||
int stid = 0x200;
|
||||
for (unsigned i = 0; i < ifcx->nb_streams; i++) {
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
AVCodecContext * iccx = ifcx->streams[i]->codec;
|
||||
AVStream *ost = avformat_new_stream(ofcx, iccx->codec);
|
||||
avcodec_copy_context(ost->codec, iccx);
|
||||
@@ -919,7 +919,7 @@ void CStreamStream::run()
|
||||
if (pkt.stream_index < 0)
|
||||
continue;
|
||||
|
||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
|
||||
AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec;
|
||||
#else
|
||||
AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;
|
||||
|
@@ -68,7 +68,7 @@ CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w,
|
||||
page_count = 1;
|
||||
cur_page = 0;
|
||||
sb = NULL;
|
||||
w_sb = 15;
|
||||
w_sb = SCROLLBAR_WIDTH;
|
||||
|
||||
page_scroll_mode = PG_SCROLL_M_UP_DOWN_KEY;
|
||||
|
||||
@@ -375,6 +375,7 @@ void CComponentsForm::paintCCItems()
|
||||
if (cc_parent){
|
||||
this_x = auto_x = cc_xr;
|
||||
this_y = auto_y = cc_yr;
|
||||
w_parent_frame = cc_parent->getFrameThickness();
|
||||
}
|
||||
|
||||
//init and handle scrollbar
|
||||
@@ -482,7 +483,7 @@ void CComponentsForm::paintCCItems()
|
||||
//Is it too wide or too high, it will be shortened and displayed in the log.
|
||||
//This should be avoid!
|
||||
//checkwidth and adapt if required
|
||||
int right_frm = (cc_parent ? cc_xr : x) + this_w - 2*fr_thickness;
|
||||
int right_frm = (cc_parent ? cc_xr : x) + this_w/* - 2*fr_thickness*/;
|
||||
int right_item = cc_item->getRealXPos() + w_item;
|
||||
int w_diff = right_item - right_frm;
|
||||
int new_w = w_item - w_diff;
|
||||
|
@@ -59,8 +59,8 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
|
||||
{
|
||||
cc_item_type = CC_ITEMTYPE_FRM_CLOCK;
|
||||
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
x = cc_xr = x_old = x_pos;
|
||||
y = cc_yr = y_old = y_pos;
|
||||
|
||||
shadow = shadow_mode;
|
||||
shadow_w = OFFSET_SHADOW;
|
||||
@@ -74,6 +74,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
|
||||
setClockFormat(prformat_str, secformat_str);
|
||||
cl_col_text = COL_MENUCONTENT_TEXT;
|
||||
|
||||
//enable refresh of all segments on each interval as default
|
||||
cl_force_repaint = true;
|
||||
|
||||
//init default font
|
||||
cl_font = font;
|
||||
cl_font_style = font_style;
|
||||
@@ -81,15 +84,12 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
|
||||
initClockFont(0, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight());
|
||||
|
||||
//init general clock dimensions
|
||||
height = cl_font->getHeight();
|
||||
width = cl_font->getRenderWidth(cl_format_str);
|
||||
height = height_old= cl_font->getHeight();
|
||||
width = width_old = cl_font->getRenderWidth(cl_format_str);
|
||||
|
||||
//set default text background behavior
|
||||
cc_txt_save_screen = false;
|
||||
|
||||
//enable refresh of all segments on each interval as default
|
||||
cl_force_repaint = true;
|
||||
|
||||
//set default running clock properties
|
||||
cl_interval = interval_seconds;
|
||||
cl_timer = NULL;
|
||||
@@ -429,9 +429,9 @@ void CComponentsFrmClock::setHeight(const int& h)
|
||||
int f_height = cl_font->getHeight();
|
||||
if (h != f_height){
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsFrmClock]\t[%s - %d], font height is different than current height [%d], using [%d] ...\033[0m\n", __func__, __LINE__, h, f_height);
|
||||
CCDraw::setHeight(f_height);
|
||||
CComponentsItem::setHeight(f_height);
|
||||
}else
|
||||
CCDraw::setHeight(h);
|
||||
CComponentsItem::setHeight(h);
|
||||
initCCLockItems();
|
||||
}
|
||||
|
||||
@@ -443,9 +443,9 @@ void CComponentsFrmClock::setWidth(const int& w)
|
||||
int f_width = cl_font->getRenderWidth(cl_format_str);
|
||||
if (w != f_width){
|
||||
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFrmClock]\t[%s - %d], font width is different than current width [%d], using [%d] ...\033[0m\n", __func__, __LINE__, w, f_width);
|
||||
CCDraw::setWidth(f_width);
|
||||
CComponentsItem::setWidth(f_width);
|
||||
}else
|
||||
CCDraw::setWidth(w);
|
||||
CComponentsItem::setWidth(w);
|
||||
initCCLockItems();
|
||||
}
|
||||
|
||||
|
@@ -111,6 +111,9 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
if (chain)
|
||||
chain->clear();
|
||||
|
||||
if (label_count == 0)
|
||||
return;
|
||||
|
||||
/* set general available full basic space for button chain,
|
||||
* in this case this is footer width
|
||||
*/
|
||||
@@ -372,7 +375,6 @@ void CComponentsFooter::paintButtons(const int& x_pos,
|
||||
this->setButtonFont(font);
|
||||
this->setContextButton(context_buttons);
|
||||
this->setButtonLabels(content, label_count, 0, label_width);
|
||||
|
||||
this->paint(do_save_bg);
|
||||
}
|
||||
|
||||
|
@@ -413,7 +413,6 @@ void CComponentsHeader::initClock()
|
||||
|
||||
//set clock form properties
|
||||
if (cch_cl_obj){
|
||||
cch_cl_obj->setYPos(cch_items_y);
|
||||
cch_cl_obj->setHeight(height);
|
||||
|
||||
//disallow paint of clock, if disabled and exit method
|
||||
@@ -475,7 +474,7 @@ void CComponentsHeader::initCaption()
|
||||
int clock_w = cch_cl_enable ? cch_cl_obj->getWidth() : 0;
|
||||
|
||||
//set x position of clock
|
||||
cch_cl_obj->setXPos(width - buttons_w - clock_w - cch_offset);
|
||||
cch_cl_obj->setXPos(width - buttons_w - clock_w);
|
||||
|
||||
//set required width of caption object
|
||||
cc_text_w -= (clock_w + cch_offset);
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include <zapit/include/zapit/frontend_c.h>
|
||||
#include <sstream>
|
||||
|
||||
#define SB_MIN_HEIGHT 12
|
||||
#define SB_MIN_HEIGHT OFFSET_INNER_MID
|
||||
#define REF_PERCENT_TXT "100% "
|
||||
|
||||
using namespace std;
|
||||
@@ -55,8 +55,8 @@ void CSignalBar::initVarSigBar(const int& xpos, const int& ypos, const int& w, c
|
||||
|
||||
corner_rad = 0;
|
||||
corner_type = 0;
|
||||
append_x_offset = 2;
|
||||
append_y_offset = 2;
|
||||
append_x_offset = OFFSET_INNER_MIN;
|
||||
append_y_offset = OFFSET_INNER_MIN;
|
||||
|
||||
sb_scale_height = -1;
|
||||
dy_font = CNeutrinoFonts::getInstance();
|
||||
@@ -330,7 +330,7 @@ void CSignalBox::initSignalItems()
|
||||
sbar->setScaleHeight(scale_h);
|
||||
sbar->enableTboxSaveScreen(cc_txt_save_screen);
|
||||
|
||||
snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : 1, sbar_w, sbar_h);
|
||||
snrbar->setDimensionsAll(vertical ? sbar_x : sbar->getXPos() + sbar->getWidth() + append_x_offset, vertical ? sbar->getYPos() + sbar->getHeight() + append_y_offset : 1, sbar_w, sbar_h);
|
||||
snrbar->setFrontEnd(sbx_frontend);
|
||||
snrbar->setTextColor(sbx_caption_color);
|
||||
snrbar->setActiveColor(sbx_active_color);
|
||||
|
@@ -205,7 +205,7 @@ void CComponentsWindow::initHeader()
|
||||
//set header properties //TODO: assigned properties with internal header objekt have no effect!
|
||||
if (ccw_head){
|
||||
ccw_head->setWidth(width-2*fr_thickness);
|
||||
ccw_head->setPos(0, 0);
|
||||
ccw_head->setPos(fr_thickness, fr_thickness);
|
||||
ccw_head->setIcon(ccw_icon_name);
|
||||
ccw_head->setCaption(ccw_caption, ccw_align_mode, ccw_col_head_text);
|
||||
ccw_head->setContextButton(ccw_buttons);
|
||||
@@ -223,8 +223,8 @@ void CComponentsWindow::initFooter()
|
||||
if (ccw_footer){
|
||||
if (ccw_h_footer)
|
||||
ccw_footer->setHeight(ccw_h_footer);
|
||||
ccw_footer->setPos(0, cc_yr + height - ccw_footer->getHeight()- fr_thickness);
|
||||
ccw_footer->setWidth(width-2*fr_thickness);
|
||||
ccw_footer->setPos(cc_xr + fr_thickness, cc_yr + height - ccw_footer->getHeight()- fr_thickness);
|
||||
ccw_footer->setWidth(width/*-2*fr_thickness*/);
|
||||
ccw_footer->enableShadow(false/*shadow*/);
|
||||
ccw_footer->setCorner(corner_rad-fr_thickness, CORNER_BOTTOM);
|
||||
ccw_footer->setButtonFont(ccw_button_font);
|
||||
|
@@ -261,6 +261,20 @@ bool CComponentsItem::isAdded()
|
||||
return false;
|
||||
}
|
||||
|
||||
void CComponentsItem::setXPos(const int& xpos)
|
||||
{
|
||||
CCDraw::setXPos(xpos);
|
||||
if (cc_parent)
|
||||
cc_xr = cc_parent->getXPos() + x;
|
||||
}
|
||||
|
||||
void CComponentsItem::setYPos(const int& ypos)
|
||||
{
|
||||
CCDraw::setYPos(ypos);
|
||||
if (cc_parent)
|
||||
cc_yr = cc_parent->getYPos() + y;
|
||||
}
|
||||
|
||||
void CComponentsItem::setXPosP(const uint8_t& xpos_percent)
|
||||
{
|
||||
int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth();
|
||||
|
@@ -134,6 +134,11 @@ class CComponentsItem : public CComponents
|
||||
///returns current number of page location of current item, see: cc_page_number
|
||||
virtual u_int8_t getPageNumber(){return cc_page_number;};
|
||||
|
||||
///set screen x-position, parameter as int
|
||||
virtual void setXPos(const int& xpos);
|
||||
///set screen y-position, parameter as int
|
||||
virtual void setYPos(const int& ypos);
|
||||
|
||||
///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen
|
||||
virtual void setXPosP(const uint8_t& xpos_percent);
|
||||
///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen
|
||||
|
@@ -74,8 +74,8 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w,
|
||||
//CComponents
|
||||
x = x_old = x_pos;
|
||||
y = y_old = y_pos;
|
||||
width = dx = dxc = w;
|
||||
height = dy = dyc = h;
|
||||
width = width_old = dx = dxc = w;
|
||||
height = height_old = dy = dyc = h;
|
||||
pic_name = pic_name_old = image_name;
|
||||
shadow = shadow_mode;
|
||||
shadow_w = OFFSET_SHADOW;
|
||||
@@ -148,6 +148,24 @@ void CComponentsPicture::setHeight(const int& h, bool keep_aspect)
|
||||
initCCItem();
|
||||
}
|
||||
|
||||
void CComponentsPicture::setXPos(const int& xpos)
|
||||
{
|
||||
CComponentsItem::setXPos(xpos);
|
||||
if (xpos == x)
|
||||
return;
|
||||
need_init = true;
|
||||
initCCItem();
|
||||
}
|
||||
|
||||
void CComponentsPicture::setYPos(const int& ypos)
|
||||
{
|
||||
CComponentsItem::setYPos(ypos);
|
||||
if (ypos == y)
|
||||
return;
|
||||
need_init = true;
|
||||
initCCItem();
|
||||
}
|
||||
|
||||
void CComponentsPicture::initCCItem()
|
||||
{
|
||||
if (pic_name.empty() || !need_init){
|
||||
@@ -385,6 +403,7 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p
|
||||
|
||||
void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale)
|
||||
{
|
||||
cc_item_type = CC_ITEMTYPE_CHANNEL_LOGO;
|
||||
channel_name = "";
|
||||
channel_id = 0;
|
||||
alt_pic_name = "";
|
||||
@@ -415,6 +434,8 @@ void CComponentsChannelLogo::setAltLogo(const char* picture_name)
|
||||
void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName)
|
||||
{
|
||||
need_init = true;
|
||||
string image = pic_name;
|
||||
|
||||
if (channelId || !channelName.empty()){
|
||||
if ((channel_id == channelId) && (channel_name == channelName))
|
||||
need_init = false;
|
||||
@@ -425,16 +446,16 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st
|
||||
|
||||
int dummy;
|
||||
|
||||
has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &dummy, &dummy);
|
||||
has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy);
|
||||
|
||||
if (!has_logo)//no logo was found, use altrenate icon or logo
|
||||
pic_name = alt_pic_name;
|
||||
image = alt_pic_name;
|
||||
|
||||
//if logo or alternate image still not available, set has logo to false
|
||||
has_logo = !pic_name.empty();
|
||||
has_logo = !image.empty();
|
||||
|
||||
//refresh object
|
||||
initCCItem();
|
||||
setPicture(image);
|
||||
|
||||
//set has_logo to false if no dimensions were detected
|
||||
if (width && height)
|
||||
|
@@ -162,6 +162,11 @@ class CComponentsPicture : public CComponentsItem
|
||||
///set height of object and image related to current screen size, see also CComponentsItem::setHeightP(), parameter as uint8_t
|
||||
virtual void setHeightP(const uint8_t& h_percent){CComponentsItem::setHeightP(h_percent), do_scale = true; need_init = hasChanges(); initCCItem();}
|
||||
|
||||
///set screen x-position, parameter as int
|
||||
virtual void setXPos(const int& xpos);
|
||||
///set screen y-position, parameter as int
|
||||
virtual void setYPos(const int& ypos);
|
||||
|
||||
///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself.
|
||||
virtual inline bool isPicPainted(){return is_image_painted;};
|
||||
|
||||
|
@@ -64,7 +64,7 @@ void CComponentsTimer::runSharedTimerAction()
|
||||
tm_mutex.lock();
|
||||
OnTimer();
|
||||
if (!tm_enable_nano)
|
||||
mySleep(tm_interval);
|
||||
sleep(tm_interval);
|
||||
else
|
||||
usleep((useconds_t)tm_interval);
|
||||
tm_mutex.unlock();
|
||||
|
@@ -41,6 +41,7 @@ typedef enum
|
||||
CC_ITEMTYPE_GENERIC,
|
||||
CC_ITEMTYPE_ITEM,
|
||||
CC_ITEMTYPE_PICTURE,
|
||||
CC_ITEMTYPE_CHANNEL_LOGO,
|
||||
CC_ITEMTYPE_TEXT,
|
||||
CC_ITEMTYPE_TEXT_INFOBOX,
|
||||
CC_ITEMTYPE_SHAPE_SQUARE,
|
||||
|
Reference in New Issue
Block a user