diff --git a/generic-pc/video.cpp b/generic-pc/video.cpp index 7ec5055..ceb8c6d 100644 --- a/generic-pc/video.cpp +++ b/generic-pc/video.cpp @@ -211,7 +211,7 @@ void cVideo::SetVideoMode(analog_mode_t) { } -void cVideo::ShowPicture(const char *fname) +void cVideo::ShowPicture(const char *fname, const char *) { lt_info("%s(%s)\n", __func__, fname); if (access(fname, R_OK)) diff --git a/generic-pc/video_lib.h b/generic-pc/video_lib.h index d6edb32..97a3e23 100644 --- a/generic-pc/video_lib.h +++ b/generic-pc/video_lib.h @@ -180,7 +180,7 @@ class cVideo : public OpenThreads::Thread bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; }; void SetCECAutoView(bool) { return; }; void SetCECAutoStandby(bool) { return; }; - void ShowPicture(const char * fname); + void ShowPicture(const char * fname, const char *); void StopPicture(); void Standby(unsigned int bOn); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719); diff --git a/libspark/video.cpp b/libspark/video.cpp index 2572b79..de8b8b6 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -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)) { diff --git a/libspark/video_lib.h b/libspark/video_lib.h index 81955a7..8bfe177 100644 --- a/libspark/video_lib.h +++ b/libspark/video_lib.h @@ -186,7 +186,7 @@ class cVideo bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; }; void SetCECAutoView(bool) { return; }; void SetCECAutoStandby(bool) { return; }; - void ShowPicture(const char * fname); + void ShowPicture(const char * fname, const char *_destname = NULL); void StopPicture(); void Standby(unsigned int bOn); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719);