* Fix some possible memory leaks.

* Pay attention to the specified port number.
* Add support for multiple media directories, and allow content filtering on the directories.
This commit is contained in:
Justin Maggard
2009-02-03 03:36:59 +00:00
parent 3f454a5762
commit 0324818d86
11 changed files with 281 additions and 137 deletions

View File

@ -270,10 +270,10 @@ static int callback(void *args, int argc, char **argv, char **azColName)
}
if( album_art && atoi(album_art) && (!passed_args->filter || strstr(passed_args->filter, "upnp:albumArtURI")) ) {
sprintf(str_buf, "<upnp:albumArtURI %s"
">http://%s:5555/AlbumArt/%s.jpg</upnp:albumArtURI>",
">http://%s:%d/AlbumArt/%s.jpg</upnp:albumArtURI>",
(!passed_args->filter || strstr(passed_args->filter, "upnp:albumArtURI@dlna:profileID")) ?
"dlna:profileID=\"JPEG_TN\" xmlns:dlna=\"urn:schemas-dlnaorg:metadata-1-0/\"" : "",
lan_addr[0].str, album_art);
lan_addr[0].str, runtime_vars.port, album_art);
strcat(passed_args->resp, str_buf);
}
if( !passed_args->filter || strstr(passed_args->filter, "res") ) {
@ -303,26 +303,26 @@ static int callback(void *args, int argc, char **argv, char **azColName)
strcat(passed_args->resp, str_buf);
}
sprintf(str_buf, "protocolInfo=\"http-get:*:%s:%s\">"
"http://%s:5555/MediaItems/%s.dat"
"http://%s:%d/MediaItems/%s.dat"
"</res>",
mime, dlna_buf, lan_addr[0].str, detailID);
mime, dlna_buf, lan_addr[0].str, runtime_vars.port, detailID);
#if 0 //JPEG_RESIZE
if( dlna_pn && (strncmp(dlna_pn, "JPEG_LRG", 8) == 0) ) {
strcat(passed_args->resp, str_buf);
sprintf(str_buf, "<res "
"protocolInfo=\"http-get:*:%s:%s\">"
"http://%s:5555/Resized/%s"
"http://%s:%d/Resized/%s"
"</res>",
mime, "DLNA.ORG_PN=JPEG_SM", lan_addr[0].str, id);
mime, "DLNA.ORG_PN=JPEG_SM", lan_addr[0].str, runtime_vars.port, id);
}
#endif
if( tn && atoi(tn) && dlna_pn ) {
strcat(passed_args->resp, str_buf);
strcat(passed_args->resp, "<res ");
sprintf(str_buf, "protocolInfo=\"http-get:*:%s:%s\">"
"http://%s:5555/Thumbnails/%s.dat"
"http://%s:%d/Thumbnails/%s.dat"
"</res>",
mime, "DLNA.ORG_PN=JPEG_TN", lan_addr[0].str, detailID);
mime, "DLNA.ORG_PN=JPEG_TN", lan_addr[0].str, runtime_vars.port, detailID);
}
strcat(passed_args->resp, str_buf);
}
@ -369,7 +369,7 @@ static int callback(void *args, int argc, char **argv, char **azColName)
}
if( album_art && atoi(album_art) && (!passed_args->filter || strstr(passed_args->filter, "upnp:albumArtURI")) ) {
sprintf(str_buf, "<upnp:albumArtURI dlna:profileID=\"JPEG_TN\" xmlns:dlna=\"urn:schemas-dlnaorg:metadata-1-0/\""
">http://%s:5555/AlbumArt/%s.jpg</upnp:albumArtURI>", lan_addr[0].str, album_art);
">http://%s:%d/AlbumArt/%s.jpg</upnp:albumArtURI>", lan_addr[0].str, runtime_vars.port, album_art);
strcat(passed_args->resp, str_buf);
}
sprintf(str_buf, "</container>");