[SPARK] cVideo::ShowPicture: add optional argument for destination m2v

Origin commit data
------------------
Branch: master
Commit: 1756351a36
Author: martii <m4rtii@gmx.de>
Date: 2013-09-06 (Fri, 06 Sep 2013)


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

------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-09-06 22:23:22 +02:00
parent 896b39aff9
commit 5241080670
4 changed files with 23 additions and 19 deletions

View File

@@ -380,7 +380,7 @@ void cVideo::SetVideoMode(analog_mode_t mode)
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
}
void cVideo::ShowPicture(const char * fname)
void cVideo::ShowPicture(const char * fname, const char *_destname)
{
lt_debug("%s(%s)\n", __func__, fname);
char destname[512];
@@ -398,22 +398,26 @@ void cVideo::ShowPicture(const char * fname)
if (lastDot && !strcasecmp(lastDot + 1, "m2v"))
strncpy(destname, fname, sizeof(destname));
else {
strcpy(destname, "/var/cache");
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
if (_destname)
strncpy(destname, _destname, sizeof(destname));
else {
strcpy(destname, "/var/cache");
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
}
mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
/var/cache/share.tuxbox.neutrino.icons.radiomode.jpg.m2v
build that filename first...
TODO: this could cause name clashes, use a hashing function instead... */
strcat(destname, fname);
p = &destname[strlen("/var/cache/")];
while ((p = strchr(p, '/')) != NULL)
*p = '.';
strcat(destname, ".m2v");
}
mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
/var/cache/share.tuxbox.neutrino.icons.radiomode.jpg.m2v
build that filename first...
TODO: this could cause name clashes, use a hashing function instead... */
strcat(destname, fname);
p = &destname[strlen("/var/cache/")];
while ((p = strchr(p, '/')) != NULL)
*p = '.';
strcat(destname, ".m2v");
/* ...then check if it exists already... */
if (stat(destname, &st) || (st.st_mtime != st2.st_mtime) || (st.st_size == 0))
{