From 55a5bfe7409677a26437651798abbc6d87b56089 Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Mon, 14 Oct 2024 21:33:40 +0300 Subject: View Album Art from WPS context menu Add ability to imageviewer to view current track embedded/folder album art Add "View Album Art" WPS context menu item Change-Id: I49caebd38e5e3e2910d418bbeaa5e51da0e6bd93 --- apps/plugins/imageviewer/ppm/ppm.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'apps/plugins/imageviewer/ppm') diff --git a/apps/plugins/imageviewer/ppm/ppm.c b/apps/plugins/imageviewer/ppm/ppm.c index 5e03f8c335..6f59b1f6b0 100644 --- a/apps/plugins/imageviewer/ppm/ppm.c +++ b/apps/plugins/imageviewer/ppm/ppm.c @@ -75,7 +75,8 @@ static int img_mem(int ds) } static int load_image(char *filename, struct image_info *info, - unsigned char *buf, ssize_t *buf_size) + unsigned char *buf, ssize_t *buf_size, + int offset, int filesize) { int fd; int rc = PLUGIN_OK; @@ -83,7 +84,7 @@ static int load_image(char *filename, struct image_info *info, int w, h; /* used to center output */ unsigned char *memory, *memory_max; - size_t memory_size, file_size; + size_t memory_size; /* cleanup */ memset(&disp, 0, sizeof(disp)); @@ -100,13 +101,20 @@ static int load_image(char *filename, struct image_info *info, return PLUGIN_ERROR; } - file_size = rb->filesize(fd); + if (offset) + { + rb->lseek(fd, offset, SEEK_SET); + } + else + { + filesize = rb->filesize(fd); + } DEBUGF("reading file '%s'\n", filename); if (!iv->running_slideshow) { rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1); - rb->lcd_putsf(0, 1, "loading %zu bytes", file_size); + rb->lcd_putsf(0, 1, "loading %zu bytes", filesize); rb->lcd_update(); } -- cgit v1.2.3