* Implement my best guess at how to support subtitles on LG clients.

This commit is contained in:
Justin Maggard 2011-05-17 01:19:31 +00:00
parent 5782be8ab2
commit 87aff70055
3 changed files with 19 additions and 11 deletions

View File

@ -76,6 +76,7 @@ enum client_types {
ESonyBravia, ESonyBravia,
ERokuSoundBridge, ERokuSoundBridge,
EToshibaTV, EToshibaTV,
ELGDevice,
EStandardDLNA150 = 100 EStandardDLNA150 = 100
}; };

View File

@ -314,6 +314,11 @@ intervening space) by either an integer or the keyword "infinite". */
h->req_client = EMediaRoom; h->req_client = EMediaRoom;
h->reqflags |= FLAG_MS_PFS; h->reqflags |= FLAG_MS_PFS;
} }
else if(strstrc(p, "LGE_DLNA_SDK", '\r'))
{
h->req_client = ELGDevice;
h->reqflags |= FLAG_DLNA;
}
else if(strstrc(p, "UPnP/1.0 DLNADOC/1.50 Intel_SDK_for_UPnP_devices/1.2", '\r')) else if(strstrc(p, "UPnP/1.0 DLNADOC/1.50 Intel_SDK_for_UPnP_devices/1.2", '\r'))
{ {
h->req_client = EToshibaTV; h->req_client = EToshibaTV;
@ -1325,27 +1330,20 @@ void
SendResp_caption(struct upnphttp * h, char * object) SendResp_caption(struct upnphttp * h, char * object)
{ {
char header[1500]; char header[1500];
char sql_buf[256];
char **result;
int rows = 0;
char *path; char *path;
char date[30]; char date[30];
time_t curtime = time(NULL); time_t curtime = time(NULL);
off_t offset = 0, size; off_t offset = 0, size;
int sendfh, ret; int sendfh, ret;
memset(header, 0, 1500);
strip_ext(object); strip_ext(object);
sprintf(sql_buf, "SELECT PATH from CAPTIONS where ID = %s", object); path = sql_get_text_field(db, "SELECT PATH from CAPTIONS where ID = %s", object);
sql_get_table(db, sql_buf, &result, &rows, NULL); if( !path )
if( !rows )
{ {
DPRINTF(E_WARN, L_HTTP, "CAPTION ID %s not found, responding ERROR 404\n", object); DPRINTF(E_WARN, L_HTTP, "CAPTION ID %s not found, responding ERROR 404\n", object);
Send404(h); Send404(h);
goto error; return;
} }
path = result[1];
DPRINTF(E_INFO, L_HTTP, "Serving caption ID: %s [%s]\n", object, path); DPRINTF(E_INFO, L_HTTP, "Serving caption ID: %s [%s]\n", object, path);
if( access(path, F_OK) != 0 ) if( access(path, F_OK) != 0 )
@ -1376,7 +1374,7 @@ SendResp_caption(struct upnphttp * h, char * object)
close(sendfh); close(sendfh);
error: error:
sqlite3_free_table(result); sqlite3_free(path);
} }
void void

View File

@ -880,6 +880,15 @@ callback(void *args, int argc, char **argv, char **azColName)
resolution, dlna_buf, mime, detailID, ext, passed_args); resolution, dlna_buf, mime, detailID, ext, passed_args);
} }
break; break;
case ELGDevice:
if( sql_get_int_field(db, "SELECT ID from CAPTIONS where ID = '%s'", detailID) > 0 )
{
ret = strcatf(str, "<res protocolInfo=\"http-get:*:text/srt:*\">"
"http://%s:%d/Captions/%s.srt"
"</res>",
lan_addr[0].str, runtime_vars.port, detailID);
}
break;
default: default:
break; break;
} }