* (a) give us what we want, or
* (b) hit the end of the decoder.
*/
- while (!pass(PASS_REASON_SUBTITLE) && (subs.empty() || (subs.back().period().to < sp.back().to))) {}
+ while (!pass () && (subs.empty() || (subs.back().period().to < sp.back().to))) {}
/* Now look for what we wanted in the data we have collected */
/* XXX: inefficient */
-
+
list<T> out;
for (typename list<T>::const_iterator i = subs.begin(); i != subs.end(); ++i) {
if ((starting && period.contains (i->period().from)) || (!starting && period.overlaps (i->period ()))) {
}
}
- /* XXX: should clear out _decoded_* at some point */
+ /* Discard anything in _decoded_image_subtitles that is outside 5 seconds either side of period */
+
+ list<ContentImageSubtitle>::iterator i = _decoded_image_subtitles.begin();
+ while (i != _decoded_image_subtitles.end()) {
+ list<ContentImageSubtitle>::iterator tmp = i;
+ ++tmp;
+
+ if (
+ i->period().to < (period.from - ContentTime::from_seconds (5)) ||
+ i->period().from > (period.to + ContentTime::from_seconds (5))
+ ) {
+ _decoded_image_subtitles.erase (i);
+ }
+
+ i = tmp;
+ }
return out;
}