Video asset writer for iOS
AVFoundation on iOS lacks the ability to use AVCaptureVideoDataOutput and AVCaptureMovieFileOutput simultaneously. Right now viewfinder stops working as soon as we add movie file output. The only workaround we have now is to write video/audio 'maually' - creating asset writer and feeding it with audio/video samples. Change-Id: I33a63546783279c545f0433b5051287269825d3f Task-number: QTBUG-37655 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
committed by
Yoann Lopes
parent
aeb79d4a8b
commit
1508f775ac
@@ -78,6 +78,74 @@ private:
|
||||
bool m_locked;
|
||||
};
|
||||
|
||||
struct AVFObjectDeleter {
|
||||
static void cleanup(NSObject *obj)
|
||||
{
|
||||
if (obj)
|
||||
[obj release];
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class AVFScopedPointer : public QScopedPointer<NSObject, AVFObjectDeleter>
|
||||
{
|
||||
public:
|
||||
AVFScopedPointer() {}
|
||||
explicit AVFScopedPointer(T *ptr) : QScopedPointer(ptr) {}
|
||||
operator T*() const
|
||||
{
|
||||
// Quite handy operator to enable Obj-C messages: [ptr someMethod];
|
||||
return data();
|
||||
}
|
||||
|
||||
T *data() const
|
||||
{
|
||||
return static_cast<T *>(QScopedPointer::data());
|
||||
}
|
||||
|
||||
T *take()
|
||||
{
|
||||
return static_cast<T *>(QScopedPointer::take());
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class AVFScopedPointer<dispatch_queue_t>
|
||||
{
|
||||
public:
|
||||
AVFScopedPointer() : m_queue(0) {}
|
||||
explicit AVFScopedPointer(dispatch_queue_t q) : m_queue(q) {}
|
||||
|
||||
~AVFScopedPointer()
|
||||
{
|
||||
if (m_queue)
|
||||
dispatch_release(m_queue);
|
||||
}
|
||||
|
||||
operator dispatch_queue_t() const
|
||||
{
|
||||
// Quite handy operator to enable Obj-C messages: [ptr someMethod];
|
||||
return m_queue;
|
||||
}
|
||||
|
||||
dispatch_queue_t data() const
|
||||
{
|
||||
return m_queue;
|
||||
}
|
||||
|
||||
void reset(dispatch_queue_t q = 0)
|
||||
{
|
||||
if (m_queue)
|
||||
dispatch_release(m_queue);
|
||||
m_queue = q;
|
||||
}
|
||||
|
||||
private:
|
||||
dispatch_queue_t m_queue;
|
||||
|
||||
Q_DISABLE_COPY(AVFScopedPointer);
|
||||
};
|
||||
|
||||
inline QSysInfo::MacVersion qt_OS_limit(QSysInfo::MacVersion osxVersion,
|
||||
QSysInfo::MacVersion iosVersion)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user