Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Implement method of reading chapters (with metadata) from loaded media#551

Open
danieloneill wants to merge 1 commit into
valbok:mastervalbok/QtAVPlayer:masterfrom
danieloneill:masterdanieloneill/QtAVPlayer:masterCopy head branch name to clipboard
Open

Implement method of reading chapters (with metadata) from loaded media#551
danieloneill wants to merge 1 commit into
valbok:mastervalbok/QtAVPlayer:masterfrom
danieloneill:masterdanieloneill/QtAVPlayer:masterCopy head branch name to clipboard

Conversation

@danieloneill

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@valbok

valbok commented Mar 18, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution, but I am not able to merge this without passing https://github.com/valbok/QtAVPlayer/actions/runs/20768227211/job/59672648127?pr=551 also interesting if it is possible to find simple unittest. Thanks

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.