Tuesday, August 10, 2004

UPnP Media Server : I am implementing the search action as follows. The following code doesn't support the priority logical operation using the brackets, but I could check Sony's UPnP AV player, TA-LV700R, with the search function.
bool SearchCriteriaList::compare(ContentNode *cnode, SearchCapList *searchCapList)

{
int n;
int searchCriCnt = size();
// Set compare result
for (n=0; n<searchCriCnt; n++) {
SearchCriteria *searchCri = getSearchCriteria(n);
const char *property = searchCri->getProperty();
SearchCap *searchCap = searchCapList->getSearchCap(property);
if (searchCap == NULL) {
searchCri->setResult(true);
continue;
}
bool cmpResult = searchCap->compare(searchCri, cnode);
searchCri->setResult(cmpResult);
}
// Eval only logical ADD operation at first;
SearchCriteriaList orSearchCriList;
for (n=0; n<searchCriCnt; n++) {
SearchCriteria *currSearchCri = getSearchCriteria(n);
if (n<(searchCriCnt-1)) {
if (currSearchCri->isLogicalAND() == true) {
SearchCriteria *nextSearchCri = getSearchCriteria(n+1);
bool currResult = currSearchCri->getResult();
bool nextResult = nextSearchCri->getResult();
bool logicalAND = (currResult & nextResult) ? true : false;
nextSearchCri->setResult(logicalAND);
continue;
}
}
SearchCriteria *orSearchCri = new SearchCriteria(currSearchCri);
orSearchCriList.add(orSearchCri);
}
// Eval logical OR operation;
int orSearchCriCnt = orSearchCriList.size();
for (n=0; n<orSearchCriCnt; n++) {
SearchCriteria *searchCri = getSearchCriteria(n);
if (searchCri->getResult() == true)
return true;
}
return false;
}

TA-LV700R : I checked the search function with the UPnP Media Player and the UPnP Media Server for MythTV using the code. At first, the player couldn't read the stream, but I could fix the problem to changed the mime type for the protocolInfo from */* to video/mpeg as follows. I can see the movie contents in the MythTV using the UPnP Media Player now :-)
POST /service/ContentDirectory_control HTTP/HTTP/1.1

HOST: 192.168.1.20:38520
CONTENT-LENGTH: 2007
CONTENT-TYPE: text/xml
SOAPACTION: "urn:schemas-upnp-org:service:ContentDirectory:1#Search"
X-AV-Client-Info: av = 2.0; cn = "Sony Corporation" ; mn = "RoomLink" ; mv = 1.0

<?xml version="1.0"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:Search xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
<ContainerID>0</ContainerID>
<SearchCriteria>
@id = "2" and
av:filmrollURI@av:codec = "CLUT8" and
av:filmrollURI@av:resolution = "80x60" and
av:filmrollURI@av:clutIndexOffset = "16" and
av:filmrollURI@av:clutNumIndex = "240" and
av:filmrollURI@av:clutData = "YrfiFLwDu.......7u4AddMMA"
</SearchCriteria>
<Filter>*</Filter>
<StartingIndex>0</StartingIndex>
<RequestedCount>1</RequestedCount>
<SortCriteria></SortCriteria>
</u:Search>
</s:Body>
</s:Envelope>

HTTP/1.0 200 OK
CONTENT-TYPE: text/xml; charset="utf-8"
SERVER: Linux/2.4.22-1.2197.nptl UPnP/1.0 CyberLink/1.4.2
EXT:
CONTENT-LENGTH: 1391

<?xml version="1.0" encoding="......" s:encodingStyle="......">
<s:Body>
<u:SearchResponse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
<Result>
<?xml version="1.0" encoding="utf-8"?>
<DIDL-Lite id="0" parentID="-1" restricted="1" xmlns="urn.....">
<item id="2" parentID="1" restricted="1">
<upnp:storageMedium>UNKNOWN</upnp:storageMedium>
<upnp:writeStatus>UNKNOWN</upnp:writeStatus>
<dc:title>xxxxxxxxxxxxxxxxxxxxxxx</dc:title>
<dc:creator></dc:creator>
<upnp:class>object.item.videoItem.movie</upnp:class>
<dc:date>2004-07-24</dc:date>
<upnp:storageUsed>1750337472</upnp:storageUsed>
<res protocolInfo="http-get:*:video/mpeg:*">http://192.168.x.xx:38520/ExportContent?id=2</res>
</item>
</DIDL-Lite>
</Result>
<NumberReturned>1</NumberReturned>
<TotalMatches>1</TotalMatches>
<UpdateID>2</UpdateID>
</u:SearchResponse>
</s:Body>
</s:Envelope>

Comments:
In this way, you have to do all checks.

Now I'm planning to do my search action.

If I got it, I'll share here.

:)
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?