lcd4l: use GetLogoName() function from pictureviewer

Origin commit data
------------------
Branch: ni/coolstream
Commit: 3db180f75b
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-12-18 (Tue, 18 Dec 2018)

Origin message was:
------------------
- lcd4l: use GetLogoName() function from pictureviewer

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2018-12-18 00:19:35 +01:00
parent e5378d2eaa
commit 71131e125f
2 changed files with 7 additions and 48 deletions

View File

@@ -49,6 +49,7 @@
#include <zapit/capmt.h>
#include <zapit/zapit.h>
#include <gui/movieplayer.h>
#include <gui/pictureviewer.h>
#include <eitd/sectionsd.h>
#include <video.h>
@@ -56,6 +57,7 @@
extern CRemoteControl *g_RemoteControl;
extern cVideo *videoDecoder;
extern CPictureViewer *g_PicViewer;
#define LCD_DATADIR "/tmp/lcd/"
@@ -538,6 +540,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
std::string Service = "";
int ChannelNr = 0;
std::string Logo = LOGO_DUMMY;
int dummy;
int ModeLogo = 0;
int ModeStandby = 0;
@@ -549,7 +552,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
else
Service = g_RemoteControl->getCurrentChannelName();
GetLogoName(parseID, Service, Logo);
g_PicViewer->GetLogoName(parseID, Service, Logo, &dummy, &dummy, true);
ChannelNr = CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber();
}
@@ -612,9 +615,9 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
case 3: /* play */
if (ModeTshift && CMoviePlayerGui::getInstance().p_movie_info) /* show channel-logo */
{
if (!GetLogoName(CMoviePlayerGui::getInstance().p_movie_info->channelId,
CMoviePlayerGui::getInstance().p_movie_info->channelName,
Logo))
if (!g_PicViewer->GetLogoName(CMoviePlayerGui::getInstance().p_movie_info->channelId,
CMoviePlayerGui::getInstance().p_movie_info->channelName,
Logo, &dummy, &dummy, true))
Logo = ICONSDIR "/" NEUTRINO_ICON_PLAY ICONSEXT;
}
else /* show play-icon */
@@ -1030,46 +1033,3 @@ std::string CLCD4l::hexStr(unsigned char* data)
ss << std::setw(2) << std::setfill('0') << (int)data[i];
return ss.str();
}
bool CLCD4l::GetLogoName(uint64_t channel_id, std::string channel_name, std::string &logo)
{
int h, i, j;
char str_channel_id[16];
char *upper_name, *lower_name, *p;
upper_name = strdup(channel_name.c_str());
for (p = upper_name; *p != '\0'; p++)
*p = (char) toupper(*p);
lower_name = strdup(channel_name.c_str());
for (p = lower_name; *p != '\0'; p++)
*p = (char) tolower(*p);
sprintf(str_channel_id, "%llx", channel_id & 0xFFFFFFFFFFFFULL);
// the directorys to search in
std::string strLogoDir[4] = { g_settings.lcd4l_logodir, LOGODIR_VAR, LOGODIR, g_settings.logo_hdd_dir };
// first the channelname, then the upper channelname, then the lower channelname, then the channel-id
std::string strLogoName[4] = { channel_name, (std::string)upper_name, (std::string)lower_name, (std::string)str_channel_id };
// first png, then jpg, then gif
std::string strLogoExt[3] = { ".png", ".jpg", ".gif" };
//printf("[CLCD4l] %s: ID: %s, Name: %s (u: %s, l: %s)\n", __FUNCTION__, str_channel_id, channel_name.c_str(), upper_name, lower_name);
for (h = 0; h < 4; h++)
{
for (i = 0; i < 4; i++)
{
for (j = 0; j < 3; j++)
{
std::string tmp(strLogoDir[h] + "/" + strLogoName[i] + strLogoExt[j]);
if (access(tmp.c_str(), R_OK) != -1)
{
logo = tmp;
return true;
}
}
}
}
return false;
}

View File

@@ -66,7 +66,6 @@ class CLCD4l
uint64_t GetParseID();
bool CompareParseID(uint64_t &i_ParseID);
bool GetLogoName(uint64_t channel_id, std::string channel_name, std::string & logo);
std::string hexStr(unsigned char* data);
void strReplace(std::string &orig, const std::string &fstr, const std::string &rstr);