The threading logic was changed somewhat. UBQuickTimeFile's run()
function no longer handles enqueuing the video/audio samples in a while
loop. Instead, it runs once, and uses Apple's Dispatch Queues to handle
enqueuing samples.
One dispatch queue was thus added for each input to the AssetWriter.
Each input is associated to one queue, and the requestMediaDataWhenReady
function insures that the inputs go and fetch any available samples when
they are able to write them.
As tested (for short podcasts, repeatedly), this solves all the problems
encountered earlier, such as the program hanging due to one input not
being ready, or corrupt files due (presumably) to missing samples.
Due to QWidget::showFullScreen having side-effects on OSX (setting the
dock and menubar to autohide, making it impossible to then set them as
hidden), the calls to that method were replaced with
UBPlatformUtils::showFullScreen(QWidget *). This function then calls
QWidget::showMaximized() on OSX, or QWidget::showFullScreen() on Linux
and Windows.
It is currently still impossible to switch smoothly between showing or
hiding the dock on OSX; current behaviour is to hide it all the time,
even in desktop mode.
- Removed commented out obsolete code that had been added
- Removed objects that were never used (mAudioOutput, audioFormat etc)
- Re-made changes that had been reverted since commit cdb5633
Migrated all QuickTime-related code to modern AVFoundation / Core Video
/ Core Media equivalents.
Audio support was temporarily removed; to be re-established ASAP.
Beginnings of doxygen-style function documentation was added
Application compiles and runs, with some caveats. Full list of changes:
- minor changes related to Qt4->Qt5 API differences
- Replaced calls to Carbon framework by Cocoa
- Removed registering of AE event handler. Seems to be done
automatically in Qt5.
- temporarily removed Podcast functionality, pending (presumably)
complete re-write due to Quicktime being obsolete in newer OS X
versions.
- Created OBCocoa namespace, and associated files src/core/OBCocoa.h/.mm, to
handle OS X - specific system calls. Currently used only by
UBApplication, but can in the future provide a useful interface between
the cocoa framework and OB, to avoid having too much OSX-specific code
in various files
Long version:
UBGraphicsPolygonItem::shape() sometimes caused OpenBoard to crash due to
inifinite recursion. This is easily replicated by trying to use the
highlighting tool.
The reason is: shape() calls boundingRect(); this function's definition is:
QRectF QGraphicsPolygonItem::boundingRect() const
{
Q_D(const QGraphicsPolygonItem);
if (d->boundingRect.isNull()) {
qreal pw = pen().style() == Qt::NoPen ? qreal(0) : pen().widthF();
if (pw == 0.0)
d->boundingRect = d->polygon.boundingRect();
else
d->boundingRect = shape().controlPointRect();
}
return d->boundingRect;
}
In the case where pw != 0, the shape() function is called. However, it
is shape() from the derived class, not the base class, which is called.
In other words, UBGraphicsPolygonItem::shape() is called rather than
QGraphicsPolygonItem::shape().
This means that boundingRect() is called again from within shape(), and
so on, causing the program to crash.
The fix was simply to remove UBGraphicsPolygonItem::shape(), as it
appears to provide the same (or very similar) functionality to that of
the base class's shape() function.
In case this shape() function actually is needed, another workaround
should be implemented to prevent this infinite recursion.