summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of plugins for MM backendsLars Knoll2021-01-221-1067/+0
| | | | | | | | | | There's no need for having those in plugins and we can further remove abstractions and simplify our code if the code is directly compiled into Qt Multimedia. Change-Id: I5267a6a776375d99be8f0de4207f0288d963e620 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* AVF: Set playback audio session category while playingVal Doroshchuk2020-09-101-1/+7
| | | | | | | | | | | | | Since when the application is active and then moved into the background then audio can be played fine. But if the application is already in the background then it will not play the audio. Decided to set AVAudioSessionCategoryPlayback with AVAudioSessionCategoryOptionMixWithOthers to audio session, which leads to restart playing from the background. Fixes: QTBUG-69949 Change-Id: I18fb4904b0810b7dfb63585278edbb8ee2f02d05 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-06-281-3/+3
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I5466906d759a7cc046d77a21e2c647a4b938d070 Reviewed-by: Val Doroshchuk <valentyn.doroshchuk@qt.io>
* AVFoundation: fix playback of files with spaces in their namesNick Korotysh2020-06-021-7/+7
| | | | | | | | | | | | | | | | | Used QUrl::toEncoded() instead of QUrl::toString(). Usage of QUrl::toString() leads to URLs which can contain spaces and as result such URLs are not accepted by AVPlayer, and it remains in unknown state because AVFMediaPlayerSession::processLoadStateChange() is not called at all. And as result, QMediaPlayer waits media loading forever. [ChangeLog][Platform Specific Changes][AVFoundation] Fixed playback of files with spaces in their names. Fixes: QTBUG-84585 Pick-to: 5.15 Change-Id: I69e522d048d88310803a7040f114ee808c18720b Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15v5.15.0-beta1Qt Forward Merge Bot2020-02-221-3/+5
|\ | | | | | | Change-Id: I04934575bd661b80b1f012a7e825dcd753d26908
| * AVF: Don't override AVPlayerLayer's bounds if already setVal Doroshchuk2020-02-201-3/+5
| | | | | | | | | | | | | | | | | | AVPlayerLayer's bounds can be changed while resizing, and should not be overridden by default/native size. Fixes: QTBUG-65536 Change-Id: I771b13e58606663ded80df3665454007d28836b7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | AVF: Introduce adoption of AVAssetResourceLoaderDelegate protocolVal Doroshchuk2020-02-201-11/+101
|/ | | | | | | | | | | | | | | | | | | | AVAssetResourceLoaderDelegate allows to load custom resources. Implemented resourceLoader:shouldWaitForLoadingOfRequestedResource to read data from QIODevice. The device should be seekable, and already should have all data available. Since there is a need to know total size of the stream. So the media player will wait for QIODevice::readyRead before loading the resource. Also it requires to have url together with the stream: QMediaPlayer->setMedia(QUrl("does_not_matter.mp3"), buffer); Since the backend uses extension to determine type of the stream. Fixes: QTBUG-69101 Change-Id: I8ab0b69f668ccd67c42a8e5d5c1ad518d3306cce Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* AVF: Only resume playback after a stalled buffer if really neededDominik Holland2020-02-061-1/+2
| | | | | | | | | | When AVFoundation reports that the media is now buffered, we only should resume the playback if the QMediaPlayer is in the according state. Fixes: QTBUG-81912 Change-Id: Idba30ecf6c9c7b87a1c67896d89faa9a1bceae10 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
* AVF: Don't use deprecated AVPlayerItem::seekToTime::CMTimeVal Doroshchuk2020-02-061-1/+1
| | | | | | | | | | | AVPlayerItem::seekToTime::CMTime is deprecated since 10.13 Also fixed to use accurate seeking by passing a time value of kCMTimeZero for both toleranceBefore and toleranceAfter. Fixes: QTBUG-81804 Change-Id: Ifafeb1fb5ca66ecba14d77abf315ebe6ffd45eab Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* AVF: Set the stopped state before emitting the status after EOSVal Doroshchuk2020-01-131-2/+1
| | | | | | | | | | | | Fixed a bug when the media status was changed and emitted, but the state was kept old, this prevented to start playing again in a loop if the loops were requested. This is a regression since 9dbdd5d. Fixes: QTBUG-81122 Change-Id: Id2c7d03a25cc22f7f45c6017d2da0af9bb52e528 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-151-0/+13
|\ | | | | | | | | | | | | | | Conflicts: src/multimedia/video/qvideoframe.cpp src/plugins/directshow/player/directshowplayercontrol.cpp Change-Id: I00840245e35861cf4fe1d62789815ca125b2052a
| * AVF: Emit StalledMedia when unbuffered and resume playback afterwardsVaL Doroshchuk2019-10-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | If remote source is requested to play but there is a limitation in network bandwidth, StalledMedia status is never emitted, also the playback is not resumed after buffer gets full again. Based on AVPlayerItem.playbackLikelyToKeepUp introduced changing the media status and resuming the playback. Task-number: QTBUG-49806 Change-Id: If8aa10a1ea2cee2a40c679871b836d2dca622fcd Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* | Deprecate canonicalUrl and canonicalRequest in QMediaContentVaL Doroshchuk2019-05-131-3/+3
|/ | | | | | | | | | | Since QMediaContent can contain only one content and media resources are already deprecated, canonicalUrl and canonicalRequest are a bit confusing and outdated. Deprecated and replaced by QMediaContent::request() which already contains the url. Change-Id: I418006e112f49466b0129bf1e6e1ae629c714538 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* avfoundation: fix compiler warnings regarding Objective-CJochen Seemann2019-01-041-9/+9
| | | | | | | warning: declaration of instance variables in the interface is deprecated [-Wobjc-interface-ivars] Change-Id: I3763d207d916bc4f0355a282b47769d5404ea087 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* avfoundation: modernize by using nullptr and overrideJochen Seemann2019-01-041-28/+28
| | | | | Change-Id: Ifd483f925ed69f0ba35c46facfdb571dea87c1ac Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-13/+28
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm Change-Id: Ic43fb2a805ed9f0f2ea48993d47859716f1f11b4
| * AVFoundation: use observer for tracking durationJochen Seemann2018-01-081-13/+28
| | | | | | | | | | | | | | | | | | | | For getting the duration of a video, Apple advises to use AVPlayerItem.duration and tracking its duration changes with an observer. Task-number: QTBUG-49558 Change-Id: Ia2adc0d23deacd185f8c338f7f44948db2444beb Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | AVFoundation: implement bufferStateJochen Seemann2017-12-211-3/+31
|/ | | | | | | | | This add support for the buffer status with AVPlayerItem.playbackLikelyToKeepUp. It only supports buffer status values of 0 and 100. Change-Id: I5779ea360fe9c497ecc0236e442850422d96ac87 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* AVF: Fix mediaplayer state and status issuesChristian Strømme2017-04-261-50/+83
| | | | | | | | | This fixes the issues that were causing the whole qmediaplayerbackend test to be blacklisted on macOS. Task-number: QTBUG-46368 Change-Id: I59a35dd50a9c07e4e4382c5facb391f5c8a27ee7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove deprecated QSysInfo APIs and dead code from macOS/iOS backendJake Petroules2016-09-231-16/+1
| | | | | | | Deployment targets are currently macOS 10.9 and iOS 7.0. Change-Id: I500a95c00eb3be6e693e38f0f2205941f7bc9601 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-271-3/+13
|\ | | | | | | Change-Id: I639d42e78a2b85e939c9f8e9dd5da70cdc058857
| * AVFoundation: fix memory leakYoann Lopes2016-08-221-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Using 'self' in a block maintains a strong reference to it, the previous code would never release that reference and therefore leak the AVFMediaPlayerSessionObserver object when the session was deleted. Captured variables used in the relevant block are now marked with '__block' to make sure no strong references are maintained. We now also make sure the session still exist when that callback block is called. Change-Id: I847b524d8692559fe5884517abb5b9cc7696b4fd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-6/+15
|\| | | | | | | Change-Id: I3204cdf695f4b47730a88a7c41fc7a6de967b161
| * AVFoundation: fix mediaStatus and state changesYoann Lopes2016-08-121-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | When both state and mediaStatus are updated at the same time, make sure both variables are updated before emitting the corresponding signals. Also, always emit mediaStatusChanged() signals before stateChanged() to make sure mediaStatus changes are not cancelled by some action resulting from a state change. Task-number: QTBUG-49578 Change-Id: I0caea8261120595227834dbac7fed286d125bcab Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | Updated license headersAntti Kokko2016-01-191-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I324f65c61171f36641472964d095d72e452afb3a Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* AVFoundation: implemented QMediaPlayer::seekable.Yoann Lopes2015-09-151-1/+14
| | | | | Change-Id: Iaca8daa2460062954497b3e510dd1828953c80fd Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* AVFoundation: fix rendering when player reached EndOfMedia.Yoann Lopes2015-09-151-0/+5
| | | | | | | | | | | Once the media player reached the end of the media, it shouldn't be rendering frames anymore. This could happen when seeking after reaching the end. The output layer is now cleared on EndOfMedia to make sure that doesn't happen. Change-Id: I18a21eaff6c63a2bd54d4c2953f89eb1722f66d5 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* AVFoundation: correctly unload current media.Yoann Lopes2015-09-151-31/+14
| | | | | | | | | | When loading a new media, we should unload the previous media. This makes sure all properties set right after loading a new media (e.g. position, volume) are correctly set on the new AVPlayer and not on the old one. Change-Id: I4cd71b785ccdb4cd0772cedffc3c25665f402776 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* AVFoundation: store seek requests before media is loaded.Yoann Lopes2015-09-151-5/+26
| | | | | | | | And actually seek once the media is loaded. Task-number: QTBUG-48057 Change-Id: I9446a1e66a48f9a94c039be9af81689ed04bc56c Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* AVFoundation: fix initial volume.Yoann Lopes2015-09-151-22/+25
| | | | | | | | | | The volume level set before loading a media was never actually set on AVPlayer. Regression introduced by 4e07ff99 on OSX. Task-number: QTBUG-48154 Change-Id: I599e3d55b35d7196aebc4753a367a29049f99d33 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* AVFoundation: fix playback rate.Yoann Lopes2015-09-151-8/+10
| | | | | | | | | | | | Calling play on the AVPlayer internally resets the playback rate, which means any playback rate set before calling play was ignored. We now always call setRate to start playback to avoid resetting the rate with play. Aslo fixed the playbackRateChanged() signal that was never emitted. Task-number: QTBUG-45570 Change-Id: I3a77e1db31c57f1e3491287bdf977731b9d73509 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* OSX/iOS: Fix volume and muteFrank Osterfeld2015-05-111-2/+2
| | | | | | | | | My last fix for iOS (4e07ff99) introduced this regression of passing the outdated value to the native player object. Change-Id: I01b0df8c7a0fe1382ef73b55d288a40daf024e3d Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* ios: Enable volume and mute functionalityFrank Osterfeld2015-02-251-9/+21
| | | | | | | | | | | AVPlayer::setVolume and setMute also exist on iOS, so no need to ifdef them to be OS X-only. As they require iOS 7.0, add runtime checks to ensure that the methods exist. Task-number: QTBUG-39240 Change-Id: I10810705cef8e5d8c18e4c79a15fa06425ea57f9 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com> Reviewed-by: James Turner <james.turner@kdab.com>
* Update copyright headersAntti Kokko2015-02-121-22/+14
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I1c6faa4f59f8eca54f01ef20941fa60161dd7872 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* AVFoundation: fix media player video rendering in QML.Yoann Lopes2014-10-011-17/+4
| | | | | | | | | The AVPlayerLayer was set on the QVideoRendererControl before its geometry was updated, causing the renderer control to display frames with an invalid size. Change-Id: I90e18dce69d4b48a3d7932d44a7eab4fd443f1fb Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Fixed avfmediaplayersession.mm for OSX 10.10 Yosemite.Jens Cornelis2014-09-111-1/+1
| | | | | | | | Implicit cast caused build to fail. Explicit cast builds fine. Task-number: QTBUG-41136 Change-Id: I0147c26a0f8b8198d6ed9944311547b81a50bccb Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* AVFoundation: fix retrieving tracks information from live sources.Yoann Lopes2014-08-251-51/+52
| | | | | | | | | | | | | | For live sources, tracks information is available only after the AVPlayer changed its status to AVPlayerStatusReadyToPlay. It also seems to be available only from AVPlayerItem.tracks rather than AVAsset.tracks. The audioAvailableChanged() and videoAvailableChanged() signals are now correclty emitted and the video layer is correctly positioned for live sources. Task-number: QTBUG-38666 Change-Id: I8ee015a6ce81694c1fc1e44c679887cf7ccb0fd6 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* AVFoundation: Fix another crash when destroying a QMediaPlayerAndy Nichols2014-03-141-2/+2
| | | | | | | | We need to unload media before we delete the player. Task-number: QTBUG-37447 Change-Id: I09263214c425339c0d8c192091aeaa6e3fb5331f Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* AVFoundation: Prevent Crash in QMediaPlayerAndy Nichols2014-03-071-1/+4
| | | | | | | Task-number: QTBUG-34213 Change-Id: I0883436175439abbb4ea964ed552a17b970ed05c Reviewed-by: Michael Bruning <michael.bruning@digia.com> Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Fixes mediaplayer crashes on OSXtom2014-01-241-11/+23
| | | | | | | | | | | | | Fixes the "libqavfmediaplayer.dylib 0x0000000110fa7c8c -[AVFMediaPlayerSessionObserver unloadMedia]" crash on Macs. The problem was: writing to memory that had already been released. If not sure, one should always check if the objects exist before deleting it. Solution tested on OSX 10.7, 10.8, 10.9 [ChangeLog][qtmultimedia][avfmediaplayersession] Task-number: QTBUG-34213 Change-Id: Iac108711851c348e96e73542b4e71653007eeb54 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* AVFoundation: Enable use of QMediaPlayer for audio on iOSAndy Nichols2013-08-271-2/+6
| | | | | | | | | This commit disables the video components of the AVFoundation mediaplayer backend when building for iOS and enables the use of QMediaPlayer with audio assets. Change-Id: Iadd6f9c61ed1e656301326e90a22cbca6428b654 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* AVFoundation: Emit error when media fails to loadAndy Nichols2013-04-171-8/+8
| | | | | | | | | | | This also makes sure that if you attempt to load an invalid media file while another file is playing that the old session is stopped. Task-number: QTBUG-30411 Change-Id: Ied4dbaffeac50465112c1e94e7c69d1600a6de51 Reviewed-by: Christian Stromme <christian.stromme@digia.com> Reviewed-by: Dan Winkler <dantwinkler@gmail.com>
* AVFoundation: Remove stray semicolon after conditionAndy Nichols2013-04-161-1/+1
| | | | | Change-Id: I1c9a822ee54e7c189fe8806a11334cd23cd79a31 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Doc: Fix minor typosSze Howe Koh2013-04-101-1/+1
| | | | | | Task-number: QTWEBSITE-514 Change-Id: Ie8f3689d18d15fd0e88e0ada4a745d9994d9c2ae Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: Ia8c1c38aba1544603fada8c414cc856f365fd15b Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Compile in 32-bit mode.Morten Johan Sørvig2013-01-081-4/+4
| | | | | | | | | | CGRect == NSRect only in 64-bit mode. Don't add -framework QuickTime based on the host arch, use QT_ARCH instead. Change-Id: I829bc1bcfe37f70a07e8c55a5bc7dee90aaa981a Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* Add MediaPlayer support to AVFoundation pluginAndy Nichols2012-10-191-0/+832
This plugin would be used on Mac 10.7+ where without the QuickTime C API our QT7 media player performance was crippled. Change-Id: Iaadb1990a8f63393c4cd02d096624e0fed42b40f Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jason Barron <jason.barron@digia.com> Reviewed-by: Andy Nichols <andy.nichols@digia.com>