Skip to content

Conversation

@danieloneill
Copy link

Implemented simply as:

QList<QVariantMap> QAVDemuxer::chapters() const
QList<QVariantMap> QAVPlayer::chapters() const;

Also stores chapter metadata as QVariantMap under the "metadata" key. Timestamps converted to double.

if (d->ctx == nullptr)
return result;

for (int i = 0; i < d->ctx->nb_chapters; i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks nb_chapters is unsigned int, so better to use unsigned i

QObject::connect(&p, &QAVPlayer::mediaStatusChanged, [&](auto status) {
qDebug() << "mediaStatusChanged"<< status << p.state();
if (status == QAVPlayer::LoadedMedia) {
auto chaps = p.chapters();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big thanks for contribution!
Just small question, do you have any media with chapters? can we generate and put to test data and make very simple test that it returns correct data?
Thanks

double videoFrameRate() const;

QMap<QString, QString> metadata() const;
QList<QVariantMap> chapters() const;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, do you need to have QVariant there or could be just strings? How is it used? for info only or need to compare/cast?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants