AVDemuxer mediastatus after unload call?
Gilles Caulier
caulier.gilles at gmail.com
Sun Sep 18 17:17:37 BST 2022
Looking in source code :
mediastatus() return an internal variable based on MediaStatus enum :
https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/video/qtav/ffmpeg/AVDemuxer.cpp#L660
Defined here :
https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/video/qtav/utils/QtAV_Global.h#L76
So the private value of AVDemuxer::Private::media_status is only
changed in class by the provate method AVDemuxer::setMediaStatus(),
which is called only in AVDemuxer. So to hack; all must be located in
the class, including a bug if any...
Gilles
Le dim. 18 sept. 2022 à 01:19, Steven Robbins <steve at sumost.ca> a écrit :
>
> Looking for a sanity check on my understanding. I've written a test case (see
> below) that passes. What puzzles me is that the call to mediaStatus() returns
> "LoadedMedia" after a call to unload(). Is that correct?
>
>
> void status()
> {
> AVDemuxer demux;
> QCOMPARE(demux.mediaStatus(), MediaStatus::NoMedia);
> QCOMPARE(demux.atEnd(), false);
> QCOMPARE(demux.fileName(), QLatin1String(""));
> QCOMPARE(demux.isLoaded(), false);
>
> QVERIFY(demux.setMedia(testFile1()));
> QCOMPARE(demux.mediaStatus(), MediaStatus::NoMedia);
> QCOMPARE(demux.atEnd(), false);
> QCOMPARE(demux.fileName(), testFile1());
> QCOMPARE(demux.isLoaded(), false);
>
> QVERIFY(demux.load());
> QCOMPARE(demux.mediaStatus(), MediaStatus::LoadedMedia);
> QCOMPARE(demux.atEnd(), false);
> QCOMPARE(demux.fileName(), testFile1());
> QCOMPARE(demux.isLoaded(), true);
>
> QVERIFY(demux.unload());
> QCOMPARE(demux.mediaStatus(), MediaStatus::LoadedMedia); // ??? why
> status shows loaded?
> QCOMPARE(demux.atEnd(), false);
> QCOMPARE(demux.fileName(), testFile1());
> QCOMPARE(demux.isLoaded(), false);
> }
>
More information about the Digikam-devel
mailing list