Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforce.net>2012-01-23 22:51:48 +0400
committerJustin Maggard <jmaggard@users.sourceforce.net>2012-01-23 22:51:48 +0400
commit278709fc9f6299cfabe66683cf8d0aa30ca0e6c5 (patch)
tree62bba2e5b11c3659584cb76148572949bbff1fb0
parentd9399fb9feeac57f5c151a09b8534d3a7f434aa6 (diff)
* Fix a couple errors in the rotation code.
-rw-r--r--metadata.c4
-rw-r--r--upnphttp.c35
2 files changed, 20 insertions, 19 deletions
diff --git a/metadata.c b/metadata.c
index af376f4..71e4acf 100644
--- a/metadata.c
+++ b/metadata.c
@@ -620,10 +620,10 @@ GetImageMetadata(const char * path, char * name)
rotate = 180;
break;
case 6:
- rotate = 270;
+ rotate = 90;
break;
case 8:
- rotate = 90;
+ rotate = 270;
break;
default:
rotate = 0;
diff --git a/upnphttp.c b/upnphttp.c
index feb8f42..a53ee50 100644
--- a/upnphttp.c
+++ b/upnphttp.c
@@ -1552,7 +1552,7 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
char dlna_pn[4];
time_t curtime = time(NULL);
int width=640, height=480, dstw, dsth, size;
- long srcw, srch;
+ int srcw, srch;
unsigned char * data = NULL;
char *path, *file_path;
char *resolution;
@@ -1636,37 +1636,38 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
}
DPRINTF(E_INFO, L_HTTP, "Serving resized image for ObjectId: %lld [%s]\n", id, file_path);
- /* Figure out the best destination resolution we can use */
- srcw = strtol(resolution, &saveptr, 10);
- srch = strtol(saveptr+1, NULL, 10);
- dstw = width;
- dsth = ((((width<<10)/srcw)*srch)>>10);
- if( dsth > height )
- {
- dsth = height;
- dstw = (((height<<10)/srch) * srcw>>10);
- }
switch( rotate )
{
case 90:
- rotate = dsth;
- dsth = dstw;
- dstw = rotate;
+ ret = sscanf(resolution, "%dx%d", &srch, &srcw);
rotate = ROTATE_90;
break;
case 270:
- rotate = dsth;
- dsth = dstw;
- dstw = rotate;
+ ret = sscanf(resolution, "%dx%d", &srch, &srcw);
rotate = ROTATE_270;
break;
case 180:
+ ret = sscanf(resolution, "%dx%d", &srcw, &srch);
rotate = ROTATE_180;
break;
default:
+ ret = sscanf(resolution, "%dx%d", &srcw, &srch);
rotate = ROTATE_NONE;
break;
}
+ if( ret != 2 )
+ {
+ Send500(h);
+ return;
+ }
+ /* Figure out the best destination resolution we can use */
+ dstw = width;
+ dsth = ((((width<<10)/srcw)*srch)>>10);
+ if( dsth > height )
+ {
+ dsth = height;
+ dstw = (((height<<10)/srch) * srcw>>10);
+ }
if( dstw <= 640 && dsth <= 480 )
strcpy(dlna_pn, "SM");