diff options
author | Mike Krus <mike.krus@kdab.com> | 2015-12-30 12:02:18 +0000 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2016-01-13 14:16:40 +0000 |
commit | a12f3d6fee700fb19b51b85934acddf536c483cf (patch) | |
tree | ed6d0670335e90e86b5bd1e3c0ca64957c38c966 | |
parent | b323f7803abb3dff5ffd92dd6d9f228cb9a55c40 (diff) | |
download | qtmultimedia-a12f3d6fee700fb19b51b85934acddf536c483cf.tar.gz |
tvOS support
Builds, tested simple video playback
Change-Id: I04e1da050c587cba3609107dc88a155a6949f2c3
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
12 files changed, 33 insertions, 28 deletions
diff --git a/src/plugins/avfoundation/avfoundation.pro b/src/plugins/avfoundation/avfoundation.pro index c05331d20..1110e196b 100644 --- a/src/plugins/avfoundation/avfoundation.pro +++ b/src/plugins/avfoundation/avfoundation.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += mediaplayer \ - camera +SUBDIRS += mediaplayer +!tvos: SUBDIRS += camera diff --git a/src/plugins/avfoundation/mediaplayer/avfdisplaylink.h b/src/plugins/avfoundation/mediaplayer/avfdisplaylink.h index 6e00ee80d..79dfb5165 100644 --- a/src/plugins/avfoundation/mediaplayer/avfdisplaylink.h +++ b/src/plugins/avfoundation/mediaplayer/avfdisplaylink.h @@ -37,7 +37,7 @@ #include <QtCore/qobject.h> #include <QtCore/qmutex.h> -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) #include <CoreVideo/CVBase.h> #else #include <QuartzCore/CVDisplayLink.h> @@ -68,7 +68,7 @@ protected: virtual bool event(QEvent *); private: -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) void *m_displayLink; #else CVDisplayLinkRef m_displayLink; diff --git a/src/plugins/avfoundation/mediaplayer/avfdisplaylink.mm b/src/plugins/avfoundation/mediaplayer/avfdisplaylink.mm index 47b6b8324..d2ce841fa 100644 --- a/src/plugins/avfoundation/mediaplayer/avfdisplaylink.mm +++ b/src/plugins/avfoundation/mediaplayer/avfdisplaylink.mm @@ -38,7 +38,7 @@ #include <QtCore/qdebug.h> #endif -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) #import <QuartzCore/CADisplayLink.h> #import <Foundation/NSRunLoop.h> #define _m_displayLink static_cast<DisplayLinkObserver*>(m_displayLink) @@ -47,7 +47,7 @@ QT_USE_NAMESPACE -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) @interface DisplayLinkObserver : NSObject { AVFDisplayLink *m_avfDisplayLink; @@ -127,7 +127,7 @@ AVFDisplayLink::AVFDisplayLink(QObject *parent) , m_pendingDisplayLinkEvent(false) , m_isActive(false) { -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) m_displayLink = [[DisplayLinkObserver alloc] initWithAVFDisplayLink:this]; #else // create display link for the main display @@ -150,7 +150,7 @@ AVFDisplayLink::~AVFDisplayLink() if (m_displayLink) { stop(); -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) [_m_displayLink release]; #else CVDisplayLinkRelease(m_displayLink); @@ -172,7 +172,7 @@ bool AVFDisplayLink::isActive() const void AVFDisplayLink::start() { if (m_displayLink && !m_isActive) { -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) [_m_displayLink start]; #else CVDisplayLinkStart(m_displayLink); @@ -184,7 +184,7 @@ void AVFDisplayLink::start() void AVFDisplayLink::stop() { if (m_displayLink && m_isActive) { -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) [_m_displayLink stop]; #else CVDisplayLinkStop(m_displayLink); @@ -202,7 +202,7 @@ void AVFDisplayLink::displayLinkEvent(const CVTimeStamp *ts) m_displayLinkMutex.lock(); bool pending = m_pendingDisplayLinkEvent; m_pendingDisplayLinkEvent = true; -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) Q_UNUSED(ts); memset(&m_frameTimeStamp, 0, sizeof(CVTimeStamp)); #else diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm index 4049ea6e4..62b4d5d29 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm @@ -62,7 +62,7 @@ AVFMediaPlayerService::AVFMediaPlayerService(QObject *parent) // AVPlayerItemVideoOutput is available in SDK #if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_8, __IPHONE_6_0) // might not be available at runtime - #if defined(Q_OS_IOS) + #if defined(Q_OS_IOS) || defined(Q_OS_TVOS) m_enableRenderControl = [AVPlayerItemVideoOutput class] != 0; #endif #endif diff --git a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.h b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.h index a46026f54..0fc091af9 100644 --- a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.h +++ b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer_ios.h @@ -53,7 +53,7 @@ class QAbstractVideoSurface; typedef struct __CVBuffer *CVBufferRef; typedef CVBufferRef CVImageBufferRef; typedef CVImageBufferRef CVPixelBufferRef; -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) typedef struct __CVOpenGLESTextureCache *CVOpenGLESTextureCacheRef; typedef CVImageBufferRef CVOpenGLESTextureRef; // helpers to avoid boring if def diff --git a/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm b/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm index 03000ea43..d067c7f0b 100644 --- a/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm +++ b/src/plugins/avfoundation/mediaplayer/avfvideorenderercontrol.mm @@ -34,7 +34,7 @@ #include "avfvideorenderercontrol.h" #include "avfdisplaylink.h" -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) #include "avfvideoframerenderer_ios.h" #else #include "avfvideoframerenderer.h" @@ -52,7 +52,7 @@ QT_USE_NAMESPACE -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) class TextureCacheVideoBuffer : public QAbstractVideoBuffer { public: @@ -164,7 +164,7 @@ void AVFVideoRendererControl::setSurface(QAbstractVideoSurface *surface) //Surface changed, so we need a new frame renderer m_frameRenderer = new AVFVideoFrameRenderer(m_surface, this); -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) if (m_playerLayer) { m_frameRenderer->setPlayerLayer(static_cast<AVPlayerLayer*>(m_playerLayer)); } @@ -195,7 +195,7 @@ void AVFVideoRendererControl::setLayer(void *playerLayer) if (m_surface && m_surface->isActive()) m_surface->stop(); -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) if (m_frameRenderer) { m_frameRenderer->setPlayerLayer(static_cast<AVPlayerLayer*>(playerLayer)); } @@ -230,7 +230,7 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts) return; if (m_enableOpenGL) { -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) CVOGLTextureRef tex = m_frameRenderer->renderLayerToTexture(playerLayer); //Make sure we got a valid texture @@ -254,7 +254,7 @@ void AVFVideoRendererControl::updateVideoFrame(const CVTimeStamp &ts) if (!m_surface->isActive()) { QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), QAbstractVideoBuffer::GLTextureHandle); -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) format.setScanLineDirection(QVideoSurfaceFormat::TopToBottom); #else format.setScanLineDirection(QVideoSurfaceFormat::BottomToTop); diff --git a/src/plugins/avfoundation/mediaplayer/mediaplayer.pro b/src/plugins/avfoundation/mediaplayer/mediaplayer.pro index 28cdc2727..8b5f14b4e 100644 --- a/src/plugins/avfoundation/mediaplayer/mediaplayer.pro +++ b/src/plugins/avfoundation/mediaplayer/mediaplayer.pro @@ -11,7 +11,7 @@ PLUGIN_TYPE = mediaservice PLUGIN_CLASS_NAME = AVFMediaPlayerServicePlugin load(qt_plugin) -LIBS += -framework AVFoundation -framework CoreMedia +LIBS += -framework AVFoundation -framework CoreMedia -framework CoreVideo -framework QuartzCore DEFINES += QMEDIA_AVF_MEDIAPLAYER @@ -44,7 +44,7 @@ OBJECTIVE_SOURCES += \ avfvideowidget.mm } -ios { +ios|tvos { contains(QT_CONFIG, opengl.*) { HEADERS += \ avfvideoframerenderer_ios.h \ @@ -56,8 +56,9 @@ ios { avfvideorenderercontrol.mm \ avfdisplaylink.mm } + LIBS += -framework Foundation } else { - LIBS += -framework QuartzCore -framework AppKit + LIBS += -framework AppKit contains(QT_CONFIG, opengl.*) { HEADERS += \ diff --git a/src/plugins/coreaudio/coreaudio.pro b/src/plugins/coreaudio/coreaudio.pro index 146851493..e01932c6a 100644 --- a/src/plugins/coreaudio/coreaudio.pro +++ b/src/plugins/coreaudio/coreaudio.pro @@ -24,10 +24,10 @@ OBJECTIVE_SOURCES += \ coreaudioplugin.mm \ coreaudioutils.mm -ios { +ios|tvos { HEADERS += coreaudiosessionmanager.h OBJECTIVE_SOURCES += coreaudiosessionmanager.mm - LIBS += -framework AVFoundation + LIBS += -framework Foundation -framework AVFoundation } else { LIBS += \ -framework ApplicationServices \ diff --git a/src/plugins/coreaudio/coreaudiodeviceinfo.mm b/src/plugins/coreaudio/coreaudiodeviceinfo.mm index f16389372..c221cb151 100644 --- a/src/plugins/coreaudio/coreaudiodeviceinfo.mm +++ b/src/plugins/coreaudio/coreaudiodeviceinfo.mm @@ -33,7 +33,7 @@ #include "coreaudiodeviceinfo.h" #include "coreaudioutils.h" -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) # include "coreaudiosessionmanager.h" #endif diff --git a/src/plugins/coreaudio/coreaudioinput.mm b/src/plugins/coreaudio/coreaudioinput.mm index e0cedb1b9..229a3a34e 100644 --- a/src/plugins/coreaudio/coreaudioinput.mm +++ b/src/plugins/coreaudio/coreaudioinput.mm @@ -39,7 +39,7 @@ # include <CoreServices/CoreServices.h> #endif -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) # include "coreaudiosessionmanager.h" #endif diff --git a/src/plugins/coreaudio/coreaudiooutput.mm b/src/plugins/coreaudio/coreaudiooutput.mm index 149b5a8c0..c0ad2bf2f 100644 --- a/src/plugins/coreaudio/coreaudiooutput.mm +++ b/src/plugins/coreaudio/coreaudiooutput.mm @@ -45,7 +45,7 @@ # include <CoreServices/CoreServices.h> #endif -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) # include <QtMultimedia/private/qaudiohelpers_p.h> #endif @@ -504,7 +504,7 @@ OSStatus CoreAudioOutput::renderCallback(void *inRefCon, AudioUnitRenderActionFl if (framesRead > 0) { ioData->mBuffers[0].mDataByteSize = framesRead * bytesPerFrame; d->m_totalFrames += framesRead; -#ifdef Q_OS_IOS +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) // on iOS we have to adjust the sound volume ourselves if (!qFuzzyCompare(d->m_cachedVolume, qreal(1.0f))) { QAudioHelperInternal::qMultiplySamples(d->m_cachedVolume, diff --git a/src/plugins/coreaudio/coreaudiosessionmanager.mm b/src/plugins/coreaudio/coreaudiosessionmanager.mm index 15d1ad86f..5c6b3b4d1 100644 --- a/src/plugins/coreaudio/coreaudiosessionmanager.mm +++ b/src/plugins/coreaudio/coreaudiosessionmanager.mm @@ -274,7 +274,9 @@ bool CoreAudioSessionManager::setCategory(CoreAudioSessionManager::AudioSessionC targetCategory = AVAudioSessionCategoryPlayAndRecord; break; case CoreAudioSessionManager::AudioProcessing: +#ifndef Q_OS_TVOS targetCategory = AVAudioSessionCategoryAudioProcessing; +#endif break; case CoreAudioSessionManager::MultiRoute: #if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0) @@ -348,8 +350,10 @@ CoreAudioSessionManager::AudioSessionCategorys CoreAudioSessionManager::category localCategory = Record; } else if (category == AVAudioSessionCategoryPlayAndRecord) { localCategory = PlayAndRecord; +#ifndef Q_OS_TVOS } else if (category == AVAudioSessionCategoryAudioProcessing) { localCategory = AudioProcessing; +#endif } else if ( #if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0) QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_6_0 && |