From e0e0fa254dd26e3ff6d0c4c9367fea2e66251bf6 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Thu, 28 Apr 2011 23:01:28 +0000 Subject: [PATCH] * Fix a couple minor DLNA correctness issues. --- metadata.c | 3 ++- upnpglobalvars.h | 19 +++++++++---------- upnphttp.c | 2 +- upnpsoap.c | 23 +++++++++++------------ 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/metadata.c b/metadata.c index 41b61a3..0b7ec5c 100644 --- a/metadata.c +++ b/metadata.c @@ -1034,7 +1034,8 @@ GetVideoMetadata(const char * path, char * name) ts = ctx->priv_data; if( ts->packet_size == 192 ) { - if( dlna_timestamp_is_present(path) ) + if( vc->profile == FF_PROFILE_H264_HIGH || + dlna_timestamp_is_present(path) ) ts_timestamp = VALID; else ts_timestamp = EMPTY; diff --git a/upnpglobalvars.h b/upnpglobalvars.h index bfcef05..9f41154 100644 --- a/upnpglobalvars.h +++ b/upnpglobalvars.h @@ -87,7 +87,6 @@ "http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_MED;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_LRG;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ - "http-get:*:video/mpeg:DLNA.ORG_PN=AVC_TS_HP_HD_AC3;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:video/mpeg:DLNA.ORG_PN=AVC_TS_HP_HD_AC3_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:video/mpeg:DLNA.ORG_PN=AVC_TS_MP_HD_AAC_MULT5;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:video/mpeg:DLNA.ORG_PN=AVC_TS_MP_HD_AAC_MULT5_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ @@ -142,15 +141,15 @@ "http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVHIGH_PRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:video/3gpp:DLNA.ORG_PN=MPEG4_P2_3GPP_SP_L0B_AAC;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:video/3gpp:DLNA.ORG_PN=MPEG4_P2_3GPP_SP_L0B_AMR;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ - "http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01," \ - "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE;DLNA.ORG_OP=01," \ - "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAFULL;DLNA.ORG_OP=01," \ - "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAPRO;DLNA.ORG_OP=01," \ - "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01," \ - "http-get:*:audio/3gpp:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01," \ - "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO;DLNA.ORG_OP=01," \ - "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_MULT5_ISO;DLNA.ORG_OP=01," \ - "http-get:*:audio/L16;rate=44100;channels=2:DLNA.ORG_PN=LPCM;DLNA.ORG_OP=01," \ + "http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAFULL;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAPRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/3gpp:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_MULT5_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/L16;rate=44100;channels=2:DLNA.ORG_PN=LPCM;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:image/jpeg:*," \ "http-get:*:video/avi:*," \ "http-get:*:video/divx:*," \ diff --git a/upnphttp.c b/upnphttp.c index 21a42d8..d33b2fe 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -1696,7 +1696,7 @@ SendResp_dlnafile(struct upnphttp * h, char * object) off_t total, offset, size; sqlite_int64 id; int sendfh; - static struct { sqlite_int64 id; char path[PATH_MAX]; char mime[32]; char dlna[64]; } last_file = { 0 }; + static struct { sqlite_int64 id; char path[PATH_MAX]; char mime[32]; char dlna[96]; } last_file = { 0 }; #if USE_FORK pid_t newpid = 0; #endif diff --git a/upnpsoap.c b/upnpsoap.c index 6cbff1c..7fb69d0 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -769,13 +769,13 @@ callback(void *args, int argc, char **argv, char **azColName) passed_args->size += ret; } if( artist ) { - if( (*mime == 'a') && (passed_args->filter & FILTER_UPNP_ARTIST) ) { - ret = snprintf(str_buf, 512, "<upnp:artist>%s</upnp:artist>", artist); + if( (*mime == 'v') && (passed_args->filter & FILTER_UPNP_ACTOR) ) { + ret = snprintf(str_buf, 512, "<upnp:actor>%s</upnp:actor>", artist); memcpy(passed_args->resp+passed_args->size, &str_buf, ret+1); passed_args->size += ret; } - else if( (*mime == 'v') && (passed_args->filter & FILTER_UPNP_ACTOR) ) { - ret = snprintf(str_buf, 512, "<upnp:actor>%s</upnp:actor>", artist); + if( passed_args->filter & FILTER_UPNP_ARTIST ) { + ret = snprintf(str_buf, 512, "<upnp:artist>%s</upnp:artist>", artist); memcpy(passed_args->resp+passed_args->size, &str_buf, ret+1); passed_args->size += ret; } @@ -1321,13 +1321,14 @@ SearchContentDirectory(struct upnphttp * h, const char * action) groupBy[0] = '\0'; if( !SearchCriteria ) { - asprintf(&newSearchCriteria, "1 = 1"); + newSearchCriteria = strdup("1 = 1"); SearchCriteria = newSearchCriteria; } else { SearchCriteria = modifyString(SearchCriteria, """, "\"", 0); SearchCriteria = modifyString(SearchCriteria, "'", "'", 0); + SearchCriteria = modifyString(SearchCriteria, "\\\"", "\"\"", 0); SearchCriteria = modifyString(SearchCriteria, "object.", "", 0); SearchCriteria = modifyString(SearchCriteria, "derivedfrom", "like", 1); SearchCriteria = modifyString(SearchCriteria, "contains", "like", 2); @@ -1343,16 +1344,14 @@ SearchContentDirectory(struct upnphttp * h, const char * action) SearchCriteria = modifyString(SearchCriteria, "@refID", "REF_ID", 0); if( strstr(SearchCriteria, "@id") ) { - newSearchCriteria = modifyString(strdup(SearchCriteria), "@id", "OBJECT_ID", 0); - SearchCriteria = newSearchCriteria; + newSearchCriteria = strdup(SearchCriteria); + newSearchCriteria = SearchCriteria = modifyString(newSearchCriteria, "@id", "OBJECT_ID", 0); } if( strstr(SearchCriteria, "res is ") ) { - if( newSearchCriteria ) - newSearchCriteria = modifyString(newSearchCriteria, "res is ", "MIME is ", 0); - else - newSearchCriteria = modifyString(strdup(SearchCriteria), "res is ", "MIME is ", 0); - SearchCriteria = newSearchCriteria; + if( !newSearchCriteria ) + newSearchCriteria = strdup(SearchCriteria); + newSearchCriteria = SearchCriteria = modifyString(newSearchCriteria, "res is ", "MIME is ", 0); } #if 0 // Does 360 need this? if( strstr(SearchCriteria, "&") )