diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index f6c7d7b..8d2c8b5 100644
a
|
b
|
void AvFormatDecoder::ScanRawTextCaptions(int av_stream_index) |
1690 | 1690 | AVDictionaryEntry *metatag = |
1691 | 1691 | av_dict_get(ic->streams[av_stream_index]->metadata, "language", NULL, |
1692 | 1692 | 0); |
| 1693 | bool forced = |
| 1694 | ic->streams[av_stream_index]->disposition & AV_DISPOSITION_FORCED; |
1693 | 1695 | int lang = metatag ? get_canonical_lang(metatag->value) : |
1694 | 1696 | iso639_str3_to_key("und"); |
1695 | 1697 | LOG(VB_PLAYBACK, LOG_INFO, LOC + |
1696 | 1698 | QString("Text Subtitle track #%1 is A/V stream #%2 " |
1697 | | "and is in the %3 language(%4).") |
| 1699 | "and is in the %3 language(%4), forced=%5.") |
1698 | 1700 | .arg(tracks[kTrackTypeRawText].size()).arg(av_stream_index) |
1699 | | .arg(iso639_key_toName(lang)).arg(lang)); |
1700 | | StreamInfo si(av_stream_index, lang, 0, 0, 0); |
| 1701 | .arg(iso639_key_toName(lang)).arg(lang).arg(forced)); |
| 1702 | StreamInfo si(av_stream_index, lang, 0, 0, 0, false, false, forced); |
1701 | 1703 | tracks[kTrackTypeRawText].push_back(si); |
1702 | 1704 | } |
1703 | 1705 | |
… |
… |
QString AvFormatDecoder::GetTrackDesc(uint type, uint trackNo) const |
3659 | 3661 | |
3660 | 3662 | bool forced = tracks[type][trackNo].forced; |
3661 | 3663 | int lang_key = tracks[type][trackNo].language; |
| 3664 | QString forcedString = forced ? QObject::tr(" (forced)") : ""; |
3662 | 3665 | if (kTrackTypeAudio == type) |
3663 | 3666 | { |
3664 | 3667 | if (ringBuffer->IsDVD()) |
… |
… |
QString AvFormatDecoder::GetTrackDesc(uint type, uint trackNo) const |
3712 | 3715 | |
3713 | 3716 | return QObject::tr("Subtitle") + QString(" %1: %2%3") |
3714 | 3717 | .arg(trackNo + 1).arg(iso639_key_toName(lang_key)) |
3715 | | .arg(forced ? QObject::tr(" (forced)") : ""); |
| 3718 | .arg(forcedString); |
| 3719 | } |
| 3720 | else if (forced && kTrackTypeRawText == type) |
| 3721 | { |
| 3722 | return DecoderBase::GetTrackDesc(type, trackNo) + forcedString; |
3716 | 3723 | } |
3717 | 3724 | else |
3718 | 3725 | { |
diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 795b345..64e48f9 100644
a
|
b
|
void MythPlayer::VideoStart(void) |
2268 | 2268 | } |
2269 | 2269 | #endif // USING_MHEG |
2270 | 2270 | |
2271 | | SetCaptionsEnabled(captionsEnabledbyDefault, false); |
| 2271 | // If there is a forced text subtitle track (which is possible |
| 2272 | // in e.g. a .mkv container), and forced subtitles are |
| 2273 | // allowed, then start playback with that subtitle track |
| 2274 | // selected. Otherwise, use the frontend settings to decide |
| 2275 | // which captions/subtitles (if any) to enable at startup. |
| 2276 | // TODO: modify the fix to #10735 to use this approach |
| 2277 | // instead. |
| 2278 | bool hasForcedTextTrack = false; |
| 2279 | uint forcedTrackNumber = 0; |
| 2280 | if (GetAllowForcedSubtitles()) |
| 2281 | { |
| 2282 | uint numTextTracks = decoder->GetTrackCount(kTrackTypeRawText); |
| 2283 | for (uint i = 0; !hasForcedTextTrack && i < numTextTracks; ++i) |
| 2284 | { |
| 2285 | if (decoder->GetTrackInfo(kTrackTypeRawText, i).forced) |
| 2286 | { |
| 2287 | hasForcedTextTrack = true; |
| 2288 | forcedTrackNumber = i; |
| 2289 | } |
| 2290 | } |
| 2291 | } |
| 2292 | if (hasForcedTextTrack) |
| 2293 | SetTrack(kTrackTypeRawText, forcedTrackNumber); |
| 2294 | else |
| 2295 | SetCaptionsEnabled(captionsEnabledbyDefault, false); |
| 2296 | |
2272 | 2297 | osdLock.unlock(); |
2273 | 2298 | } |
2274 | 2299 | |
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index a03205b..4e7e7d7 100644
a
|
b
|
void TV::FillOSDMenuSubtitles(const PlayerContext *ctx, OSD *osd, |
11146 | 11146 | osd->DialogAddButton(tr("Disable Subtitles"), ACTION_DISABLESUBS); |
11147 | 11147 | else if (have_subs && !enabled) |
11148 | 11148 | osd->DialogAddButton(tr("Enable Subtitles"), ACTION_ENABLESUBS); |
11149 | | if (!av_tracks.empty()) |
| 11149 | if (!av_tracks.empty() || !text_tracks.empty()) |
11150 | 11150 | { |
11151 | 11151 | if (forcedon) |
11152 | 11152 | { |
… |
… |
void TV::FillOSDMenuSubtitles(const PlayerContext *ctx, OSD *osd, |
11158 | 11158 | osd->DialogAddButton(tr("Enable Forced Subtitles"), |
11159 | 11159 | ACTION_ENABLEFORCEDSUBS); |
11160 | 11160 | } |
11161 | | osd->DialogAddButton(tr("Select Subtitle"), |
11162 | | "DIALOG_MENU_AVSUBTITLES_0", |
11163 | | true, selected == "AVSUBTITLES"); |
| 11161 | if (!av_tracks.empty()) |
| 11162 | osd->DialogAddButton(tr("Select Subtitle"), |
| 11163 | "DIALOG_MENU_AVSUBTITLES_0", |
| 11164 | true, selected == "AVSUBTITLES"); |
11164 | 11165 | } |
11165 | 11166 | if (havetext || !text_tracks.empty()) |
11166 | 11167 | { |