diff --git a/minidlna.c b/minidlna.c index f82cd89..3073435 100644 --- a/minidlna.c +++ b/minidlna.c @@ -756,6 +756,10 @@ init(int argc, char **argv) if (strcasecmp(ary_options[i].value, "beacon") == 0) CLEARFLAG(TIVO_BONJOUR_MASK); break; + case ENABLE_SUBTITLES: + if (!strtobool(ary_options[i].value)) + CLEARFLAG(SUBTITLES_MASK); + break; default: DPRINTF(E_ERROR, L_GENERAL, "Unknown option in file %s\n", optionsfile); diff --git a/minidlna.conf b/minidlna.conf index 16cd15f..9936463 100644 --- a/minidlna.conf +++ b/minidlna.conf @@ -88,3 +88,7 @@ model_number=1 # set this to yes to allow symlinks that point outside user-defined media_dirs. #wide_links=no + +# enable subtitle support by default on unknown clients. +# note: the default is yes +#enable_subtitles=yes diff --git a/minidlna.conf.5 b/minidlna.conf.5 index 50f8883..256e094 100644 --- a/minidlna.conf.5 +++ b/minidlna.conf.5 @@ -171,10 +171,14 @@ force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title Set to 'yes' to allow symlinks that point outside user-defined media_dirs. By default, wide symlinks are not followed. +.IP "\fBenable_subtitles\fP" +Set to 'no' to disable subtitle support on unknown clients. +By default, subtitles are enabled for unknown or generic clients. + .SH VERSION -This manpage corresponds to minidlna version 1.0.25 +This manpage corresponds to minidlna version 1.3.0 .SH AUTHOR .nf diff --git a/options.c b/options.c index 79e4ffe..cee3dff 100644 --- a/options.c +++ b/options.c @@ -67,6 +67,7 @@ static const struct { { MERGE_MEDIA_DIRS, "merge_media_dirs" }, { WIDE_LINKS, "wide_links" }, { TIVO_DISCOVERY, "tivo_discovery" }, + { ENABLE_SUBTITLES, "enable_subtitles" }, }; int diff --git a/options.h b/options.h index cb4c3be..1ff5b22 100644 --- a/options.h +++ b/options.h @@ -60,6 +60,7 @@ enum upnpconfigoptions { MERGE_MEDIA_DIRS, /* don't add an extra directory level when there are multiple media dirs */ WIDE_LINKS, /* allow following symlinks outside the defined media_dirs */ TIVO_DISCOVERY, /* TiVo discovery protocol: bonjour or beacon. Defaults to bonjour if supported */ + ENABLE_SUBTITLES, /* Enable generic subtitle support for all clients by default */ }; /* readoptionsfile() diff --git a/upnpglobalvars.c b/upnpglobalvars.c index 2ca5676..3cc6704 100644 --- a/upnpglobalvars.c +++ b/upnpglobalvars.c @@ -58,7 +58,7 @@ time_t startup_time = 0; struct runtime_vars_s runtime_vars; -uint32_t runtime_flags = INOTIFY_MASK | TIVO_BONJOUR_MASK; +uint32_t runtime_flags = INOTIFY_MASK | TIVO_BONJOUR_MASK | SUBTITLES_MASK; const char *pidfilename = "/var/run/minidlna/minidlna.pid"; diff --git a/upnpglobalvars.h b/upnpglobalvars.h index fd2b3db..9ce2712 100644 --- a/upnpglobalvars.h +++ b/upnpglobalvars.h @@ -195,6 +195,7 @@ extern uint32_t runtime_flags; #endif #define SCANNING_MASK 0x0100 #define RESCAN_MASK 0x0200 +#define SUBTITLES_MASK 0x0400 #define SETFLAG(mask) runtime_flags |= mask #define GETFLAG(mask) (runtime_flags & mask) diff --git a/upnpsoap.c b/upnpsoap.c index 1048377..b53b53d 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -839,6 +839,10 @@ callback(void *args, int argc, char **argv, char **azColName) if( *mime == 'v' ) { dlna_flags |= DLNA_FLAG_TM_S; + if (GETFLAG(SUBTITLES_MASK) && + (passed_args->client >= EStandardDLNA150 || !passed_args->client)) + passed_args->flags |= FLAG_CAPTION_RES; + if( passed_args->flags & FLAG_MIME_AVI_DIVX ) { if( strcmp(mime, "video/x-msvideo") == 0 )