* Fork request handling for resized images.

This commit is contained in:
Justin Maggard 2009-03-16 18:43:42 +00:00
parent a62cceda99
commit f04296de38

View File

@ -1119,19 +1119,24 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
char *path, *file_path; char *path, *file_path;
char *resolution, *tn; char *resolution, *tn;
char *key, *val; char *key, *val;
char *saveptr, *item; char *saveptr, *item = NULL;
char *pixelshape = NULL; char *pixelshape = NULL;
int rows=0, ret; int rows=0, ret;
gdImagePtr imsrc = 0, imdst = 0; gdImagePtr imsrc = 0, imdst = 0;
ExifData *ed; ExifData *ed;
ExifLoader *l; ExifLoader *l;
#if USE_FORK
pid_t newpid = 0;
newpid = fork();
if( newpid )
return;
#endif
memset(header, 0, 1500); memset(header, 0, 1500);
path = strdup(object); path = strdup(object);
if( strtok_r(path, "?", &saveptr) ) if( strtok_r(path, "?", &saveptr) )
{ {
item = strtok_r(NULL, "&", &saveptr); item = strtok_r(NULL, "&", &saveptr);
//continue;
} }
while( item != NULL ) while( item != NULL )
{ {
@ -1234,8 +1239,9 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
#else #else
gdImageCopyResampled(imdst, imsrc, 0, 0, 0, 0, dstw, dsth, imsrc->sx, imsrc->sy); gdImageCopyResampled(imdst, imsrc, 0, 0, 0, 0, dstw, dsth, imsrc->sx, imsrc->sy);
#endif #endif
#endif #else
boxfilter_resize(imdst, imsrc, 0, 0, 0, 0, dstw, dsth, imsrc->sx, imsrc->sy); boxfilter_resize(imdst, imsrc, 0, 0, 0, 0, dstw, dsth, imsrc->sx, imsrc->sy);
#endif
data = (char *)gdImageJpegPtr(imdst, &size, 99); data = (char *)gdImageJpegPtr(imdst, &size, 99);
DPRINTF(E_INFO, L_HTTP, "size: %d\n", size); DPRINTF(E_INFO, L_HTTP, "size: %d\n", size);
strftime(date, 30,"%a, %d %b %Y %H:%M:%S GMT" , gmtime(&curtime)); strftime(date, 30,"%a, %d %b %Y %H:%M:%S GMT" , gmtime(&curtime));
@ -1268,6 +1274,9 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
gdImageDestroy(imdst); gdImageDestroy(imdst);
DPRINTF(E_INFO, L_HTTP, "Done serving %s\n", file_path); DPRINTF(E_INFO, L_HTTP, "Done serving %s\n", file_path);
sqlite3_free_table(result); sqlite3_free_table(result);
#if USE_FORK
_exit(0);
#endif
} }
void void