From 4c4485d2254c217dcb799f8043b0f521b04b520a Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Tue, 16 Jan 2018 17:38:37 -0800 Subject: [PATCH] upnpsoap: Only return sec:dcmInfo with a bookmark There's no point in returning bookmark info without a bookmark. It also has been reported that certain Samsung models may have issues with subtitles if we send dcmInfo data. So we'll only return it if we have a bookmark set. [minidlna:support-requests] #52 External srt subtitles for Samsung UA48JU7800 --- upnpsoap.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/upnpsoap.c b/upnpsoap.c index a41e6a6..f8ccb9d 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -99,8 +99,9 @@ * 800-899 TBD Action-specific errors for non-standard actions. * Defined by UPnP vendor. */ +#define SoapError(x,y,z) _SoapError(x,y,z,__func__) static void -SoapError(struct upnphttp * h, int errCode, const char * errDesc) +_SoapError(struct upnphttp * h, int errCode, const char * errDesc, const char *func) { static const char resp[] = "filter & FILTER_BOOKMARK_MASK) ) { /* Get bookmark */ int sec = sql_get_int_field(db, "SELECT SEC from BOOKMARKS where ID = '%s'", detailID); - if( sec > 0 && (passed_args->filter & FILTER_UPNP_LASTPLAYBACKPOSITION) ) { + if( sec > 0 ) { /* This format is wrong according to the UPnP/AV spec. It should be in duration format, ** so HH:MM:SS. But Kodi seems to be the only user of this tag, and it only works with a ** raw seconds value. ** If Kodi gets fixed, we can use duration_str(sec * 1000) here */ - ret = strcatf(str, "<upnp:lastPlaybackPosition>%d</upnp:lastPlaybackPosition>", - sec); + if( passed_args->filter & FILTER_UPNP_LASTPLAYBACKPOSITION ) + ret = strcatf(str, "<upnp:lastPlaybackPosition>%d</upnp:lastPlaybackPosition>", + sec); + if( passed_args->filter & FILTER_SEC_DCM_INFO ) + ret = strcatf(str, "<sec:dcmInfo>CREATIONDATE=0,FOLDER=%s,BM=%d</sec:dcmInfo>", + title, sec); } - if( passed_args->filter & FILTER_SEC_DCM_INFO ) - ret = strcatf(str, "<sec:dcmInfo>CREATIONDATE=0,FOLDER=%s,BM=%d</sec:dcmInfo>", - title, sec); if( passed_args->filter & FILTER_UPNP_PLAYBACKCOUNT ) { ret = strcatf(str, "<upnp:playbackCount>%d</upnp:playbackCount>", sql_get_int_field(db, "SELECT WATCH_COUNT from BOOKMARKS where ID = '%s'", detailID));