int s_YX_CD_GetMinfoByUri (char *uri, IXML_NodeList *reslist, int len, char **protocolInfo, t_MEDIA_INFO *mInfo) { char *transport, *mimetype, *dlna; int i; HT_DBG_FUNC_START(HT_MOD_DMC, HT_BIT_MANY,len,0); for (i = 0; i < len; i++) { IXML_Node *res = ixmlNodeList_item (reslist, i); IXML_Element*element = (IXML_Element*)res; const char* protocol = ixmlElement_getAttribute (element, "protocolInfo"); const char* url = XMLUtil_GetElementValue (element); if (uri == NULL || protocol == NULL || !s_YX_CD_CheckInfo(protocol, &dup_protocol, &transport, &mimetype, &dlna)) continue; if( strcmp(uri, url) == 0 ) { s_CD_CreateMediaInfo(mimetype, element, dlna, mInfo); if(protocolInfo) *protocolInfo = Dlna_strdup(protocol); HT_DBG_FUNC_END(i, 0); return i; } } HT_DBG_FUNC_END(-1, 0); return -1; }
int YX_CD_GetBestMediaInfo(char *dms_ip, char *metadata, t_MEDIA_INFO *minfo) { char *dup_protocol, *transport, *mimetype, *dlna; IXML_Node *node=NULL; int ret = -1; if(!dms_ip || !metadata || !minfo) return -2; ret = s_CD_GetBestRes(dms_ip, metadata, &node); if(node) { IXML_Element*element = (IXML_Element*)node; const char* protocol = ixmlElement_getAttribute (element, "protocolInfo"); const char* uri = XMLUtil_GetElementValue (element); if (uri && protocol && s_YX_CD_CheckInfo(protocol, &dup_protocol, &transport, &mimetype, &dlna)) { s_CD_CreateMediaInfo(mimetype, element, dlna, minfo); free(dup_protocol); ret = 0; } ixmlNode_free(node); } return ret; }
/****************************************************************************** * XMLUtil_FindFirstElementValue *****************************************************************************/ const char* XMLUtil_FindFirstElementValue (const IXML_Node* const node, const char* const tagname, bool const deep, bool const log_error) { IXML_Element* element = XMLUtil_FindFirstElement (node, tagname, deep, log_error); return (element ? XMLUtil_GetElementValue (element) : NULL); }
char *YX_CD_GetThumbnailForImage (pClassContentDirectory me, IXML_NodeList *reslist, int len, int max_w, int max_h) { char *dup_protocol, *transport, *mimetype, *dlna; int i, index=-1; HT_DBG_FUNC_START(HT_MOD_DMC, HT_BIT_MANY, len, 0); for (i = 0; i < len; i++) { IXML_Node *res = ixmlNodeList_item (reslist, i); IXML_Element*element = (IXML_Element*)res; const char* protocol = ixmlElement_getAttribute (element, "protocolInfo"); const char* uri = XMLUtil_GetElementValue (element); // if (uri == NULL || protocol == NULL ||sscanf (protocol, "http-get:*:%63[^:]", mimetype) != 1) if (uri == NULL || protocol == NULL || !s_YX_CD_CheckInfo(protocol, &dup_protocol, &transport, &mimetype, &dlna)) continue; if( strstr(transport, "http-get") ) { if( s_YX_CD_IpMatched(me,uri )) { t_MEDIA_INFO info; s_CD_CreateMediaInfo(mimetype, element, dlna, &info); int w = info.resWidth; int h = info.resHeight; if( w>0 && w<max_w && h>0 && h<max_h ) { max_w = w; max_h = h; index = i; } } } free(dup_protocol); } if( index != -1 ) { HT_DBG_FUNC(index, NULL); return Dlna_strdup( XMLUtil_GetElementValue( (IXML_Element*)(ixmlNodeList_item (reslist, index)) ) ); } return NULL; }
int YX_CD_GetPreferred (pClassContentDirectory me, IXML_NodeList *reslist, int len, char **protocolInfo, char **url, t_MEDIA_INFO *mInfo) { char *dup_protocol, *transport, *mimetype, *dlna; int i; HT_DBG_FUNC_START(HT_MOD_DMC, HT_BIT_MYRIAD,len,0); for (i = 0; i < len; i++) { IXML_Node *res = ixmlNodeList_item (reslist, i); IXML_Element*element = (IXML_Element*)res; const char* protocol = ixmlElement_getAttribute (element, "protocolInfo"); const char* uri = XMLUtil_GetElementValue (element); // if (uri == NULL || protocol == NULL ||sscanf (protocol, "http-get:*:%63[^:]", mimetype) != 1) HT_DBG_FUNC(i, protocol); if (uri == NULL || protocol == NULL || !s_YX_CD_CheckInfo(protocol, &dup_protocol, &transport, &mimetype, &dlna)) continue; if( strstr(transport, "http-get") ) { if( s_YX_CD_IpMatched(me,uri )) { t_MEDIA_INFO info; s_CD_CreateMediaInfo(mimetype, element, dlna, &info); if( info.dlnaCI == 0 ) //raw media file { if(protocolInfo) { *protocolInfo = Dlna_strdup(protocol); } if(url) { *url = Dlna_strdup(uri); } if(mInfo) memcpy(mInfo, &info, sizeof(t_MEDIA_INFO)); HT_DBG_FUNC_END(i, 0); free(dup_protocol); return i; } } } else { } free(dup_protocol); } return -1; }
int YX_CD_GetBestUri (char *dms_ip, char *metadata, char **uri) { IXML_Node *node=NULL; int ret = -1; if(!dms_ip || !metadata || !uri) return -2; ret = s_CD_GetBestRes(dms_ip, metadata, &node); if(node) { IXML_Element*element = (IXML_Element*)node; const char* str = XMLUtil_GetElementValue (element); *uri=Dlna_strdup(str); ixmlNode_free(node); ret = 0; } return ret; }
char *YX_CD_GetThumbnailForVideo (pClassContentDirectory me, IXML_NodeList *reslist, int len) { char *dup_protocol, *transport, *mimetype, *dlna; int i; HT_DBG_FUNC_START(HT_MOD_DMC, HT_BIT_MANY, len, 0); for (i = 0; i < len; i++) { IXML_Node *res = ixmlNodeList_item (reslist, i); IXML_Element*element = (IXML_Element*)res; const char* protocol = ixmlElement_getAttribute (element, "protocolInfo"); const char* uri = XMLUtil_GetElementValue (element); // if (uri == NULL || protocol == NULL ||sscanf (protocol, "http-get:*:%63[^:]", mimetype) != 1) if (uri == NULL || protocol == NULL || !s_YX_CD_CheckInfo(protocol, &dup_protocol, &transport, &mimetype, &dlna)) continue; if( strstr(transport, "http-get") ) { if( s_YX_CD_IpMatched(me,uri )) { t_MEDIA_INFO info; s_CD_CreateMediaInfo(mimetype, element, dlna, &info); //if( strcmp(info.majorType, "image") ==0 ) if( info.majorType == 3 ) { HT_DBG_FUNC(0, uri); free(dup_protocol); return Dlna_strdup(uri); } } } free(dup_protocol); } return NULL; }
static IXML_Node* s_CD_GetWantedRes(char *dms_ip, IXML_NodeList *reslist, char *method, char *option) { char *dup_protocol, *transport, *mimetype, *dlna; int i, len; IXML_Node *ret = NULL; if(!dms_ip || !reslist || !method || !option) return ret; len = ixmlNodeList_length(reslist); HT_DBG_FUNC_START(HT_MOD_DMC, HT_BIT_MANY,len,0); for (i = 0; i < len; i++) { IXML_Node *res = ixmlNodeList_item (reslist, i); IXML_Element*element = (IXML_Element*)res; const char* protocol = ixmlElement_getAttribute (element, "protocolInfo"); const char* uri = XMLUtil_GetElementValue (element); HT_DBG_FUNC(i, protocol); if (uri == NULL || protocol == NULL || !s_YX_CD_CheckInfo(protocol, &dup_protocol, &transport, &mimetype, &dlna)) continue; if(strstr(transport, method) && s_CD_IpMatched_Ex(dms_ip, uri) ) { if( !strstr(dlna, "DLNA.ORG_CI=1") )//raw media file { ret = res; free(dup_protocol); break; } } free(dup_protocol); } HT_DBG_FUNC_END((int)ret, 0); return ret; }