* 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,
|
||||
EDenonReceiver,
|
||||
EFreeBox,
|
||||
EPopcornHour,
|
||||
EStandardDLNA150 = 100
|
||||
};
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
"http-get:*:video/x-ms-wmv:*," \
|
||||
"http-get:*:video/x-msvideo:*," \
|
||||
"http-get:*:audio/mp4:*," \
|
||||
"http-get:*:audio/wav:*," \
|
||||
"http-get:*:audio/x-wav:*," \
|
||||
"http-get:*:audio/x-flac:*," \
|
||||
"http-get:*:application/ogg:*"
|
||||
|
||||
|
@ -256,6 +256,11 @@ intervening space) by either an integer or the keyword "infinite". */
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -338,6 +343,7 @@ next_header:
|
||||
h->req_contentoff++;
|
||||
}
|
||||
h->req_contentoff += 2;
|
||||
h->req_contentlen = h->req_buflen - h->req_contentoff;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -817,6 +823,7 @@ Process_upnphttp(struct upnphttp * h)
|
||||
if(endheaders)
|
||||
{
|
||||
h->req_contentoff = endheaders - h->req_buf + 4;
|
||||
h->req_contentlen = h->req_buflen - h->req_contentoff;
|
||||
ProcessHttpQuery_upnphttp(h);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,8 @@ struct upnphttp {
|
||||
#define FLAG_MIME_AVI_DIVX 0x00200000
|
||||
#define FLAG_MIME_AVI_AVI 0x00400000
|
||||
#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() */
|
||||
struct upnphttp *
|
||||
|
56
upnpsoap.c
56
upnpsoap.c
@ -222,9 +222,9 @@ mime_to_ext(const char * mime, char * buf)
|
||||
strcpy(buf, "wma");
|
||||
else if( strcmp(mime+6, "x-flac") == 0 )
|
||||
strcpy(buf, "flac");
|
||||
else if( strncmp(mime+6, "", 3) == 0 )
|
||||
strcpy(buf, "wav");
|
||||
else if( strncmp(mime+6, "x-wav", 3) == 0 )
|
||||
else if( strcmp(mime+6, "flac") == 0 )
|
||||
strcpy(buf, "flac");
|
||||
else if( strcmp(mime+6, "x-wav") == 0 )
|
||||
strcpy(buf, "wav");
|
||||
else
|
||||
strcpy(buf, "dat");
|
||||
@ -559,15 +559,25 @@ callback(void *args, int argc, char **argv, char **azColName)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( strncmp(mime+6, "L16", 3) == 0 )
|
||||
else if( *mime == 'a' )
|
||||
{
|
||||
if( !(passed_args->flags & FLAG_DLNA) || (passed_args->flags & FLAG_MIME_WAV_WAV) )
|
||||
if( strcmp(mime+6, "x-flac") == 0 )
|
||||
{
|
||||
strcpy(mime+6, "x-wav");
|
||||
if( passed_args->flags & FLAG_MIME_FLAC_FLAC )
|
||||
{
|
||||
strcpy(mime+6, "flac");
|
||||
}
|
||||
}
|
||||
if( !(passed_args->flags & FLAG_DLNA) || (passed_args->flags & FLAG_WAV_NO_DLNA) )
|
||||
else if( strncmp(mime+6, "L16", 3) == 0 )
|
||||
{
|
||||
strcpy(dlna_buf, "*");
|
||||
if( !(passed_args->flags & FLAG_DLNA) || (passed_args->flags & FLAG_MIME_WAV_WAV) )
|
||||
{
|
||||
strcpy(mime+6, "x-wav");
|
||||
}
|
||||
if( !(passed_args->flags & FLAG_DLNA) || (passed_args->flags & FLAG_WAV_NO_DLNA) )
|
||||
{
|
||||
strcpy(dlna_buf, "*");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -809,7 +819,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
||||
char *resp = malloc(1048576);
|
||||
char str_buf[512];
|
||||
char *zErrMsg = 0;
|
||||
char *sql;
|
||||
char *sql, *ptr;
|
||||
char **result;
|
||||
int ret;
|
||||
struct Response args;
|
||||
@ -818,13 +828,19 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
||||
*resp = '\0';
|
||||
|
||||
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 * Filter = GetValueFromNameValueList(&data, "Filter");
|
||||
char * BrowseFlag = GetValueFromNameValueList(&data, "BrowseFlag");
|
||||
char * SortCriteria = GetValueFromNameValueList(&data, "SortCriteria");
|
||||
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")) )
|
||||
{
|
||||
SoapError(h, 402, "Invalid Args");
|
||||
@ -844,9 +860,6 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
||||
}
|
||||
memset(&args, 0, sizeof(args));
|
||||
|
||||
if( !RequestedCount )
|
||||
RequestedCount = -1;
|
||||
|
||||
args.resp = resp;
|
||||
args.size = sprintf(resp, "%s", resp0);
|
||||
/* 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 *zErrMsg = 0;
|
||||
char *sql;
|
||||
char *sql, *ptr;
|
||||
char **result;
|
||||
char str_buf[4096];
|
||||
int ret;
|
||||
@ -986,8 +999,6 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
||||
|
||||
struct NameValueParserData 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 * Filter = GetValueFromNameValueList(&data, "Filter");
|
||||
char * SearchCriteria = GetValueFromNameValueList(&data, "SearchCriteria");
|
||||
@ -995,6 +1006,14 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
||||
char * newSearchCriteria = NULL;
|
||||
char * orderBy = NULL;
|
||||
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 )
|
||||
{
|
||||
SoapError(h, 701, "No such object error");
|
||||
@ -1004,9 +1023,6 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
||||
}
|
||||
memset(&args, 0, sizeof(args));
|
||||
|
||||
if( !RequestedCount )
|
||||
RequestedCount = -1;
|
||||
|
||||
args.resp = resp;
|
||||
args.size = sprintf(resp, "%s", resp0);
|
||||
/* See if we need to include DLNA namespace reference */
|
||||
|
Loading…
x
Reference in New Issue
Block a user