diff options
author | Carl Fürstenberg <azatoth@gmail.com> | 2011-05-18 01:11:28 +0400 |
---|---|---|
committer | Carl Fürstenberg <azatoth@gmail.com> | 2011-05-18 01:11:28 +0400 |
commit | 29097d197e092b57d47acce8e1d794db6de41aa7 (patch) | |
tree | 5250d7567df82872404b7ce43915ffec63e1f364 | |
parent | c33cec25a241d8284406885f33da3e0ccaafe2dc (diff) | |
parent | 7a9faafa324d28d0e254ba0c861416f4fc489eb4 (diff) |
Merge branch 'cvs'v1.0.19.3
-rw-r--r-- | minidlnatypes.h | 1 | ||||
-rw-r--r-- | tagutils/tagutils-asf.c | 67 | ||||
-rw-r--r-- | tagutils/tagutils.h | 7 | ||||
-rw-r--r-- | upnpglobalvars.h | 8 | ||||
-rw-r--r-- | upnphttp.c | 20 | ||||
-rw-r--r-- | upnpsoap.c | 9 |
6 files changed, 57 insertions, 55 deletions
diff --git a/minidlnatypes.h b/minidlnatypes.h index 594dac5..f29e091 100644 --- a/minidlnatypes.h +++ b/minidlnatypes.h @@ -78,6 +78,7 @@ enum client_types { ESonyBravia, ERokuSoundBridge, EToshibaTV, + ELGDevice, EStandardDLNA150 = 100 }; diff --git a/tagutils/tagutils-asf.c b/tagutils/tagutils-asf.c index 66cffed..11da1ae 100644 --- a/tagutils/tagutils-asf.c +++ b/tagutils/tagutils-asf.c @@ -39,6 +39,29 @@ _asf_read_file_properties(FILE *fp, asf_file_properties_t *p, __u32 size) return 0; } +static void +_pick_dlna_profile(struct song_metadata *psong, uint16_t format) +{ + /* DLNA Profile Name */ + switch( le16_to_cpu(format) ) + { + case WMA: + if( psong->max_bitrate < 193000 ) + asprintf(&(psong->dlna_pn), "WMABASE"); + else if( psong->max_bitrate < 385000 ) + asprintf(&(psong->dlna_pn), "WMAFULL"); + break; + case WMAPRO: + asprintf(&(psong->dlna_pn), "WMAPRO"); + break; + case WMALSL: + asprintf(&(psong->dlna_pn), "WMALSL%s", + psong->channels > 2 ? "_MULT5" : ""); + default: + break; + } +} + static int _asf_read_audio_stream(FILE *fp, struct song_metadata *psong, int size) { @@ -55,24 +78,9 @@ _asf_read_audio_stream(FILE *fp, struct song_metadata *psong, int size) psong->channels = le16_to_cpu(s.wfx.nChannels); psong->bitrate = le32_to_cpu(s.wfx.nAvgBytesPerSec) * 8; psong->samplerate = le32_to_cpu(s.wfx.nSamplesPerSec); - /* DLNA Profile Name */ - switch( le16_to_cpu(s.wfx.wFormatTag) ) - { - case WMAV1: - case WMAV2: - if( (psong->bitrate/1000+1) >= 385 || psong->samplerate > 48000 ) - asprintf(&(psong->dlna_pn), "WMAPRO"); - else if( ((psong->bitrate+1) / 1000) <= 192 ) - asprintf(&(psong->dlna_pn), "WMABASE"); - else - asprintf(&(psong->dlna_pn), "WMAFULL"); - break; - case WMAPRO: - asprintf(&(psong->dlna_pn), "WMAPRO"); - break; - default: - break; - } + if (!psong->max_bitrate) + psong->max_bitrate = psong->bitrate; + _pick_dlna_profile(psong, s.wfx.wFormatTag); return 0; } @@ -101,25 +109,11 @@ _asf_read_media_stream(FILE *fp, struct song_metadata *psong, __u32 size) psong->channels = le16_to_cpu(wfx.nChannels); psong->bitrate = le32_to_cpu(wfx.nAvgBytesPerSec) * 8; psong->samplerate = le32_to_cpu(wfx.nSamplesPerSec); - /* DLNA Profile Name */ - switch( le16_to_cpu(wfx.wFormatTag) ) - { - case WMAV1: - case WMAV2: - if( (psong->bitrate/1000+1) >= 385 || psong->samplerate > 48000 ) - asprintf(&(psong->dlna_pn), "WMAPRO"); - else if( (psong->bitrate / 1000)+1 < 192 ) - asprintf(&(psong->dlna_pn), "WMABASE"); - else - asprintf(&(psong->dlna_pn), "WMAFULL"); - break; - case WMAPRO: - asprintf(&(psong->dlna_pn), "WMAPRO"); - break; - default: - break; - } + if (!psong->max_bitrate) + psong->max_bitrate = psong->bitrate; + _pick_dlna_profile(psong, wfx.wFormatTag); } + return 0; } @@ -448,6 +442,7 @@ _get_asffileinfo(char *file, struct song_metadata *psong) _asf_read_file_properties(fp, &FileProperties, tmp.Size); psong->song_length = le64_to_cpu(FileProperties.PlayDuration) / 10000; psong->bitrate = le64_to_cpu(FileProperties.MaxBitrate); + psong->max_bitrate = psong->bitrate; } else if(IsEqualGUID(&tmp.ID, &ASF_ContentDescription)) { diff --git a/tagutils/tagutils.h b/tagutils/tagutils.h index 395e6c5..0d5f362 100644 --- a/tagutils/tagutils.h +++ b/tagutils/tagutils.h @@ -75,6 +75,7 @@ struct song_metadata { char compilation; // YTCP int bitrate; + int max_bitrate; int samplerate; int samplesize; int channels; @@ -105,9 +106,9 @@ struct song_metadata { int plist_id; }; -#define WMAV1 0x161 -#define WMAV2 0x162 -#define WMAPRO 0x163 +#define WMA 0x161 +#define WMAPRO 0x162 +#define WMALSL 0x163 extern int scan_init(char *path); extern void make_composite_tags(struct song_metadata *psong); diff --git a/upnpglobalvars.h b/upnpglobalvars.h index 44dec82..d2d4cc3 100644 --- a/upnpglobalvars.h +++ b/upnpglobalvars.h @@ -58,7 +58,7 @@ #include <sqlite3.h> -#define MINIDLNA_VERSION "1.0.19.2" +#define MINIDLNA_VERSION "1.0.19.3" #ifdef NETGEAR # define SERVER_NAME "ReadyDLNA" @@ -80,10 +80,6 @@ #define PNPX 0 #endif -#if 0 // Add these once the newer ffmpeg libs that can detect WMAPRO are more widely used - "http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVHIGH_PRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," - "http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_PRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," -#endif #define RESOURCE_PROTOCOL_INFO_VALUES \ "http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN," \ "http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ @@ -147,6 +143,8 @@ "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAFULL;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAPRO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMALSL;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ + "http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMALSL_MULT5;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:audio/3gpp:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ "http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO;DLNA.ORG_OP=01;DLNA.ORG_CI=0," \ @@ -316,6 +316,11 @@ intervening space) by either an integer or the keyword "infinite". */ h->req_client = EMediaRoom; 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')) { h->req_client = EToshibaTV; @@ -1327,27 +1332,20 @@ void SendResp_caption(struct upnphttp * h, char * object) { char header[1500]; - char sql_buf[256]; - char **result; - int rows = 0; char *path; char date[30]; time_t curtime = time(NULL); off_t offset = 0, size; int sendfh, ret; - memset(header, 0, 1500); - strip_ext(object); - sprintf(sql_buf, "SELECT PATH from CAPTIONS where ID = %s", object); - sql_get_table(db, sql_buf, &result, &rows, NULL); - if( !rows ) + path = sql_get_text_field(db, "SELECT PATH from CAPTIONS where ID = %s", object); + if( !path ) { DPRINTF(E_WARN, L_HTTP, "CAPTION ID %s not found, responding ERROR 404\n", object); Send404(h); - goto error; + return; } - path = result[1]; DPRINTF(E_INFO, L_HTTP, "Serving caption ID: %s [%s]\n", object, path); if( access(path, F_OK) != 0 ) @@ -1378,7 +1376,7 @@ SendResp_caption(struct upnphttp * h, char * object) close(sendfh); error: - sqlite3_free_table(result); + sqlite3_free(path); } void @@ -882,6 +882,15 @@ callback(void *args, int argc, char **argv, char **azColName) resolution, dlna_buf, mime, detailID, ext, passed_args); } 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: break; } |