upnpttp: Implement PixelShape support.
TiVo uses this to get the aspect ratio correct on images.
This commit is contained in:
parent
9c5d8c7fd2
commit
30562d0b66
@ -76,7 +76,7 @@ _get_flctags(char *filename, struct song_metadata *psong)
|
|||||||
#if FLAC_API_VERSION_CURRENT >= 10
|
#if FLAC_API_VERSION_CURRENT >= 10
|
||||||
case FLAC__METADATA_TYPE_PICTURE:
|
case FLAC__METADATA_TYPE_PICTURE:
|
||||||
if (psong->image) {
|
if (psong->image) {
|
||||||
DPRINTF(E_INFO, L_SCANNER, "Ignoring additional image [%s]\n", filename);
|
DPRINTF(E_MAXDEBUG, L_SCANNER, "Ignoring additional image [%s]\n", filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
psong->image_size = block->data.picture.data_length;
|
psong->image_size = block->data.picture.data_length;
|
||||||
|
18
upnphttp.c
18
upnphttp.c
@ -1568,8 +1568,7 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
|
|||||||
char *key, *val;
|
char *key, *val;
|
||||||
char *saveptr, *item = NULL;
|
char *saveptr, *item = NULL;
|
||||||
int rotate;
|
int rotate;
|
||||||
/* Not implemented yet *
|
int pixw = 0, pixh = 0;
|
||||||
char *pixelshape=NULL; */
|
|
||||||
long long id;
|
long long id;
|
||||||
int rows=0, chunked, ret;
|
int rows=0, chunked, ret;
|
||||||
image_s *imsrc = NULL, *imdst = NULL;
|
image_s *imsrc = NULL, *imdst = NULL;
|
||||||
@ -1622,11 +1621,12 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
|
|||||||
rotate = (rotate + atoi(val)) % 360;
|
rotate = (rotate + atoi(val)) % 360;
|
||||||
sql_exec(db, "UPDATE DETAILS set ROTATION = %d where ID = %lld", rotate, id);
|
sql_exec(db, "UPDATE DETAILS set ROTATION = %d where ID = %lld", rotate, id);
|
||||||
}
|
}
|
||||||
/* Not implemented yet *
|
|
||||||
else if( strcasecmp(key, "pixelshape") == 0 )
|
else if( strcasecmp(key, "pixelshape") == 0 )
|
||||||
{
|
{
|
||||||
pixelshape = val;
|
ret = sscanf(val, "%d:%d", &pixw, &pixh);
|
||||||
} */
|
if( ret != 2 )
|
||||||
|
pixw = pixh = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_FORK
|
#if USE_FORK
|
||||||
@ -1680,6 +1680,14 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
|
|||||||
dsth = height;
|
dsth = height;
|
||||||
dstw = (((height<<10)/srch) * srcw>>10);
|
dstw = (((height<<10)/srch) * srcw>>10);
|
||||||
}
|
}
|
||||||
|
/* Account for pixel shape */
|
||||||
|
if( pixw && pixh )
|
||||||
|
{
|
||||||
|
if( pixh > pixw )
|
||||||
|
dsth = dsth * pixw / pixh;
|
||||||
|
else if( pixw > pixh )
|
||||||
|
dstw = dstw * pixh / pixw;
|
||||||
|
}
|
||||||
|
|
||||||
if( dstw <= 160 && dsth <= 160 )
|
if( dstw <= 160 && dsth <= 160 )
|
||||||
strcpy(dlna_pn, "DLNA.ORG_PN=JPEG_TN;");
|
strcpy(dlna_pn, "DLNA.ORG_PN=JPEG_TN;");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user