Exemple #1
0
QList< ChapterInfo > FormatContext::getChapters() const
{
	QList< ChapterInfo > chapters;
	for (unsigned i = 0; i < formatCtx->nb_chapters; i++)
	{
		AVChapter &chapter = *formatCtx->chapters[i];
		ChapterInfo chapterInfo(chapter.start * chapter.time_base.num / (double)chapter.time_base.den, chapter.end * chapter.time_base.num / (double)chapter.time_base.den);
		if (AVDictionaryEntry *avtag = av_dict_get(chapter.metadata, "title", NULL, AV_DICT_IGNORE_SUFFIX))
			chapterInfo.title = avtag->value;
		chapters += chapterInfo;
	}
	return chapters;
}
Exemple #2
0
QList<ChapterInfo> FormatContext::getChapters() const
{
    QList<ChapterInfo> chapters;
    for (unsigned i = 0; i < formatCtx->nb_chapters; ++i)
    {
        const AVChapter &chapter = *formatCtx->chapters[i];
        const double mul = (double)chapter.time_base.num / (double)chapter.time_base.den;
        ChapterInfo chapterInfo(chapter.start * mul, chapter.end * mul);
        chapterInfo.title = getTag(chapter.metadata, "title", false);
        chapters += chapterInfo;
    }
    return chapters;
}