diff --git a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp
index 0fb91b1..58abb8d 100644
a
|
b
|
void AvFormatDecoderDVD::PostProcessTracks(void) |
53 | 53 | |
54 | 54 | if (tracks[kTrackTypeSubtitle].size() > 0) |
55 | 55 | { |
| 56 | map<int,uint> lang_sub_cnt; |
56 | 57 | stable_sort(tracks[kTrackTypeSubtitle].begin(), |
57 | 58 | tracks[kTrackTypeSubtitle].end()); |
| 59 | |
| 60 | // Get all subtitle tracks from the DVD and filter out any other tracks |
| 61 | // reported by ffmpeg |
| 62 | sinfo_vec_t filteredTracks; |
| 63 | for (unsigned int i = 0; i < 32; ++i) |
| 64 | { |
| 65 | int track = ringBuffer->DVD()->GetSubtitleTrackNum(i); |
| 66 | if (track >= 0 && |
| 67 | track < (int)tracks[kTrackTypeSubtitle].size()) |
| 68 | { |
| 69 | int lang = ringBuffer->DVD()->GetSubtitleLanguage(i); |
| 70 | int lang_indx = lang_sub_cnt[lang]++; |
| 71 | filteredTracks.push_back(tracks[kTrackTypeSubtitle][track]); |
| 72 | filteredTracks.back().language = lang; |
| 73 | filteredTracks.back().language_index = lang_indx; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | tracks[kTrackTypeSubtitle] = filteredTracks; |
| 78 | |
58 | 79 | sinfo_vec_t::iterator it = tracks[kTrackTypeSubtitle].begin(); |
59 | 80 | for(; it != tracks[kTrackTypeSubtitle].end(); ++it) |
60 | 81 | { |
… |
… |
void AvFormatDecoderDVD::PostProcessTracks(void) |
62 | 83 | QString("DVD Subtitle Track Map Stream id #%1 ") |
63 | 84 | .arg(it->stream_id)); |
64 | 85 | } |
65 | | stable_sort(tracks[kTrackTypeSubtitle].begin(), |
66 | | tracks[kTrackTypeSubtitle].end()); |
| 86 | |
67 | 87 | int trackNo = ringBuffer->DVD()->GetTrack(kTrackTypeSubtitle); |
68 | 88 | uint captionmode = m_parent->GetCaptionMode(); |
69 | 89 | int trackcount = (int)GetTrackCount(kTrackTypeSubtitle); |
diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
index 5b066bc..1953bdd 100644
a
|
b
|
uint DVDRingBuffer::GetSubtitleLanguage(int id) |
1574 | 1574 | return ConvertLangCode(lang); |
1575 | 1575 | } |
1576 | 1576 | |
| 1577 | /** \brief get the logical subtitle track/stream number from the dvd |
| 1578 | * \param stream_index the stream index, range 0-31 |
| 1579 | */ |
| 1580 | int DVDRingBuffer::GetSubtitleTrackNum(uint stream_index) |
| 1581 | { |
| 1582 | return dvdnav_get_spu_logical_stream(m_dvdnav, stream_index); |
| 1583 | } |
| 1584 | |
1577 | 1585 | /** \brief converts the subtitle/audio lang code to iso639. |
1578 | 1586 | */ |
1579 | 1587 | uint DVDRingBuffer::ConvertLangCode(uint16_t code) |
diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.h b/mythtv/libs/libmythtv/DVD/dvdringbuffer.h
index d803627..30818eb 100644
a
|
b
|
class MTV_PUBLIC DVDRingBuffer : public RingBuffer |
91 | 91 | |
92 | 92 | // Subtitles |
93 | 93 | uint GetSubtitleLanguage(int key); |
| 94 | int GetSubtitleTrackNum(uint stream_index); |
94 | 95 | bool DecodeSubtitles(AVSubtitle * sub, int * gotSubtitles, |
95 | 96 | const uint8_t * buf, int buf_size); |
96 | 97 | |