options: Add enable_subtitles config option

Enable generic subtitle support by default for unknown clients.  Set the
new enable_subtitles option to false to revert to the old behavior.
This commit is contained in:
Justin Maggard 2018-01-09 14:50:15 -08:00
parent 33fd018828
commit 8bdba2f40d
8 changed files with 21 additions and 2 deletions

View File

@ -756,6 +756,10 @@ init(int argc, char **argv)
if (strcasecmp(ary_options[i].value, "beacon") == 0) if (strcasecmp(ary_options[i].value, "beacon") == 0)
CLEARFLAG(TIVO_BONJOUR_MASK); CLEARFLAG(TIVO_BONJOUR_MASK);
break; break;
case ENABLE_SUBTITLES:
if (!strtobool(ary_options[i].value))
CLEARFLAG(SUBTITLES_MASK);
break;
default: default:
DPRINTF(E_ERROR, L_GENERAL, "Unknown option in file %s\n", DPRINTF(E_ERROR, L_GENERAL, "Unknown option in file %s\n",
optionsfile); optionsfile);

View File

@ -88,3 +88,7 @@ model_number=1
# set this to yes to allow symlinks that point outside user-defined media_dirs. # set this to yes to allow symlinks that point outside user-defined media_dirs.
#wide_links=no #wide_links=no
# enable subtitle support by default on unknown clients.
# note: the default is yes
#enable_subtitles=yes

View File

@ -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. Set to 'yes' to allow symlinks that point outside user-defined media_dirs.
By default, wide symlinks are not followed. 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 .SH VERSION
This manpage corresponds to minidlna version 1.0.25 This manpage corresponds to minidlna version 1.3.0
.SH AUTHOR .SH AUTHOR
.nf .nf

View File

@ -67,6 +67,7 @@ static const struct {
{ MERGE_MEDIA_DIRS, "merge_media_dirs" }, { MERGE_MEDIA_DIRS, "merge_media_dirs" },
{ WIDE_LINKS, "wide_links" }, { WIDE_LINKS, "wide_links" },
{ TIVO_DISCOVERY, "tivo_discovery" }, { TIVO_DISCOVERY, "tivo_discovery" },
{ ENABLE_SUBTITLES, "enable_subtitles" },
}; };
int int

View File

@ -60,6 +60,7 @@ enum upnpconfigoptions {
MERGE_MEDIA_DIRS, /* don't add an extra directory level when there are multiple media dirs */ 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 */ WIDE_LINKS, /* allow following symlinks outside the defined media_dirs */
TIVO_DISCOVERY, /* TiVo discovery protocol: bonjour or beacon. Defaults to bonjour if supported */ 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() /* readoptionsfile()

View File

@ -58,7 +58,7 @@
time_t startup_time = 0; time_t startup_time = 0;
struct runtime_vars_s runtime_vars; 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"; const char *pidfilename = "/var/run/minidlna/minidlna.pid";

View File

@ -195,6 +195,7 @@ extern uint32_t runtime_flags;
#endif #endif
#define SCANNING_MASK 0x0100 #define SCANNING_MASK 0x0100
#define RESCAN_MASK 0x0200 #define RESCAN_MASK 0x0200
#define SUBTITLES_MASK 0x0400
#define SETFLAG(mask) runtime_flags |= mask #define SETFLAG(mask) runtime_flags |= mask
#define GETFLAG(mask) (runtime_flags & mask) #define GETFLAG(mask) (runtime_flags & mask)

View File

@ -839,6 +839,10 @@ callback(void *args, int argc, char **argv, char **azColName)
if( *mime == 'v' ) if( *mime == 'v' )
{ {
dlna_flags |= DLNA_FLAG_TM_S; 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( passed_args->flags & FLAG_MIME_AVI_DIVX )
{ {
if( strcmp(mime, "video/x-msvideo") == 0 ) if( strcmp(mime, "video/x-msvideo") == 0 )