* Add Popcorn Hour support for using the wrong MIME type for FLAC.
* Fix a couple crash bugs with invalid UPnP-A/V SOAP requests. * Fix WAV file extension support.
This commit is contained in:
parent
6fe702f332
commit
780ae7ad8b
@ -41,6 +41,7 @@ enum client_types {
|
|||||||
ESamsungTV,
|
ESamsungTV,
|
||||||
EDenonReceiver,
|
EDenonReceiver,
|
||||||
EFreeBox,
|
EFreeBox,
|
||||||
|
EPopcornHour,
|
||||||
EStandardDLNA150 = 100
|
EStandardDLNA150 = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
"http-get:*:video/x-ms-wmv:*," \
|
"http-get:*:video/x-ms-wmv:*," \
|
||||||
"http-get:*:video/x-msvideo:*," \
|
"http-get:*:video/x-msvideo:*," \
|
||||||
"http-get:*:audio/mp4:*," \
|
"http-get:*:audio/mp4:*," \
|
||||||
"http-get:*:audio/wav:*," \
|
"http-get:*:audio/x-wav:*," \
|
||||||
"http-get:*:audio/x-flac:*," \
|
"http-get:*:audio/x-flac:*," \
|
||||||
"http-get:*:application/ogg:*"
|
"http-get:*:application/ogg:*"
|
||||||
|
|
||||||
|
@ -256,6 +256,11 @@ intervening space) by either an integer or the keyword "infinite". */
|
|||||||
{
|
{
|
||||||
h->req_client = EFreeBox;
|
h->req_client = EFreeBox;
|
||||||
}
|
}
|
||||||
|
else if(strncmp(p, "SMP8634", 7)==0)
|
||||||
|
{
|
||||||
|
h->req_client = EPopcornHour;
|
||||||
|
h->reqflags |= FLAG_MIME_FLAC_FLAC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(strncasecmp(line, "X-AV-Client-Info", 16)==0)
|
else if(strncasecmp(line, "X-AV-Client-Info", 16)==0)
|
||||||
{
|
{
|
||||||
@ -338,6 +343,7 @@ next_header:
|
|||||||
h->req_contentoff++;
|
h->req_contentoff++;
|
||||||
}
|
}
|
||||||
h->req_contentoff += 2;
|
h->req_contentoff += 2;
|
||||||
|
h->req_contentlen = h->req_buflen - h->req_contentoff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -817,6 +823,7 @@ Process_upnphttp(struct upnphttp * h)
|
|||||||
if(endheaders)
|
if(endheaders)
|
||||||
{
|
{
|
||||||
h->req_contentoff = endheaders - h->req_buf + 4;
|
h->req_contentoff = endheaders - h->req_buf + 4;
|
||||||
|
h->req_contentlen = h->req_buflen - h->req_contentoff;
|
||||||
ProcessHttpQuery_upnphttp(h);
|
ProcessHttpQuery_upnphttp(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,8 @@ struct upnphttp {
|
|||||||
#define FLAG_MIME_AVI_DIVX 0x00200000
|
#define FLAG_MIME_AVI_DIVX 0x00200000
|
||||||
#define FLAG_MIME_AVI_AVI 0x00400000
|
#define FLAG_MIME_AVI_AVI 0x00400000
|
||||||
#define FLAG_MIME_WAV_WAV 0x00800000
|
#define FLAG_MIME_WAV_WAV 0x00800000
|
||||||
#define FLAG_WAV_NO_DLNA 0x01000000
|
#define FLAG_MIME_FLAC_FLAC 0x01000000
|
||||||
|
#define FLAG_WAV_NO_DLNA 0x02000000
|
||||||
|
|
||||||
/* New_upnphttp() */
|
/* New_upnphttp() */
|
||||||
struct upnphttp *
|
struct upnphttp *
|
||||||
|
46
upnpsoap.c
46
upnpsoap.c
@ -222,9 +222,9 @@ mime_to_ext(const char * mime, char * buf)
|
|||||||
strcpy(buf, "wma");
|
strcpy(buf, "wma");
|
||||||
else if( strcmp(mime+6, "x-flac") == 0 )
|
else if( strcmp(mime+6, "x-flac") == 0 )
|
||||||
strcpy(buf, "flac");
|
strcpy(buf, "flac");
|
||||||
else if( strncmp(mime+6, "", 3) == 0 )
|
else if( strcmp(mime+6, "flac") == 0 )
|
||||||
strcpy(buf, "wav");
|
strcpy(buf, "flac");
|
||||||
else if( strncmp(mime+6, "x-wav", 3) == 0 )
|
else if( strcmp(mime+6, "x-wav") == 0 )
|
||||||
strcpy(buf, "wav");
|
strcpy(buf, "wav");
|
||||||
else
|
else
|
||||||
strcpy(buf, "dat");
|
strcpy(buf, "dat");
|
||||||
@ -559,6 +559,15 @@ callback(void *args, int argc, char **argv, char **azColName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( *mime == 'a' )
|
||||||
|
{
|
||||||
|
if( strcmp(mime+6, "x-flac") == 0 )
|
||||||
|
{
|
||||||
|
if( passed_args->flags & FLAG_MIME_FLAC_FLAC )
|
||||||
|
{
|
||||||
|
strcpy(mime+6, "flac");
|
||||||
|
}
|
||||||
|
}
|
||||||
else if( strncmp(mime+6, "L16", 3) == 0 )
|
else if( strncmp(mime+6, "L16", 3) == 0 )
|
||||||
{
|
{
|
||||||
if( !(passed_args->flags & FLAG_DLNA) || (passed_args->flags & FLAG_MIME_WAV_WAV) )
|
if( !(passed_args->flags & FLAG_DLNA) || (passed_args->flags & FLAG_MIME_WAV_WAV) )
|
||||||
@ -570,6 +579,7 @@ callback(void *args, int argc, char **argv, char **azColName)
|
|||||||
strcpy(dlna_buf, "*");
|
strcpy(dlna_buf, "*");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = snprintf(str_buf, 512, "<item id=\"%s\" parentID=\"%s\" restricted=\"1\"", id, parent);
|
ret = snprintf(str_buf, 512, "<item id=\"%s\" parentID=\"%s\" restricted=\"1\"", id, parent);
|
||||||
memcpy(passed_args->resp+passed_args->size, &str_buf, ret+1);
|
memcpy(passed_args->resp+passed_args->size, &str_buf, ret+1);
|
||||||
@ -809,7 +819,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
char *resp = malloc(1048576);
|
char *resp = malloc(1048576);
|
||||||
char str_buf[512];
|
char str_buf[512];
|
||||||
char *zErrMsg = 0;
|
char *zErrMsg = 0;
|
||||||
char *sql;
|
char *sql, *ptr;
|
||||||
char **result;
|
char **result;
|
||||||
int ret;
|
int ret;
|
||||||
struct Response args;
|
struct Response args;
|
||||||
@ -818,13 +828,19 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
*resp = '\0';
|
*resp = '\0';
|
||||||
|
|
||||||
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
|
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
|
||||||
int RequestedCount = atoi( GetValueFromNameValueList(&data, "RequestedCount") );
|
|
||||||
int StartingIndex = atoi( GetValueFromNameValueList(&data, "StartingIndex") );
|
|
||||||
char * ObjectId = GetValueFromNameValueList(&data, "ObjectID");
|
char * ObjectId = GetValueFromNameValueList(&data, "ObjectID");
|
||||||
char * Filter = GetValueFromNameValueList(&data, "Filter");
|
char * Filter = GetValueFromNameValueList(&data, "Filter");
|
||||||
char * BrowseFlag = GetValueFromNameValueList(&data, "BrowseFlag");
|
char * BrowseFlag = GetValueFromNameValueList(&data, "BrowseFlag");
|
||||||
char * SortCriteria = GetValueFromNameValueList(&data, "SortCriteria");
|
char * SortCriteria = GetValueFromNameValueList(&data, "SortCriteria");
|
||||||
char * orderBy = NULL;
|
char * orderBy = NULL;
|
||||||
|
int RequestedCount = 0;
|
||||||
|
int StartingIndex = 0;
|
||||||
|
if( (ptr = GetValueFromNameValueList(&data, "RequestedCount")) )
|
||||||
|
RequestedCount = atoi(ptr);
|
||||||
|
if( !RequestedCount )
|
||||||
|
RequestedCount = -1;
|
||||||
|
if( (ptr = GetValueFromNameValueList(&data, "StartingIndex")) )
|
||||||
|
StartingIndex = atoi(ptr);
|
||||||
if( !BrowseFlag || (strcmp(BrowseFlag, "BrowseDirectChildren") && strcmp(BrowseFlag, "BrowseMetadata")) )
|
if( !BrowseFlag || (strcmp(BrowseFlag, "BrowseDirectChildren") && strcmp(BrowseFlag, "BrowseMetadata")) )
|
||||||
{
|
{
|
||||||
SoapError(h, 402, "Invalid Args");
|
SoapError(h, 402, "Invalid Args");
|
||||||
@ -844,9 +860,6 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
}
|
}
|
||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
|
|
||||||
if( !RequestedCount )
|
|
||||||
RequestedCount = -1;
|
|
||||||
|
|
||||||
args.resp = resp;
|
args.resp = resp;
|
||||||
args.size = sprintf(resp, "%s", resp0);
|
args.size = sprintf(resp, "%s", resp0);
|
||||||
/* See if we need to include DLNA namespace reference */
|
/* See if we need to include DLNA namespace reference */
|
||||||
@ -976,7 +989,7 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
|
|
||||||
char *resp = malloc(1048576);
|
char *resp = malloc(1048576);
|
||||||
char *zErrMsg = 0;
|
char *zErrMsg = 0;
|
||||||
char *sql;
|
char *sql, *ptr;
|
||||||
char **result;
|
char **result;
|
||||||
char str_buf[4096];
|
char str_buf[4096];
|
||||||
int ret;
|
int ret;
|
||||||
@ -986,8 +999,6 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
|
|
||||||
struct NameValueParserData data;
|
struct NameValueParserData data;
|
||||||
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
|
ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
|
||||||
int RequestedCount = atoi( GetValueFromNameValueList(&data, "RequestedCount") );
|
|
||||||
int StartingIndex = atoi( GetValueFromNameValueList(&data, "StartingIndex") );
|
|
||||||
char * ContainerID = GetValueFromNameValueList(&data, "ContainerID");
|
char * ContainerID = GetValueFromNameValueList(&data, "ContainerID");
|
||||||
char * Filter = GetValueFromNameValueList(&data, "Filter");
|
char * Filter = GetValueFromNameValueList(&data, "Filter");
|
||||||
char * SearchCriteria = GetValueFromNameValueList(&data, "SearchCriteria");
|
char * SearchCriteria = GetValueFromNameValueList(&data, "SearchCriteria");
|
||||||
@ -995,6 +1006,14 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
char * newSearchCriteria = NULL;
|
char * newSearchCriteria = NULL;
|
||||||
char * orderBy = NULL;
|
char * orderBy = NULL;
|
||||||
char groupBy[] = "group by DETAIL_ID";
|
char groupBy[] = "group by DETAIL_ID";
|
||||||
|
int RequestedCount = 0;
|
||||||
|
int StartingIndex = 0;
|
||||||
|
if( (ptr = GetValueFromNameValueList(&data, "RequestedCount")) )
|
||||||
|
RequestedCount = atoi(ptr);
|
||||||
|
if( !RequestedCount )
|
||||||
|
RequestedCount = -1;
|
||||||
|
if( (ptr = GetValueFromNameValueList(&data, "StartingIndex")) )
|
||||||
|
StartingIndex = atoi(ptr);
|
||||||
if( !ContainerID )
|
if( !ContainerID )
|
||||||
{
|
{
|
||||||
SoapError(h, 701, "No such object error");
|
SoapError(h, 701, "No such object error");
|
||||||
@ -1004,9 +1023,6 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
}
|
}
|
||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
|
|
||||||
if( !RequestedCount )
|
|
||||||
RequestedCount = -1;
|
|
||||||
|
|
||||||
args.resp = resp;
|
args.resp = resp;
|
||||||
args.size = sprintf(resp, "%s", resp0);
|
args.size = sprintf(resp, "%s", resp0);
|
||||||
/* See if we need to include DLNA namespace reference */
|
/* See if we need to include DLNA namespace reference */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user