* Fix a couple errors in the rotation code.
This commit is contained in:
parent
8298a15490
commit
fe581c5e7f
@ -620,10 +620,10 @@ GetImageMetadata(const char * path, char * name)
|
|||||||
rotate = 180;
|
rotate = 180;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
rotate = 270;
|
rotate = 90;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
rotate = 90;
|
rotate = 270;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rotate = 0;
|
rotate = 0;
|
||||||
|
49
upnphttp.c
49
upnphttp.c
@ -1552,7 +1552,7 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
|
|||||||
char dlna_pn[4];
|
char dlna_pn[4];
|
||||||
time_t curtime = time(NULL);
|
time_t curtime = time(NULL);
|
||||||
int width=640, height=480, dstw, dsth, size;
|
int width=640, height=480, dstw, dsth, size;
|
||||||
long srcw, srch;
|
int srcw, srch;
|
||||||
unsigned char * data = NULL;
|
unsigned char * data = NULL;
|
||||||
char *path, *file_path;
|
char *path, *file_path;
|
||||||
char *resolution;
|
char *resolution;
|
||||||
@ -1636,9 +1636,31 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DPRINTF(E_INFO, L_HTTP, "Serving resized image for ObjectId: %lld [%s]\n", id, file_path);
|
DPRINTF(E_INFO, L_HTTP, "Serving resized image for ObjectId: %lld [%s]\n", id, file_path);
|
||||||
|
switch( rotate )
|
||||||
|
{
|
||||||
|
case 90:
|
||||||
|
ret = sscanf(resolution, "%dx%d", &srch, &srcw);
|
||||||
|
rotate = ROTATE_90;
|
||||||
|
break;
|
||||||
|
case 270:
|
||||||
|
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 */
|
/* Figure out the best destination resolution we can use */
|
||||||
srcw = strtol(resolution, &saveptr, 10);
|
|
||||||
srch = strtol(saveptr+1, NULL, 10);
|
|
||||||
dstw = width;
|
dstw = width;
|
||||||
dsth = ((((width<<10)/srcw)*srch)>>10);
|
dsth = ((((width<<10)/srcw)*srch)>>10);
|
||||||
if( dsth > height )
|
if( dsth > height )
|
||||||
@ -1646,27 +1668,6 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
|
|||||||
dsth = height;
|
dsth = height;
|
||||||
dstw = (((height<<10)/srch) * srcw>>10);
|
dstw = (((height<<10)/srch) * srcw>>10);
|
||||||
}
|
}
|
||||||
switch( rotate )
|
|
||||||
{
|
|
||||||
case 90:
|
|
||||||
rotate = dsth;
|
|
||||||
dsth = dstw;
|
|
||||||
dstw = rotate;
|
|
||||||
rotate = ROTATE_90;
|
|
||||||
break;
|
|
||||||
case 270:
|
|
||||||
rotate = dsth;
|
|
||||||
dsth = dstw;
|
|
||||||
dstw = rotate;
|
|
||||||
rotate = ROTATE_270;
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
rotate = ROTATE_180;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
rotate = ROTATE_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( dstw <= 640 && dsth <= 480 )
|
if( dstw <= 640 && dsth <= 480 )
|
||||||
strcpy(dlna_pn, "SM");
|
strcpy(dlna_pn, "SM");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user