audio.reset (new AudioDecoder (this, c->audio, log, fast));
}
if (c->subtitle) {
- subtitle.reset (new SubtitleDecoder (this, c->subtitle, log));
+ /* XXX: this time here should be the time of the first subtitle, not 0 */
+ subtitle.reset (new SubtitleDecoder (this, c->subtitle, log, ContentTime()));
}
shared_ptr<dcp::CPL> cpl;
DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content, shared_ptr<Log> log)
{
- subtitle.reset (new SubtitleDecoder (this, content->subtitle, log));
-
shared_ptr<dcp::SubtitleAsset> c (load (content->path (0)));
_subtitles = c->subtitles ();
_next = _subtitles.begin ();
+
+ ContentTime first;
+ if (_next != _subtitles.end()) {
+ first = content_time_period(*_next).from;
+ }
+ subtitle.reset (new SubtitleDecoder (this, content->subtitle, log, first));
}
void
}
if (c->subtitle) {
- subtitle.reset (new SubtitleDecoder (this, c->subtitle, log));
+ /* XXX: this time here should be the time of the first subtitle, not 0 */
+ subtitle.reset (new SubtitleDecoder (this, c->subtitle, log, ContentTime()));
}
_next_time.resize (_format_context->nb_streams);
SubtitleDecoder::SubtitleDecoder (
Decoder* parent,
shared_ptr<const SubtitleContent> c,
- shared_ptr<Log> log
+ shared_ptr<Log> log,
+ ContentTime first
)
: DecoderPart (parent, log)
, _content (c)
+ , _position (first)
{
}
class SubtitleDecoder : public DecoderPart
{
public:
- /** Second parameter to the _during functions is true if we
- * want only subtitles that start during the period,
- * otherwise we want subtitles that overlap the period.
- */
SubtitleDecoder (
Decoder* parent,
boost::shared_ptr<const SubtitleContent>,
- boost::shared_ptr<Log> log
+ boost::shared_ptr<Log> log,
+ ContentTime first
);
ContentTime position () const {
: TextSubtitle (content)
, _next (0)
{
- subtitle.reset (new SubtitleDecoder (this, content->subtitle, log));
+ ContentTime first;
+ if (!_subtitles.empty()) {
+ first = content_time_period(_subtitles[0]).from;
+ }
+ subtitle.reset (new SubtitleDecoder (this, content->subtitle, log, first));
}
void