summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp2
-rw-r--r--src/3rdparty/clucene/src/CLucene/util/Misc.cpp9
-rw-r--r--src/3rdparty/easing/easing.cpp670
-rw-r--r--src/3rdparty/easing/legal.qdoc35
-rw-r--r--src/3rdparty/phonon/qt7/mediaobject.h40
-rw-r--r--src/3rdparty/phonon/qt7/mediaobject.mm306
-rw-r--r--src/3rdparty/phonon/qt7/quicktimemetadata.h8
-rw-r--r--src/3rdparty/phonon/qt7/quicktimemetadata.mm41
-rw-r--r--src/3rdparty/phonon/qt7/quicktimevideoplayer.h27
-rw-r--r--src/3rdparty/phonon/qt7/quicktimevideoplayer.mm265
-rw-r--r--src/3rdparty/phonon/qt7/videoframe.mm24
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp22
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc3
19 files changed, 1314 insertions, 168 deletions
diff --git a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp
index 36c170a..e9659cf 100644
--- a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp
+++ b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp
@@ -624,7 +624,7 @@ LuceneLock* FSDirectory::makeLock(const QString& name)
QString lockFile(getLockPrefix());
- lockFile.append(QLatin1String("-")).append(name);
+ lockFile.append(QLatin1Char('-')).append(name);
return _CLNEW FSLock(lockDir, lockFile);
}
diff --git a/src/3rdparty/clucene/src/CLucene/util/Misc.cpp b/src/3rdparty/clucene/src/CLucene/util/Misc.cpp
index 069b487..cb2efe2 100644
--- a/src/3rdparty/clucene/src/CLucene/util/Misc.cpp
+++ b/src/3rdparty/clucene/src/CLucene/util/Misc.cpp
@@ -181,12 +181,9 @@ void Misc::segmentname(QString& buffer, int32_t bufferLen,
CND_PRECONDITION(!segment.isEmpty(), "segment is NULL");
CND_PRECONDITION(!ext.isEmpty(), "extention is NULL");
- buffer.clear();
- if (x == -1) {
- buffer = QString(segment + ext);
- } else {
- buffer = QString(QLatin1String("%1%2%3")).arg(segment).arg(ext).arg(x);
- }
+ buffer = segment + ext;
+ if (x != -1)
+ buffer += QString::number(x);
}
// #pragma mark -- TCHAR related utils
diff --git a/src/3rdparty/easing/easing.cpp b/src/3rdparty/easing/easing.cpp
new file mode 100644
index 0000000..81af40f
--- /dev/null
+++ b/src/3rdparty/easing/easing.cpp
@@ -0,0 +1,670 @@
+/*
+Disclaimer for Robert Penner's Easing Equations license:
+
+TERMS OF USE - EASING EQUATIONS
+
+Open source under the BSD License.
+
+Copyright © 2001 Robert Penner
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <QtCore/qmath.h>
+#include <math.h>
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#ifndef M_PI_2
+#define M_PI_2 (M_PI / 2)
+#endif
+
+QT_USE_NAMESPACE
+
+/**
+ * Easing equation function for a simple linear tweening, with no easing.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeNone(qreal progress)
+{
+ return progress;
+}
+
+/**
+ * Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInQuad(qreal t)
+{
+ return t*t;
+}
+
+/**
+* Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity.
+*
+* @param t Current time (in frames or seconds).
+* @return The correct value.
+*/
+static qreal easeOutQuad(qreal t)
+{
+ return -t*(t-2);
+}
+
+/**
+ * Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInOutQuad(qreal t)
+{
+ t*=2.0;
+ if (t < 1) {
+ return t*t/qreal(2);
+ } else {
+ --t;
+ return -0.5 * (t*(t-2) - 1);
+ }
+}
+
+/**
+ * Easing equation function for a quadratic (t^2) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutInQuad(qreal t)
+{
+ if (t < 0.5) return easeOutQuad (t*2)/2;
+ return easeInQuad((2*t)-1)/2 + 0.5;
+}
+
+/**
+ * Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInCubic(qreal t)
+{
+ return t*t*t;
+}
+
+/**
+ * Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutCubic(qreal t)
+{
+ t-=1.0;
+ return t*t*t + 1;
+}
+
+/**
+ * Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInOutCubic(qreal t)
+{
+ t*=2.0;
+ if(t < 1) {
+ return 0.5*t*t*t;
+ } else {
+ t -= qreal(2.0);
+ return 0.5*(t*t*t + 2);
+ }
+}
+
+/**
+ * Easing equation function for a cubic (t^3) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutInCubic(qreal t)
+{
+ if (t < 0.5) return easeOutCubic (2*t)/2;
+ return easeInCubic(2*t - 1)/2 + 0.5;
+}
+
+/**
+ * Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInQuart(qreal t)
+{
+ return t*t*t*t;
+}
+
+/**
+ * Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutQuart(qreal t)
+{
+ t-= qreal(1.0);
+ return - (t*t*t*t- 1);
+}
+
+/**
+ * Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInOutQuart(qreal t)
+{
+ t*=2;
+ if (t < 1) return 0.5*t*t*t*t;
+ else {
+ t -= 2.0f;
+ return -0.5 * (t*t*t*t- 2);
+ }
+}
+
+/**
+ * Easing equation function for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutInQuart(qreal t)
+{
+ if (t < 0.5) return easeOutQuart (2*t)/2;
+ return easeInQuart(2*t-1)/2 + 0.5;
+}
+
+/**
+ * Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInQuint(qreal t)
+{
+ return t*t*t*t*t;
+}
+
+/**
+ * Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutQuint(qreal t)
+{
+ t-=1.0;
+ return t*t*t*t*t + 1;
+}
+
+/**
+ * Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInOutQuint(qreal t)
+{
+ t*=2.0;
+ if (t < 1) return 0.5*t*t*t*t*t;
+ else {
+ t -= 2.0;
+ return 0.5*(t*t*t*t*t + 2);
+ }
+}
+
+/**
+ * Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutInQuint(qreal t)
+{
+ if (t < 0.5) return easeOutQuint (2*t)/2;
+ return easeInQuint(2*t - 1)/2 + 0.5;
+}
+
+/**
+ * Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInSine(qreal t)
+{
+ return (t == 1.0) ? 1.0 : -::cos(t * M_PI_2) + 1.0;
+}
+
+/**
+ * Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutSine(qreal t)
+{
+ return ::sin(t* M_PI_2);
+}
+
+/**
+ * Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInOutSine(qreal t)
+{
+ return -0.5 * (::cos(M_PI*t) - 1);
+}
+
+/**
+ * Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutInSine(qreal t)
+{
+ if (t < 0.5) return easeOutSine (2*t)/2;
+ return easeInSine(2*t - 1)/2 + 0.5;
+}
+
+/**
+ * Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInExpo(qreal t)
+{
+ return (t==0 || t == 1.0) ? t : ::qPow(2.0, 10 * (t - 1)) - qreal(0.001);
+}
+
+/**
+ * Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutExpo(qreal t)
+{
+ return (t==1.0) ? 1.0 : 1.001 * (-::qPow(2.0f, -10 * t) + 1);
+}
+
+/**
+ * Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInOutExpo(qreal t)
+{
+ if (t==0.0) return qreal(0.0);
+ if (t==1.0) return qreal(1.0);
+ t*=2.0;
+ if (t < 1) return 0.5 * ::qPow(qreal(2.0), 10 * (t - 1)) - 0.0005;
+ return 0.5 * 1.0005 * (-::qPow(qreal(2.0), -10 * (t - 1)) + 2);
+}
+
+/**
+ * Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutInExpo(qreal t)
+{
+ if (t < 0.5) return easeOutExpo (2*t)/2;
+ return easeInExpo(2*t - 1)/2 + 0.5;
+}
+
+/**
+ * Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInCirc(qreal t)
+{
+ return -(::sqrt(1 - t*t) - 1);
+}
+
+/**
+ * Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutCirc(qreal t)
+{
+ t-= qreal(1.0);
+ return ::sqrt(1 - t* t);
+}
+
+/**
+ * Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeInOutCirc(qreal t)
+{
+ t*=qreal(2.0);
+ if (t < 1) {
+ return -0.5 * (::sqrt(1 - t*t) - 1);
+ } else {
+ t -= qreal(2.0);
+ return 0.5 * (::sqrt(1 - t*t) + 1);
+ }
+}
+
+/**
+ * Easing equation function for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @return The correct value.
+ */
+static qreal easeOutInCirc(qreal t)
+{
+ if (t < 0.5) return easeOutCirc (2*t)/2;
+ return easeInCirc(2*t - 1)/2 + 0.5;
+}
+
+static qreal easeInElastic_helper(qreal t, qreal b, qreal c, qreal d, qreal a, qreal p)
+{
+ if (t==0) return b;
+ qreal t_adj = (qreal)t / (qreal)d;
+ if (t_adj==1) return b+c;
+
+ qreal s;
+ if(a < ::fabs(c)) {
+ a = c;
+ s = p / 4.0f;
+ } else {
+ s = p / (2 * M_PI) * ::asin(c / a);
+ }
+
+ t_adj -= 1.0f;
+ return -(a*::qPow(2.0f,10*t_adj) * ::sin( (t_adj*d-s)*(2*M_PI)/p )) + b;
+}
+
+/**
+ * Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @param p Period.
+ * @return The correct value.
+ */
+static qreal easeInElastic(qreal t, qreal a, qreal p)
+{
+ return easeInElastic_helper(t, 0, 1, 1, a, p);
+}
+
+static qreal easeOutElastic_helper(qreal t, qreal /*b*/, qreal c, qreal /*d*/, qreal a, qreal p)
+{
+ if (t==0) return 0;
+ if (t==1) return c;
+
+ qreal s;
+ if(a < c) {
+ a = c;
+ s = p / 4.0f;
+ } else {
+ s = p / (2 * M_PI) * ::asin(c / a);
+ }
+
+ return (a*::qPow(2.0f,-10*t) * ::sin( (t-s)*(2*M_PI)/p ) + c);
+}
+
+/**
+ * Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @param p Period.
+ * @return The correct value.
+ */
+static qreal easeOutElastic(qreal t, qreal a, qreal p)
+{
+ return easeOutElastic_helper(t, 0, 1, 1, a, p);
+}
+
+/**
+ * Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @param p Period.
+ * @return The correct value.
+ */
+static qreal easeInOutElastic(qreal t, qreal a, qreal p)
+{
+ if (t==0) return 0.0;
+ t*=2.0;
+ if (t==2) return 1.0;
+
+ qreal s;
+ if(a < 1.0) {
+ a = 1.0;
+ s = p / 4.0f;
+ } else {
+ s = p / (2 * M_PI) * ::asin(1.0 / a);
+ }
+
+ if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p ));
+ return a*::qPow(2.0f,-10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0;
+}
+
+/**
+ * Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @param p Period.
+ * @return The correct value.
+ */
+static qreal easeOutInElastic(qreal t, qreal a, qreal p)
+{
+ if (t < 0.5) return easeOutElastic_helper(t*2, 0, 0.5, 1.0, a, p);
+ return easeInElastic_helper(2*t - 1.0, 0.5, 0.5, 1.0, a, p);
+}
+
+/**
+ * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
+ * @return The correct value.
+ */
+static qreal easeInBack(qreal t, qreal s)
+{
+ return t*t*((s+1)*t - s);
+}
+
+/**
+ * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
+ * @return The correct value.
+ */
+static qreal easeOutBack(qreal t, qreal s)
+{
+ t-= qreal(1.0);
+ return t*t*((s+1)*t+ s) + 1;
+}
+
+/**
+ * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
+ * @return The correct value.
+ */
+static qreal easeInOutBack(qreal t, qreal s)
+{
+ t *= 2.0;
+ if (t < 1) {
+ s *= 1.525f;
+ return 0.5*(t*t*((s+1)*t - s));
+ } else {
+ t -= 2;
+ s *= 1.525f;
+ return 0.5*(t*t*((s+1)*t+ s) + 2);
+ }
+}
+
+/**
+ * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
+ * @return The correct value.
+ */
+static qreal easeOutInBack(qreal t, qreal s)
+{
+ if (t < 0.5) return easeOutBack (2*t, s)/2;
+ return easeInBack(2*t - 1, s)/2 + 0.5;
+}
+
+static qreal easeOutBounce_helper(qreal t, qreal c, qreal a)
+{
+ if (t == 1.0) return c;
+ if (t < (4/11.0)) {
+ return c*(7.5625*t*t);
+ } else if (t < (8/11.0)) {
+ t -= (6/11.0);
+ return -a * (1. - (7.5625*t*t + .75)) + c;
+ } else if (t < (10/11.0)) {
+ t -= (9/11.0);
+ return -a * (1. - (7.5625*t*t + .9375)) + c;
+ } else {
+ t -= (21/22.0);
+ return -a * (1. - (7.5625*t*t + .984375)) + c;
+ }
+}
+
+/**
+ * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @return The correct value.
+ */
+static qreal easeOutBounce(qreal t, qreal a)
+{
+ return easeOutBounce_helper(t, 1, a);
+}
+
+/**
+ * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @return The correct value.
+ */
+static qreal easeInBounce(qreal t, qreal a)
+{
+ return 1.0 - easeOutBounce_helper(1.0-t, 1.0, a);
+}
+
+
+/**
+ * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @return The correct value.
+ */
+static qreal easeInOutBounce(qreal t, qreal a)
+{
+ if (t < 0.5) return easeInBounce (2*t, a)/2;
+ else return (t == 1.0) ? 1.0 : easeOutBounce (2*t - 1, a)/2 + 0.5;
+}
+
+/**
+ * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration.
+ *
+ * @param t Current time (in frames or seconds).
+ * @param a Amplitude.
+ * @return The correct value.
+ */
+static qreal easeOutInBounce(qreal t, qreal a)
+{
+ if (t < 0.5) return easeOutBounce_helper(t*2, 0.5, a);
+ return 1.0 - easeOutBounce_helper (2.0-2*t, 0.5, a);
+}
+
+static inline qreal qt_sinProgress(qreal value)
+{
+ return qSin((value * M_PI) - M_PI_2) / 2 + qreal(0.5);
+}
+
+static inline qreal qt_smoothBeginEndMixFactor(qreal value)
+{
+ return qMin(qMax(1 - value * 2 + qreal(0.3), qreal(0.0)), qreal(1.0));
+}
+
+// SmoothBegin blends Smooth and Linear Interpolation.
+// Progress 0 - 0.3 : Smooth only
+// Progress 0.3 - ~ 0.5 : Mix of Smooth and Linear
+// Progress ~ 0.5 - 1 : Linear only
+
+/**
+ * Easing function that starts growing slowly, then increases in speed. At the end of the curve the speed will be constant.
+ */
+static qreal easeInCurve(qreal t)
+{
+ const qreal sinProgress = qt_sinProgress(t);
+ const qreal mix = qt_smoothBeginEndMixFactor(t);
+ return sinProgress * mix + t * (1 - mix);
+}
+
+/**
+ * Easing function that starts growing steadily, then ends slowly. The speed will be constant at the beginning of the curve.
+ */
+static qreal easeOutCurve(qreal t)
+{
+ const qreal sinProgress = qt_sinProgress(t);
+ const qreal mix = qt_smoothBeginEndMixFactor(1 - t);
+ return sinProgress * mix + t * (1 - mix);
+}
+
+/**
+ * Easing function where the value grows sinusoidally. Note that the calculated end value will be 0 rather than 1.
+ */
+static qreal easeSineCurve(qreal t)
+{
+ return (qSin(((t * M_PI * 2)) - M_PI_2) + 1) / 2;
+}
+
+/**
+ * Easing function where the value grows cosinusoidally. Note that the calculated start value will be 0.5 and the end value will be 0.5
+ * contrary to the usual 0 to 1 easing curve.
+ */
+static qreal easeCosineCurve(qreal t)
+{
+ return (qCos(((t * M_PI * 2)) - M_PI_2) + 1) / 2;
+}
+
diff --git a/src/3rdparty/easing/legal.qdoc b/src/3rdparty/easing/legal.qdoc
new file mode 100644
index 0000000..25f67e1
--- /dev/null
+++ b/src/3rdparty/easing/legal.qdoc
@@ -0,0 +1,35 @@
+/*!
+\page legal-easing.html
+\title Easing Equations by Robert Penner
+\ingroup animation
+
+\legalese
+\code
+Copyright (c) 2001 Robert Penner
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of contributors may be used
+ to endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\endcode
+\endlegalese
+*/
diff --git a/src/3rdparty/phonon/qt7/mediaobject.h b/src/3rdparty/phonon/qt7/mediaobject.h
index 27949ec..c93eddc 100644
--- a/src/3rdparty/phonon/qt7/mediaobject.h
+++ b/src/3rdparty/phonon/qt7/mediaobject.h
@@ -25,6 +25,10 @@
#include "medianode.h"
+#if QT_ALLOW_QUICKTIME
+ #include <QuickTime/QuickTime.h>
+#endif
+
QT_BEGIN_NAMESPACE
namespace Phonon
@@ -38,7 +42,10 @@ namespace QT7
class MediaObjectAudioNode;
class MediaObject : public MediaNode,
- public Phonon::MediaObjectInterface, public Phonon::AddonInterface
+ public Phonon::MediaObjectInterface
+#ifndef QT_NO_PHONON_MEDIACONTROLLER
+ , public Phonon::AddonInterface
+#endif
{
Q_OBJECT
Q_INTERFACES(Phonon::MediaObjectInterface Phonon::AddonInterface)
@@ -92,6 +99,10 @@ namespace QT7
int videoOutputCount();
+#if QT_ALLOW_QUICKTIME
+ void displayLinkEvent();
+#endif
+
signals:
void stateChanged(Phonon::State,Phonon::State);
void tick(qint64);
@@ -105,6 +116,16 @@ namespace QT7
void metaDataChanged(QMultiMap<QString,QString>);
void currentSourceChanged(const MediaSource &newSource);
+ // Add-on interface:
+ void availableSubtitlesChanged();
+ void availableAudioChannelsChanged();
+ void titleChanged(int);
+ void availableTitlesChanged(int);
+ void chapterChanged(int);
+ void availableChaptersChanged(int);
+ void angleChanged(int);
+ void availableAnglesChanged(int);
+
protected:
void mediaNodeEvent(const MediaNodeEvent *event);
bool event(QEvent *event);
@@ -118,7 +139,14 @@ namespace QT7
QuickTimeVideoPlayer *m_nextVideoPlayer;
QuickTimeAudioPlayer *m_nextAudioPlayer;
MediaObjectAudioNode *m_mediaObjectAudioNode;
- QuickTimeMetaData *m_metaData;
+
+#if QT_ALLOW_QUICKTIME
+ CVDisplayLinkRef m_displayLink;
+ QMutex m_displayLinkMutex;
+ bool m_pendingDisplayLinkEvent;
+ void startDisplayLink();
+ void stopDisplayLink();
+#endif
qint32 m_tickInterval;
qint32 m_transitionTime;
@@ -127,12 +155,14 @@ namespace QT7
float m_percentageLoaded;
int m_tickTimer;
- int m_bufferTimer;
+ int m_videoTimer;
+ int m_audioTimer;
int m_rapidTimer;
bool m_waitNextSwap;
int m_swapTimeLeft;
QTime m_swapTime;
+ bool m_autoplayTitles;
void synchAudioVideo();
void updateCurrentTime();
@@ -141,8 +171,7 @@ namespace QT7
void pause_internal();
void play_internal();
void setupAudioSystem();
- void updateTimer(int &timer, int interval);
- void bufferAudioVideo();
+ void restartAudioVideoTimers();
void updateRapidly();
void updateCrossFade();
void updateAudioBuffers();
@@ -154,6 +183,7 @@ namespace QT7
void inspectVideoGraphRecursive(MediaNode *node, int &effectCount, int &outputCount);
void inspectGraph();
bool isCrossFading();
+ void setCurrentTrack(int track);
QString m_errorString;
Phonon::ErrorType m_errorType;
diff --git a/src/3rdparty/phonon/qt7/mediaobject.mm b/src/3rdparty/phonon/qt7/mediaobject.mm
index 002c337..677640c 100644
--- a/src/3rdparty/phonon/qt7/mediaobject.mm
+++ b/src/3rdparty/phonon/qt7/mediaobject.mm
@@ -46,7 +46,6 @@ MediaObject::MediaObject(QObject *parent) : MediaNode(AudioSource | VideoSource,
m_mediaObjectAudioNode = new MediaObjectAudioNode(m_audioPlayer, m_nextAudioPlayer);
setAudioNode(m_mediaObjectAudioNode);
- m_metaData = new QuickTimeMetaData();
m_audioGraph = new AudioGraph(this);
m_tickInterval = 0;
@@ -55,6 +54,7 @@ MediaObject::MediaObject(QObject *parent) : MediaNode(AudioSource | VideoSource,
m_transitionTime = 0;
m_percentageLoaded = 0;
m_waitNextSwap = false;
+ m_autoplayTitles = true;
m_audioEffectCount = 0;
m_audioOutputCount = 0;
m_videoEffectCount = 0;
@@ -63,20 +63,28 @@ MediaObject::MediaObject(QObject *parent) : MediaNode(AudioSource | VideoSource,
m_errorType = Phonon::NoError;
m_tickTimer = 0;
- m_bufferTimer = 0;
+ m_videoTimer = 0;
+ m_audioTimer = 0;
m_rapidTimer = 0;
+#if QT_ALLOW_QUICKTIME
+ m_displayLink = 0;
+ m_pendingDisplayLinkEvent = false;
+#endif
+
checkForError();
}
MediaObject::~MediaObject()
-{
- // m_mediaObjectAudioNode is owned by super class.
+{
+ // m_mediaObjectAudioNode is owned by super class.
+#if QT_ALLOW_QUICKTIME
+ stopDisplayLink();
+#endif
m_audioPlayer->unsetVideoPlayer();
m_nextAudioPlayer->unsetVideoPlayer();
delete m_videoPlayer;
delete m_nextVideoPlayer;
- delete m_metaData;
checkForError();
}
@@ -88,7 +96,7 @@ bool MediaObject::setState(Phonon::State state)
emit stateChanged(m_state, prevState);
if (m_state != state){
// End-application did something
- // upon receiving the signal.
+ // upon receiving the signal.
return false;
}
}
@@ -122,7 +130,7 @@ void MediaObject::inspectGraph()
// Inspect the graph to check wether there are any
// effects or outputs connected. This will have
// influence on the audio system and video system that ends up beeing used:
- int prevVideoOutputCount = m_videoOutputCount;
+ int prevVideoOutputCount = m_videoOutputCount;
m_audioEffectCount = 0;
m_audioOutputCount = 0;
m_videoEffectCount = 0;
@@ -134,7 +142,7 @@ void MediaObject::inspectGraph()
if (m_videoOutputCount != prevVideoOutputCount){
MediaNodeEvent e1(MediaNodeEvent::VideoOutputCountChanged, &m_videoOutputCount);
notify(&e1);
- }
+ }
}
void MediaObject::setupAudioSystem()
@@ -167,14 +175,14 @@ void MediaObject::setupAudioSystem()
if (newAudioSystem == m_audioSystem)
return;
-
+
// Enable selected audio system:
- m_audioSystem = newAudioSystem;
+ m_audioSystem = newAudioSystem;
switch (newAudioSystem){
case AS_Silent:
m_audioGraph->stop();
m_videoPlayer->enableAudio(false);
- m_nextVideoPlayer->enableAudio(false);
+ m_nextVideoPlayer->enableAudio(false);
m_audioPlayer->enableAudio(false);
m_nextAudioPlayer->enableAudio(false);
break;
@@ -214,28 +222,28 @@ void MediaObject::setSource(const MediaSource &source)
IMPLEMENTED;
PhononAutoReleasePool pool;
setState(Phonon::LoadingState);
-
+
// Save current state for event/signal handling below:
bool prevHasVideo = m_videoPlayer->hasVideo();
qint64 prevTotalTime = totalTime();
+ int prevTrackCount = m_videoPlayer->trackCount();
m_waitNextSwap = false;
-
+
// Cancel cross-fade if any:
m_nextVideoPlayer->pause();
m_nextAudioPlayer->pause();
m_mediaObjectAudioNode->cancelCrossFade();
-
+
// Set new source:
m_audioPlayer->unsetVideoPlayer();
m_videoPlayer->setMediaSource(source);
m_audioPlayer->setVideoPlayer(m_videoPlayer);
- m_metaData->setVideo(m_videoPlayer);
- m_audioGraph->updateStreamSpecifications();
+ m_audioGraph->updateStreamSpecifications();
m_nextAudioPlayer->unsetVideoPlayer();
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_currentTime = 0;
-
+
// Emit/notify information about the new source:
QRect videoRect = m_videoPlayer->videoRect();
MediaNodeEvent e1(MediaNodeEvent::VideoFrameSizeChanged, &videoRect);
@@ -246,12 +254,14 @@ void MediaObject::setSource(const MediaSource &source)
updateVideo(emptyFrame);
emit currentSourceChanged(source);
- emit metaDataChanged(m_metaData->metaData());
+ emit metaDataChanged(m_videoPlayer->metaData());
if (prevHasVideo != m_videoPlayer->hasVideo())
- emit hasVideoChanged(m_videoPlayer->hasVideo());
+ emit hasVideoChanged(m_videoPlayer->hasVideo());
if (prevTotalTime != totalTime())
- emit totalTimeChanged(totalTime());
+ emit totalTimeChanged(totalTime());
+ if (prevTrackCount != m_videoPlayer->trackCount())
+ emit availableTitlesChanged(m_videoPlayer->trackCount());
if (checkForError())
return;
if (!m_videoPlayer->isDrmAuthorized())
@@ -260,7 +270,7 @@ void MediaObject::setSource(const MediaSource &source)
return;
if (!m_videoPlayer->canPlayMedia())
SET_ERROR("Cannot play media.", FATAL_ERROR)
-
+
// The state might have changed from LoadingState
// as a response to an error state change. So we
// need to check it before stopping:
@@ -287,28 +297,30 @@ void MediaObject::swapCurrentWithNext(qint32 transitionTime)
// Save current state for event/signal handling below:
bool prevHasVideo = m_videoPlayer->hasVideo();
qint64 prevTotalTime = totalTime();
+ int prevTrackCount = m_videoPlayer->trackCount();
qSwap(m_audioPlayer, m_nextAudioPlayer);
qSwap(m_videoPlayer, m_nextVideoPlayer);
m_mediaObjectAudioNode->startCrossFade(transitionTime);
m_audioGraph->updateStreamSpecifications();
- m_metaData->setVideo(m_videoPlayer);
m_waitNextSwap = false;
m_currentTime = 0;
-
+
// Emit/notify information about the new source:
QRect videoRect = m_videoPlayer->videoRect();
MediaNodeEvent e1(MediaNodeEvent::VideoFrameSizeChanged, &videoRect);
notify(&e1);
emit currentSourceChanged(m_videoPlayer->mediaSource());
- emit metaDataChanged(m_metaData->metaData());
+ emit metaDataChanged(m_videoPlayer->metaData());
if (prevHasVideo != m_videoPlayer->hasVideo())
- emit hasVideoChanged(m_videoPlayer->hasVideo());
+ emit hasVideoChanged(m_videoPlayer->hasVideo());
if (prevTotalTime != totalTime())
emit totalTimeChanged(totalTime());
+ if (prevTrackCount != m_videoPlayer->trackCount())
+ emit availableTitlesChanged(m_videoPlayer->trackCount());
if (checkForError())
return;
if (!m_videoPlayer->isDrmAuthorized())
@@ -327,28 +339,107 @@ void MediaObject::swapCurrentWithNext(qint32 transitionTime)
}
}
-void MediaObject::updateTimer(int &timer, int interval)
+#if QT_ALLOW_QUICKTIME
+static CVReturn displayLinkCallback(CVDisplayLinkRef /*displayLink*/,
+ const CVTimeStamp */*inNow*/,
+ const CVTimeStamp */*inOutputTime*/,
+ CVOptionFlags /*flagsIn*/,
+ CVOptionFlags */*flagsOut*/,
+ void *userData)
+{
+ MediaObject *mediaObject = static_cast<MediaObject *>(userData);
+ mediaObject->displayLinkEvent();
+ return kCVReturnSuccess;
+}
+
+void MediaObject::displayLinkEvent()
+{
+ // This function is called from a
+ // thread != gui thread. So we post the event.
+ // But we need to make sure that we don't post faster
+ // than the event loop can eat:
+ m_displayLinkMutex.lock();
+ bool pending = m_pendingDisplayLinkEvent;
+ m_pendingDisplayLinkEvent = true;
+ m_displayLinkMutex.unlock();
+
+ if (!pending)
+ qApp->postEvent(this, new QEvent(QEvent::User), Qt::HighEventPriority);
+}
+
+void MediaObject::startDisplayLink()
{
- if (timer)
- killTimer(timer);
- timer = 0;
- if (interval >= 0)
- timer = startTimer(interval);
+ if (m_displayLink)
+ return;
+ OSStatus err = CVDisplayLinkCreateWithCGDisplay(kCGDirectMainDisplay, &m_displayLink);
+ if (err != noErr)
+ goto fail;
+ err = CVDisplayLinkSetCurrentCGDisplay(m_displayLink, kCGDirectMainDisplay);
+ if (err != noErr)
+ goto fail;
+ err = CVDisplayLinkSetOutputCallback(m_displayLink, displayLinkCallback, this);
+ if (err != noErr)
+ goto fail;
+ err = CVDisplayLinkStart(m_displayLink);
+ if (err != noErr)
+ goto fail;
+ return;
+fail:
+ stopDisplayLink();
+}
+
+void MediaObject::stopDisplayLink()
+{
+ if (!m_displayLink)
+ return;
+ CVDisplayLinkStop(m_displayLink);
+ CFRelease(m_displayLink);
+ m_displayLink = 0;
+}
+#endif
+
+void MediaObject::restartAudioVideoTimers()
+{
+ if (m_videoTimer)
+ killTimer(m_videoTimer);
+ if (m_audioTimer)
+ killTimer(m_audioTimer);
+
+#if QT_ALLOW_QUICKTIME
+ // We prefer to use a display link as timer if available, since
+ // it is more steady, and results in better and smoother frame drawing:
+ startDisplayLink();
+ if (!m_displayLink){
+ float fps = m_videoPlayer->staticFps();
+ long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001;
+ m_videoTimer = startTimer(videoUpdateFrequency);
+ }
+#else
+ float fps = m_videoPlayer->staticFps();
+ long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001;
+ m_videoTimer = startTimer(videoUpdateFrequency);
+#endif
+
+ long audioUpdateFrequency = m_audioPlayer->regularTaskFrequency();
+ m_audioTimer = startTimer(audioUpdateFrequency);
+ updateVideoFrames();
+ updateAudioBuffers();
}
void MediaObject::play_internal()
{
// Play main audio/video:
m_videoPlayer->play();
- m_audioPlayer->play();
+ m_audioPlayer->play();
updateLipSynch(0);
// Play old audio/video to finish cross-fade:
if (m_nextVideoPlayer->currentTime() > 0){
m_nextVideoPlayer->play();
m_nextAudioPlayer->play();
}
- bufferAudioVideo();
- updateTimer(m_rapidTimer, 100);
+ restartAudioVideoTimers();
+ if (!m_rapidTimer)
+ m_rapidTimer = startTimer(100);
}
void MediaObject::pause_internal()
@@ -358,9 +449,15 @@ void MediaObject::pause_internal()
m_nextAudioPlayer->pause();
m_videoPlayer->pause();
m_nextVideoPlayer->pause();
- updateTimer(m_rapidTimer, -1);
- updateTimer(m_bufferTimer, -1);
-
+ killTimer(m_rapidTimer);
+ killTimer(m_videoTimer);
+ killTimer(m_audioTimer);
+ m_rapidTimer = 0;
+ m_videoTimer = 0;
+ m_audioTimer = 0;
+#if QT_ALLOW_QUICKTIME
+ stopDisplayLink();
+#endif
if (m_waitNextSwap)
m_swapTimeLeft = m_swapTime.msecsTo(QTime::currentTime());
}
@@ -382,7 +479,7 @@ void MediaObject::play()
if (!m_videoPlayer->canPlayMedia())
return;
if (!setState(Phonon::PlayingState))
- return;
+ return;
if (m_audioSystem == AS_Graph){
m_audioGraph->start();
m_mediaObjectAudioNode->setMute(true);
@@ -423,7 +520,7 @@ void MediaObject::stop()
if (!setState(Phonon::StoppedState))
return;
m_waitNextSwap = false;
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_nextAudioPlayer->unsetVideoPlayer();
pause_internal();
seek(0);
@@ -435,9 +532,9 @@ void MediaObject::seek(qint64 milliseconds)
IMPLEMENTED;
if (m_state == Phonon::ErrorState)
return;
-
+
// Stop cross-fade if any:
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_nextAudioPlayer->unsetVideoPlayer();
m_mediaObjectAudioNode->cancelCrossFade();
@@ -446,7 +543,7 @@ void MediaObject::seek(qint64 milliseconds)
m_videoPlayer->seek(milliseconds);
m_audioPlayer->seek(m_videoPlayer->currentTime());
m_mediaObjectAudioNode->setMute(false);
-
+
// Update time and cancel pending swap:
if (m_currentTime < m_videoPlayer->duration())
m_waitNextSwap = false;
@@ -557,7 +654,7 @@ bool MediaObject::isSeekable() const
qint64 MediaObject::currentTime() const
{
IMPLEMENTED_SILENT;
- const_cast<MediaObject *>(this)->updateCurrentTime();
+ const_cast<MediaObject *>(this)->updateCurrentTime();
return m_currentTime;
}
@@ -567,19 +664,24 @@ void MediaObject::updateCurrentTime()
m_currentTime = (m_audioSystem == AS_Graph) ? m_audioPlayer->currentTime() : m_videoPlayer->currentTime();
quint64 total = m_videoPlayer->duration();
- // Check if it's time to emit aboutToFinish:
- quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000));
- if (lastUpdateTime < mark && mark <= m_currentTime)
- emit aboutToFinish();
-
- // Check if it's time to emit prefinishMarkReached:
- mark = qMax(quint64(0), total - m_prefinishMark);
- if (lastUpdateTime < mark && mark <= m_currentTime)
- emit prefinishMarkReached(total - m_currentTime);
+ if (m_videoPlayer->currentTrack() < m_videoPlayer->trackCount() - 1){
+ // There are still more tracks to play after the current track.
+ if (m_autoplayTitles) {
+ if (lastUpdateTime < m_currentTime && m_currentTime == total)
+ setCurrentTrack(m_videoPlayer->currentTrack() + 1);
+ }
+ } else if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){
+ // There is no more sources or tracks to play after the current source.
+ // Check if it's time to emit aboutToFinish:
+ quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000));
+ if (lastUpdateTime < mark && mark <= m_currentTime)
+ emit aboutToFinish();
+
+ // Check if it's time to emit prefinishMarkReached:
+ mark = qMax(quint64(0), total - m_prefinishMark);
+ if (lastUpdateTime < mark && mark <= m_currentTime)
+ emit prefinishMarkReached(total - m_currentTime);
- if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){
- // There is no next source in que.
- // Check if it's time to emit finished:
if (lastUpdateTime < m_currentTime && m_currentTime == total){
emit finished();
m_currentTime = (m_audioSystem == AS_Graph) ? m_audioPlayer->currentTime() : m_videoPlayer->currentTime();
@@ -589,7 +691,7 @@ void MediaObject::updateCurrentTime()
} else {
// We have a next source.
// Check if it's time to swap to next source:
- mark = qMax(quint64(0), total + m_transitionTime);
+ quint32 mark = qMax(quint64(0), total + m_transitionTime);
if (m_waitNextSwap && m_state == Phonon::PlayingState &&
m_transitionTime < m_swapTime.msecsTo(QTime::currentTime())){
swapCurrentWithNext(0);
@@ -692,14 +794,14 @@ bool MediaObject::setAudioDeviceOnMovie(int id)
void MediaObject::updateCrossFade()
{
- m_mediaObjectAudioNode->updateCrossFade(m_currentTime);
+ m_mediaObjectAudioNode->updateCrossFade(m_currentTime);
// Clean-up previous movie if done fading:
if (m_mediaObjectAudioNode->m_fadeDuration == 0){
if (m_nextVideoPlayer->isPlaying() || m_nextAudioPlayer->isPlaying()){
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_nextAudioPlayer->unsetVideoPlayer();
}
- }
+ }
}
void MediaObject::updateBufferStatus()
@@ -728,7 +830,7 @@ void MediaObject::updateVideoFrames()
// Draw next frame if awailable:
if (m_videoPlayer->videoFrameChanged()){
updateLipSynch(50);
- VideoFrame frame(m_videoPlayer);
+ VideoFrame frame(m_videoPlayer);
if (m_nextVideoPlayer->isPlaying()
&& m_nextVideoPlayer->hasVideo()
&& isCrossFading()){
@@ -736,9 +838,9 @@ void MediaObject::updateVideoFrames()
frame.setBackgroundFrame(bgFrame);
frame.setBaseOpacity(m_mediaObjectAudioNode->m_volume1);
}
-
+
// Send the frame through the graph:
- updateVideo(frame);
+ updateVideo(frame);
checkForError();
}
}
@@ -749,7 +851,7 @@ void MediaObject::updateLipSynch(int allowedOffset)
return;
if (m_videoSinkList.isEmpty() || m_audioSinkList.isEmpty())
return;
-
+
if (m_videoPlayer->hasVideo()){
qint64 diff = m_audioPlayer->currentTime() - m_videoPlayer->currentTime();
if (-allowedOffset > diff || diff > allowedOffset)
@@ -763,16 +865,6 @@ void MediaObject::updateLipSynch(int allowedOffset)
}
}
-void MediaObject::bufferAudioVideo()
-{
- long nextVideoUpdate = m_videoPlayer->hasVideo() ? 30 : INT_MAX;
- long nextAudioUpdate = m_audioPlayer->regularTaskFrequency();
- updateAudioBuffers();
- updateVideoFrames();
- if (m_state == Phonon::PlayingState)
- updateTimer(m_bufferTimer, qMin(nextVideoUpdate, nextAudioUpdate));
-}
-
void MediaObject::updateRapidly()
{
updateCurrentTime();
@@ -797,8 +889,8 @@ void MediaObject::mediaNodeEvent(const MediaNodeEvent *event)
synchAudioVideo();
checkForError();
m_mediaObjectAudioNode->setMute(false);
- if (m_state == Phonon::PlayingState)
- bufferAudioVideo();
+ if (m_state == Phonon::PlayingState)
+ restartAudioVideoTimers();
break;
case MediaNodeEvent::AudioGraphCannotPlay:
case MediaNodeEvent::AudioGraphInitialized:
@@ -809,7 +901,7 @@ void MediaObject::mediaNodeEvent(const MediaNodeEvent *event)
checkForError();
m_mediaObjectAudioNode->setMute(false);
}
- break;
+ break;
default:
break;
}
@@ -818,29 +910,67 @@ void MediaObject::mediaNodeEvent(const MediaNodeEvent *event)
bool MediaObject::event(QEvent *event)
{
switch (event->type()){
- case QEvent::Timer: {
- QTimerEvent *timerEvent = static_cast<QTimerEvent *>(event);
- if (timerEvent->timerId() == m_rapidTimer)
+#if QT_ALLOW_QUICKTIME
+ case QEvent::User:{
+ m_displayLinkMutex.lock();
+ m_pendingDisplayLinkEvent = false;
+ m_displayLinkMutex.unlock();
+ updateVideoFrames();
+ break; }
+#endif
+ case QEvent::Timer:{
+ int timerId = static_cast<QTimerEvent *>(event)->timerId();
+ if (timerId == m_rapidTimer)
updateRapidly();
- else if (timerEvent->timerId() == m_tickTimer)
+ else if (timerId == m_tickTimer)
emit tick(currentTime());
- else if (timerEvent->timerId() == m_bufferTimer)
- bufferAudioVideo();
- }
- break;
+ else if (timerId == m_videoTimer)
+ updateVideoFrames();
+ else if (timerId == m_audioTimer)
+ updateAudioBuffers();
+ break; }
default:
break;
}
return QObject::event(event);
}
-bool MediaObject::hasInterface(Interface /*interface*/) const
+void MediaObject::setCurrentTrack(int track)
{
- return false;
+ if (track == m_videoPlayer->currentTrack() || track < 0 || track >= m_videoPlayer->trackCount())
+ return;
+
+ m_videoPlayer->setCurrentTrack(track);
+ emit titleChanged(track);
+ emit metaDataChanged(m_videoPlayer->metaData());
}
-QVariant MediaObject::interfaceCall(Interface /*interface*/, int /*command*/, const QList<QVariant> &/*arguments*/)
+bool MediaObject::hasInterface(Interface iface) const
{
+ return iface == AddonInterface::TitleInterface;
+}
+
+QVariant MediaObject::interfaceCall(Interface iface, int command, const QList<QVariant> &params)
+{
+ switch (iface) {
+ case TitleInterface:
+ switch (command) {
+ case availableTitles:
+ return m_videoPlayer->trackCount();
+ case title:
+ return m_videoPlayer->currentTrack();
+ case setTitle:
+ setCurrentTrack(params.first().toInt());
+ break;
+ case autoplayTitles:
+ return m_autoplayTitles;
+ case setAutoplayTitles:
+ m_autoplayTitles = params.first().toBool();
+ break;
+ }
+ default:
+ break;
+ }
return QVariant();
}
diff --git a/src/3rdparty/phonon/qt7/quicktimemetadata.h b/src/3rdparty/phonon/qt7/quicktimemetadata.h
index d524183..c589535 100644
--- a/src/3rdparty/phonon/qt7/quicktimemetadata.h
+++ b/src/3rdparty/phonon/qt7/quicktimemetadata.h
@@ -38,10 +38,8 @@ namespace QT7
class QuickTimeMetaData
{
public:
- QuickTimeMetaData();
- virtual ~QuickTimeMetaData();
-
- void setVideo(QuickTimeVideoPlayer *videoPlayer);
+ QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer);
+ void update();
QMultiMap<QString, QString> metaData();
private:
@@ -49,6 +47,8 @@ namespace QT7
bool m_movieChanged;
QuickTimeVideoPlayer *m_videoPlayer;
void readMetaData();
+ void guessMetaDataForCD();
+ void readMetaDataFromMovie();
#ifdef QUICKTIME_C_API_AVAILABLE
QString stripCopyRightSymbol(const QString &key);
diff --git a/src/3rdparty/phonon/qt7/quicktimemetadata.mm b/src/3rdparty/phonon/qt7/quicktimemetadata.mm
index 851e707..2dcc152 100644
--- a/src/3rdparty/phonon/qt7/quicktimemetadata.mm
+++ b/src/3rdparty/phonon/qt7/quicktimemetadata.mm
@@ -15,6 +15,7 @@
along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <QtCore/QFileInfo>
#include "quicktimemetadata.h"
#include "quicktimevideoplayer.h"
@@ -25,19 +26,14 @@ namespace Phonon
namespace QT7
{
-QuickTimeMetaData::QuickTimeMetaData()
+QuickTimeMetaData::QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer)
{
- m_videoPlayer = 0;
+ m_videoPlayer = videoPlayer;
m_movieChanged = false;
}
-QuickTimeMetaData::~QuickTimeMetaData()
+void QuickTimeMetaData::update()
{
-}
-
-void QuickTimeMetaData::setVideo(QuickTimeVideoPlayer *videoPlayer)
-{
- m_videoPlayer = videoPlayer;
m_movieChanged = true;
m_metaData.clear();
}
@@ -145,14 +141,22 @@ void QuickTimeMetaData::readFormattedData(QTMetaDataRef metaDataRef, OSType form
#endif // QUICKTIME_C_API_AVAILABLE
-void QuickTimeMetaData::readMetaData()
+void QuickTimeMetaData::guessMetaDataForCD()
+{
+ QString album = QFileInfo(m_videoPlayer->movieCompactDiscPath()).fileName();
+ QString title = QFileInfo(m_videoPlayer->currentTrackPath()).fileName();
+ title = title.left(title.lastIndexOf('.'));
+ m_metaData.insert(QLatin1String("ALBUM"), album);
+ m_metaData.insert(QLatin1String("TITLE"), title);
+ m_metaData.insert(QLatin1String("TRACKNUMBER"), QString::number(m_videoPlayer->currentTrack()));
+}
+
+void QuickTimeMetaData::readMetaDataFromMovie()
{
- if (!m_videoPlayer)
- return;
QMultiMap<QString, QString> metaMap;
-
+
#ifdef QUICKTIME_C_API_AVAILABLE
- QTMetaDataRef metaDataRef;
+ QTMetaDataRef metaDataRef;
OSStatus err = QTCopyMovieMetaData([m_videoPlayer->qtMovie() quickTimeMovie], &metaDataRef);
BACKEND_ASSERT2(err == noErr, "Could not read QuickTime meta data", NORMAL_ERROR)
@@ -173,6 +177,17 @@ void QuickTimeMetaData::readMetaData()
m_metaData.insert(QLatin1String("DESCRIPTION"), metaMap.value(QLatin1String("des")));
}
+void QuickTimeMetaData::readMetaData()
+{
+ if (!m_videoPlayer)
+ return;
+
+ if (m_videoPlayer->mediaSource().type() == Phonon::MediaSource::Disc)
+ guessMetaDataForCD();
+ else
+ readMetaDataFromMovie();
+}
+
QMultiMap<QString, QString> QuickTimeMetaData::metaData()
{
if (m_videoPlayer && m_videoPlayer->hasMovie() && m_movieChanged)
diff --git a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
index b80570a..98eacb5 100644
--- a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
+++ b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
@@ -39,6 +39,7 @@ namespace Phonon
namespace QT7
{
class QuickTimeStreamReader;
+ class QuickTimeMetaData;
class VideoRenderWidgetQTMovieView;
class QuickTimeVideoPlayer : QObject
@@ -56,7 +57,7 @@ namespace QT7
void setMediaSource(const MediaSource &source);
MediaSource mediaSource() const;
- void unsetVideo();
+ void unsetCurrentMediaSource();
void play();
void pause();
@@ -67,11 +68,13 @@ namespace QT7
GLuint currentFrameAsGLTexture();
void *currentFrameAsCIImage();
QImage currentFrameAsQImage();
+ void releaseImageCache();
QRect videoRect() const;
quint64 duration() const;
quint64 currentTime() const;
long timeScale() const;
+ float staticFps();
QString currentTimeString();
void setColors(qreal brightness = 0, qreal contrast = 1, qreal hue = 0, qreal saturation = 1);
@@ -84,6 +87,7 @@ namespace QT7
bool setAudioDevice(int id);
void setPlaybackRate(float rate);
QTMovie *qtMovie() const;
+ QMultiMap<QString, QString> metaData();
float playbackRate() const;
float prefferedPlaybackRate() const;
@@ -103,6 +107,12 @@ namespace QT7
float percentageLoaded();
quint64 timeLoaded();
+ int trackCount() const;
+ int currentTrack() const;
+ void setCurrentTrack(int track);
+ QString movieCompactDiscPath() const;
+ QString currentTrackPath() const;
+
static QString timeToString(quint64 ms);
// Help functions when drawing to more that one widget in cocoa 64:
@@ -116,6 +126,10 @@ namespace QT7
QTMovie *m_QTMovie;
State m_state;
QGLPixelBuffer *m_QImagePixelBuffer;
+ QuickTimeMetaData *m_metaData;
+
+ CVOpenGLTextureRef m_cachedCVTextureRef;
+ QImage m_cachedQImage;
bool m_playbackRateSat;
bool m_isDrmProtected;
@@ -126,13 +140,18 @@ namespace QT7
float m_masterVolume;
float m_relativeVolume;
float m_playbackRate;
+ float m_staticFps;
quint64 m_currentTime;
MediaSource m_mediaSource;
+
void *m_primaryRenderingCIImage;
qreal m_brightness;
qreal m_contrast;
qreal m_hue;
qreal m_saturation;
+ NSArray *m_folderTracks;
+ int m_currentTrack;
+ QString m_movieCompactDiscPath;
#ifdef QUICKTIME_C_API_AVAILABLE
QTVisualContextRef m_visualContext;
@@ -140,20 +159,26 @@ namespace QT7
VideoFrame m_currentFrame;
QuickTimeStreamReader *m_streamReader;
+ void prepareCurrentMovieForPlayback();
void createVisualContext();
void openMovieFromCurrentMediaSource();
void openMovieFromDataRef(QTDataReference *dataRef);
void openMovieFromFile();
void openMovieFromUrl();
void openMovieFromStream();
+ void openMovieFromCompactDisc();
void openMovieFromData(QByteArray *data, char *fileType);
void openMovieFromDataGuessType(QByteArray *data);
QString mediaSourcePath();
bool codecExistsAccordingToSuffix(const QString &fileName);
+ NSString* pathToCompactDisc();
+ bool isCompactDisc(NSString *path);
+ NSArray* scanFolder(NSString *path);
void setError(NSError *error);
bool errorOccured();
void readProtection();
+ void calculateStaticFps();
void checkIfVideoAwailable();
bool movieNotLoaded();
void waitStatePlayable();
diff --git a/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm b/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
index 3f76132..23c76e3 100644
--- a/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
+++ b/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
@@ -20,6 +20,7 @@
#include "videowidget.h"
#include "audiodevice.h"
#include "quicktimestreamreader.h"
+#include "quicktimemetadata.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QEventLoop>
@@ -52,6 +53,7 @@ QuickTimeVideoPlayer::QuickTimeVideoPlayer() : QObject(0)
{
m_state = NoMedia;
m_mediaSource = MediaSource();
+ m_metaData = new QuickTimeMetaData(this);
m_QTMovie = 0;
m_streamReader = 0;
m_playbackRate = 1.0f;
@@ -61,12 +63,16 @@ QuickTimeVideoPlayer::QuickTimeVideoPlayer() : QObject(0)
m_mute = false;
m_audioEnabled = false;
m_hasVideo = false;
+ m_staticFps = 0;
m_playbackRateSat = false;
m_isDrmProtected = false;
m_isDrmAuthorized = true;
m_primaryRenderingTarget = 0;
m_primaryRenderingCIImage = 0;
m_QImagePixelBuffer = 0;
+ m_cachedCVTextureRef = 0;
+ m_folderTracks = 0;
+ m_currentTrack = 0;
#ifdef QUICKTIME_C_API_AVAILABLE
OSStatus err = EnterMovies();
@@ -77,7 +83,9 @@ QuickTimeVideoPlayer::QuickTimeVideoPlayer() : QObject(0)
QuickTimeVideoPlayer::~QuickTimeVideoPlayer()
{
- unsetVideo();
+ PhononAutoReleasePool pool;
+ unsetCurrentMediaSource();
+ delete m_metaData;
[(NSObject*)m_primaryRenderingTarget release];
m_primaryRenderingTarget = 0;
#ifdef QUICKTIME_C_API_AVAILABLE
@@ -86,6 +94,15 @@ QuickTimeVideoPlayer::~QuickTimeVideoPlayer()
#endif
}
+void QuickTimeVideoPlayer::releaseImageCache()
+{
+ if (m_cachedCVTextureRef){
+ CVOpenGLTextureRelease(m_cachedCVTextureRef);
+ m_cachedCVTextureRef = 0;
+ }
+ m_cachedQImage = QImage();
+}
+
void QuickTimeVideoPlayer::createVisualContext()
{
#ifdef QUICKTIME_C_API_AVAILABLE
@@ -125,7 +142,10 @@ bool QuickTimeVideoPlayer::videoFrameChanged()
return false;
QTVisualContextTask(m_visualContext);
- return QTVisualContextIsNewImageAvailable(m_visualContext, 0);
+ bool changed = QTVisualContextIsNewImageAvailable(m_visualContext, 0);
+ if (changed)
+ releaseImageCache();
+ return changed;
#elif defined(QT_MAC_USE_COCOA)
return true;
@@ -140,10 +160,11 @@ CVOpenGLTextureRef QuickTimeVideoPlayer::currentFrameAsCVTexture()
#ifdef QUICKTIME_C_API_AVAILABLE
if (!m_visualContext)
return 0;
- CVOpenGLTextureRef texture = 0;
- OSStatus err = QTVisualContextCopyImageForTime(m_visualContext, 0, 0, &texture);
- BACKEND_ASSERT3(err == noErr, "Could not copy image for time in QuickTime player", FATAL_ERROR, 0)
- return texture;
+ if (!m_cachedCVTextureRef){
+ OSStatus err = QTVisualContextCopyImageForTime(m_visualContext, 0, 0, &m_cachedCVTextureRef);
+ BACKEND_ASSERT3(err == noErr, "Could not copy image for time in QuickTime player", FATAL_ERROR, 0)
+ }
+ return m_cachedCVTextureRef;
#else
return 0;
@@ -152,6 +173,9 @@ CVOpenGLTextureRef QuickTimeVideoPlayer::currentFrameAsCVTexture()
QImage QuickTimeVideoPlayer::currentFrameAsQImage()
{
+ if (!m_cachedQImage.isNull())
+ return m_cachedQImage;
+
#ifdef QUICKTIME_C_API_AVAILABLE
QGLContext *prevContext = const_cast<QGLContext *>(QGLContext::currentContext());
CVOpenGLTextureRef texture = currentFrameAsCVTexture();
@@ -181,12 +205,11 @@ QImage QuickTimeVideoPlayer::currentFrameAsQImage()
glVertex2i(-1, -1);
glEnd();
- QImage image = m_QImagePixelBuffer->toImage();
- CVOpenGLTextureRelease(texture);
+ m_cachedQImage = m_QImagePixelBuffer->toImage();
// Because of QuickTime, m_QImagePixelBuffer->doneCurrent() will fail.
// So we store, and restore, the context our selves:
prevContext->makeCurrent();
- return image;
+ return m_cachedQImage;
#else
CIImage *img = (CIImage *)currentFrameAsCIImage();
if (!img)
@@ -195,10 +218,10 @@ QImage QuickTimeVideoPlayer::currentFrameAsQImage()
NSBitmapImageRep* bitmap = [[NSBitmapImageRep alloc] initWithCIImage:img];
CGRect bounds = [img extent];
QImage qImg([bitmap bitmapData], bounds.size.width, bounds.size.height, QImage::Format_ARGB32);
- QImage swapped = qImg.rgbSwapped();
+ m_cachedQImage = qImg.rgbSwapped();
[bitmap release];
[img release];
- return swapped;
+ return m_cachedQImage;
#endif
}
@@ -250,8 +273,7 @@ void *QuickTimeVideoPlayer::currentFrameAsCIImage()
#ifdef QUICKTIME_C_API_AVAILABLE
CVOpenGLTextureRef cvImg = currentFrameAsCVTexture();
CIImage *img = [[CIImage alloc] initWithCVImageBuffer:cvImg];
- CVOpenGLTextureRelease(cvImg);
- return img;
+ return img;
#else
return 0;
#endif
@@ -273,7 +295,7 @@ GLuint QuickTimeVideoPlayer::currentFrameAsGLTexture()
int samplesPerPixel = [bitmap samplesPerPixel];
if (![bitmap isPlanar] && (samplesPerPixel == 3 || samplesPerPixel == 4)){
- glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0,
+ glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0,
samplesPerPixel == 4 ? GL_RGBA8 : GL_RGB8,
[bitmap pixelsWide], [bitmap pixelsHigh],
0, samplesPerPixel == 4 ? GL_RGBA : GL_RGB,
@@ -302,7 +324,7 @@ void QuickTimeVideoPlayer::setVolume(float masterVolume, float relativeVolume)
m_masterVolume = masterVolume;
m_relativeVolume = relativeVolume;
if (!m_QTMovie || !m_audioEnabled || m_mute)
- return;
+ return;
[m_QTMovie setVolume:(m_masterVolume * m_relativeVolume)];
}
@@ -313,7 +335,7 @@ void QuickTimeVideoPlayer::setMute(bool mute)
return;
// Work-around bug that happends if you set/unset mute
- // before movie is playing, and audio is not played
+ // before movie is playing, and audio is not played
// through graph. Then audio is delayed.
[m_QTMovie setMuted:mute];
[m_QTMovie setVolume:(mute ? 0 : m_masterVolume * m_relativeVolume)];
@@ -326,7 +348,7 @@ void QuickTimeVideoPlayer::enableAudio(bool enable)
return;
// Work-around bug that happends if you set/unset mute
- // before movie is playing, and audio is not played
+ // before movie is playing, and audio is not played
// through graph. Then audio is delayed.
[m_QTMovie setMuted:(!enable || m_mute)];
[m_QTMovie setVolume:((!enable || m_mute) ? 0 : m_masterVolume * m_relativeVolume)];
@@ -345,7 +367,7 @@ bool QuickTimeVideoPlayer::setAudioDevice(int id)
#ifdef QUICKTIME_C_API_AVAILABLE
// The following code will not work for some media codecs that
// typically mingle audio/video frames (e.g mpeg).
- CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id));
+ CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id));
QTAudioContextRef context;
QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, idString, 0, &context);
OSStatus err = SetMovieAudioContext([m_QTMovie quickTimeMovie], context);
@@ -369,11 +391,16 @@ void QuickTimeVideoPlayer::setColors(qreal brightness, qreal contrast, qreal hue
contrast += 1;
saturation += 1;
+ if (m_brightness == brightness
+ && m_contrast == contrast
+ && m_hue == hue
+ && m_saturation == saturation)
+ return;
+
m_brightness = brightness;
m_contrast = contrast;
m_hue = hue;
m_saturation = saturation;
-
#ifdef QUICKTIME_C_API_AVAILABLE
Float32 value;
value = brightness;
@@ -385,6 +412,7 @@ void QuickTimeVideoPlayer::setColors(qreal brightness, qreal contrast, qreal hue
value = saturation;
SetMovieVisualSaturation([m_QTMovie quickTimeMovie], value, 0);
#endif
+ releaseImageCache();
}
QRect QuickTimeVideoPlayer::videoRect() const
@@ -397,7 +425,7 @@ QRect QuickTimeVideoPlayer::videoRect() const
return QRect(0, 0, size.width, size.height);
}
-void QuickTimeVideoPlayer::unsetVideo()
+void QuickTimeVideoPlayer::unsetCurrentMediaSource()
{
if (!m_QTMovie)
return;
@@ -410,11 +438,17 @@ void QuickTimeVideoPlayer::unsetVideo()
m_state = NoMedia;
m_isDrmProtected = false;
m_isDrmAuthorized = true;
+ m_hasVideo = false;
+ m_staticFps = 0;
m_mediaSource = MediaSource();
+ m_movieCompactDiscPath.clear();
[(CIImage *)m_primaryRenderingCIImage release];
m_primaryRenderingCIImage = 0;
delete m_QImagePixelBuffer;
m_QImagePixelBuffer = 0;
+ releaseImageCache();
+ [m_folderTracks release];
+ m_folderTracks = 0;
}
QuickTimeVideoPlayer::State QuickTimeVideoPlayer::state() const
@@ -524,18 +558,25 @@ bool QuickTimeVideoPlayer::codecExistsAccordingToSuffix(const QString &fileName)
void QuickTimeVideoPlayer::setMediaSource(const MediaSource &mediaSource)
{
PhononAutoReleasePool pool;
- unsetVideo();
+ unsetCurrentMediaSource();
+
m_mediaSource = mediaSource;
if (mediaSource.type() == MediaSource::Empty || mediaSource.type() == MediaSource::Invalid){
m_state = NoMedia;
return;
}
+
openMovieFromCurrentMediaSource();
if (errorOccured()){
- unsetVideo();
+ unsetCurrentMediaSource();
return;
}
+ prepareCurrentMovieForPlayback();
+}
+
+void QuickTimeVideoPlayer::prepareCurrentMovieForPlayback()
+{
#ifdef QUICKTIME_C_API_AVAILABLE
if (m_visualContext)
SetMovieVisualContext([m_QTMovie quickTimeMovie], m_visualContext);
@@ -543,23 +584,25 @@ void QuickTimeVideoPlayer::setMediaSource(const MediaSource &mediaSource)
waitStatePlayable();
if (errorOccured()){
- unsetVideo();
+ unsetCurrentMediaSource();
return;
}
readProtection();
preRollMovie();
if (errorOccured()){
- unsetVideo();
+ unsetCurrentMediaSource();
return;
}
if (!m_playbackRateSat)
m_playbackRate = prefferedPlaybackRate();
checkIfVideoAwailable();
+ calculateStaticFps();
enableAudio(m_audioEnabled);
setMute(m_mute);
setVolume(m_masterVolume, m_relativeVolume);
+ m_metaData->update();
pause();
}
@@ -573,7 +616,7 @@ void QuickTimeVideoPlayer::openMovieFromCurrentMediaSource()
openMovieFromUrl();
break;
case MediaSource::Disc:
- CASE_UNSUPPORTED("Could not open media source.", FATAL_ERROR)
+ openMovieFromCompactDisc();
break;
case MediaSource::Stream:
openMovieFromStream();
@@ -635,7 +678,7 @@ void QuickTimeVideoPlayer::openMovieFromDataGuessType(QByteArray *data)
// than using e.g [QTMovie movieFileTypes:QTIncludeCommonTypes]. Some
// codecs *think* they can decode the stream, and crash...
#define TryOpenMovieWithCodec(type) gClearError(); \
- openMovieFromData(data, "."type); \
+ openMovieFromData(data, (char *)"."type); \
if (m_QTMovie) return;
TryOpenMovieWithCodec("avi");
@@ -675,6 +718,50 @@ void QuickTimeVideoPlayer::openMovieFromStream()
openMovieFromDataGuessType(m_streamReader->pointerToData());
}
+typedef void (*qt_sighandler_t)(int);
+static void sigtest(int) {
+ qApp->exit(0);
+}
+
+void QuickTimeVideoPlayer::openMovieFromCompactDisc()
+{
+ // Interrupting the application while the device is open
+ // causes the application to hang. So we need to handle
+ // this in a more graceful way:
+ qt_sighandler_t hndl = signal(SIGINT, sigtest);
+ if (hndl)
+ signal(SIGINT, hndl);
+
+ PhononAutoReleasePool pool;
+ NSString *cd = 0;
+ QString devName = m_mediaSource.deviceName();
+ if (devName.isEmpty()) {
+ cd = pathToCompactDisc();
+ if (!cd) {
+ SET_ERROR("Could not open media source.", NORMAL_ERROR)
+ return;
+ }
+ m_movieCompactDiscPath = PhononCFString::toQString(reinterpret_cast<CFStringRef>(cd));
+ } else {
+ if (!QFileInfo(devName).isAbsolute())
+ devName = QLatin1String("/Volumes/") + devName;
+ cd = [reinterpret_cast<const NSString *>(PhononCFString::toCFStringRef(devName)) autorelease];
+ if (!isCompactDisc(cd)) {
+ SET_ERROR("Could not open media source.", NORMAL_ERROR)
+ return;
+ }
+ m_movieCompactDiscPath = devName;
+ }
+
+ m_folderTracks = [scanFolder(cd) retain];
+ setCurrentTrack(0);
+}
+
+QString QuickTimeVideoPlayer::movieCompactDiscPath() const
+{
+ return m_movieCompactDiscPath;
+}
+
MediaSource QuickTimeVideoPlayer::mediaSource() const
{
return m_mediaSource;
@@ -720,6 +807,44 @@ long QuickTimeVideoPlayer::timeScale() const
return [[m_QTMovie attributeForKey:@"QTMovieTimeScaleAttribute"] longValue];
}
+float QuickTimeVideoPlayer::staticFps()
+{
+ return m_staticFps;
+}
+
+void QuickTimeVideoPlayer::calculateStaticFps()
+{
+ if (!m_hasVideo){
+ m_staticFps = 0;
+ return;
+ }
+
+#ifdef QT_ALLOW_QUICKTIME
+ Boolean isMpeg = false;
+ Track videoTrack = GetMovieIndTrackType([m_QTMovie quickTimeMovie], 1,
+ FOUR_CHAR_CODE('vfrr'), // 'vfrr' means: has frame rate
+ movieTrackCharacteristic | movieTrackEnabledOnly);
+ Media media = GetTrackMedia(videoTrack);
+ MediaHandler mediaH = GetMediaHandler(media);
+ MediaHasCharacteristic(mediaH, FOUR_CHAR_CODE('mpeg'), &isMpeg);
+
+ if (isMpeg){
+ MHInfoEncodedFrameRateRecord frameRate;
+ Size frameRateSize = sizeof(frameRate);
+ MediaGetPublicInfo(mediaH, kMHInfoEncodedFrameRate, &frameRate, &frameRateSize);
+ m_staticFps = float(Fix2X(frameRate.encodedFrameRate));
+ } else {
+ Media media = GetTrackMedia(videoTrack);
+ long sampleCount = GetMediaSampleCount(media);
+ TimeValue64 duration = GetMediaDisplayDuration(media);
+ TimeValue64 timeScale = GetMediaTimeScale(media);
+ m_staticFps = float((double)sampleCount * (double)timeScale / (double)duration);
+ }
+#else
+ m_staticFps = 30.0f;
+#endif
+}
+
QString QuickTimeVideoPlayer::timeToString(quint64 ms)
{
int sec = ms/1000;
@@ -950,6 +1075,94 @@ void QuickTimeVideoPlayer::readProtection()
}
}
+QMultiMap<QString, QString> QuickTimeVideoPlayer::metaData()
+{
+ return m_metaData->metaData();
+}
+
+int QuickTimeVideoPlayer::trackCount() const
+{
+ if (!m_folderTracks)
+ return 0;
+ return [m_folderTracks count];
+}
+
+int QuickTimeVideoPlayer::currentTrack() const
+{
+ return m_currentTrack;
+}
+
+QString QuickTimeVideoPlayer::currentTrackPath() const
+{
+ if (!m_folderTracks)
+ return QString();
+
+ PhononAutoReleasePool pool;
+ NSString *trackPath = [m_folderTracks objectAtIndex:m_currentTrack];
+ return PhononCFString::toQString(reinterpret_cast<CFStringRef>(trackPath));
+}
+
+NSString* QuickTimeVideoPlayer::pathToCompactDisc()
+{
+ PhononAutoReleasePool pool;
+ NSArray *devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
+ for (unsigned int i=0; i<[devices count]; ++i) {
+ NSString *dev = [devices objectAtIndex:i];
+ if (isCompactDisc(dev))
+ return [dev retain];
+ }
+ return 0;
+}
+
+bool QuickTimeVideoPlayer::isCompactDisc(NSString *path)
+{
+ PhononAutoReleasePool pool;
+ NSString *type = [NSString string];
+ [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:path
+ isRemovable:0
+ isWritable:0
+ isUnmountable:0
+ description:0
+ type:&type];
+ return [type hasPrefix:@"cdd"];
+}
+
+NSArray* QuickTimeVideoPlayer::scanFolder(NSString *path)
+{
+ NSMutableArray *tracks = [NSMutableArray arrayWithCapacity:20];
+ if (!path)
+ return tracks;
+
+ NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:path];
+ while (NSString *track = [enumerator nextObject]) {
+ if (![track hasPrefix:@"."])
+ [tracks addObject:[path stringByAppendingPathComponent:track]];
+ }
+ return tracks;
+}
+
+void QuickTimeVideoPlayer::setCurrentTrack(int track)
+{
+ PhononAutoReleasePool pool;
+ [m_QTMovie release];
+ m_QTMovie = 0;
+ m_currentTime = 0;
+ m_currentTrack = track;
+
+ if (!m_folderTracks)
+ return;
+ if (track < 0 || track >= (int)[m_folderTracks count])
+ return;
+
+ NSString *trackPath = [m_folderTracks objectAtIndex:track];
+ QTDataReference *dataRef = [QTDataReference dataReferenceWithReferenceToFile:trackPath];
+ State currentState = m_state;
+ openMovieFromDataRef(dataRef);
+ prepareCurrentMovieForPlayback();
+ if (currentState == Playing)
+ play();
+}
+
}}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/qt7/videoframe.mm b/src/3rdparty/phonon/qt7/videoframe.mm
index 92a3cd5..7b67b5e 100644
--- a/src/3rdparty/phonon/qt7/videoframe.mm
+++ b/src/3rdparty/phonon/qt7/videoframe.mm
@@ -20,6 +20,8 @@
#import <QuartzCore/CIFilter.h>
#import <QuartzCore/CIContext.h>
+//#define CACHE_CV_TEXTURE
+
QT_BEGIN_NAMESPACE
namespace Phonon
@@ -70,7 +72,9 @@ namespace QT7
void VideoFrame::copyMembers(const VideoFrame& frame)
{
+#ifdef CACHE_CV_TEXTURE
m_cachedCVTextureRef = frame.m_cachedCVTextureRef;
+#endif
m_cachedCIImage = frame.m_cachedCIImage;
m_cachedQImage = frame.m_cachedQImage;
m_cachedNSBitmap = frame.m_cachedNSBitmap;
@@ -105,11 +109,20 @@ namespace QT7
CVOpenGLTextureRef VideoFrame::cachedCVTexture() const
{
+#ifdef CACHE_CV_TEXTURE
if (!m_cachedCVTextureRef && m_videoPlayer){
m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation);
(const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = m_videoPlayer->currentFrameAsCVTexture();
+ CVOpenGLTextureRetain((const_cast<VideoFrame *>(this))->m_cachedCVTextureRef);
}
return m_cachedCVTextureRef;
+#else
+ if (m_videoPlayer){
+ m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation);
+ return m_videoPlayer->currentFrameAsCVTexture();
+ }
+ return 0;
+#endif
}
void *VideoFrame::cachedCIImage() const
@@ -329,10 +342,12 @@ namespace QT7
void VideoFrame::invalidateImage() const
{
+#ifdef CACHE_CV_TEXTURE
if (m_cachedCVTextureRef){
CVOpenGLTextureRelease(m_cachedCVTextureRef);
(const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;
}
+#endif
if (m_cachedCIImage){
[(CIImage *) m_cachedCIImage release];
(const_cast<VideoFrame *>(this))->m_cachedCIImage = 0;
@@ -346,8 +361,10 @@ namespace QT7
void VideoFrame::retain() const
{
+#ifdef CACHE_CV_TEXTURE
if (m_cachedCVTextureRef)
CVOpenGLTextureRetain(m_cachedCVTextureRef);
+#endif
if (m_cachedCIImage)
[(CIImage *) m_cachedCIImage retain];
if (m_backgroundFrame)
@@ -358,8 +375,12 @@ namespace QT7
void VideoFrame::release() const
{
- if (m_cachedCVTextureRef)
+#ifdef CACHE_CV_TEXTURE
+ if (m_cachedCVTextureRef){
CVOpenGLTextureRelease(m_cachedCVTextureRef);
+ (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;
+ }
+#endif
if (m_cachedCIImage)
[(CIImage *) m_cachedCIImage release];
if (m_backgroundFrame)
@@ -368,7 +389,6 @@ namespace QT7
[m_cachedNSBitmap release];
(const_cast<VideoFrame *>(this))->m_backgroundFrame = 0;
- (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;
(const_cast<VideoFrame *>(this))->m_cachedCIImage = 0;
(const_cast<VideoFrame *>(this))->m_cachedNSBitmap = 0;
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
index e6e8f23..5b849e4 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
@@ -32,6 +32,6 @@
#error "Unknown Unicode implementation"
#endif
-COMPILE_ASSERT(sizeof(UChar) == 2, UCharIsTwoBytes);
+COMPILE_ASSERT(sizeof(UChar) == 2, UCharIsTwoBytes)
#endif // WTF_UNICODE_H
diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
index 4b94a94..26323e8 100644
--- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp
@@ -337,7 +337,7 @@ JSValuePtr QtField::valueFromInstance(ExecState* exec, const Instance* inst) con
return ret;
} else {
- QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name()));
+ QString msg = QString::fromLatin1("cannot access member `%1' of deleted QObject").arg(QLatin1String(name()));
return throwError(exec, GeneralError, msg.toLatin1().constData());
}
}
@@ -362,7 +362,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValueP
} else if (m_type == DynamicProperty)
obj->setProperty(m_dynamicProperty.constData(), val);
} else {
- QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name()));
+ QString msg = QString::fromLatin1("cannot access member `%1' of deleted QObject").arg(QLatin1String(name()));
throwError(exec, GeneralError, msg.toLatin1().constData());
}
}
diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
index c7ba6c2..5a73dc7 100644
--- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
@@ -1515,7 +1515,7 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb
bool ok = QMetaObject::connect(sender, signalIndex, conn, conn->metaObject()->methodOffset());
if (!ok) {
delete conn;
- QString msg = QString(QLatin1String("QtMetaMethod.connect: failed to connect to %1::%2()"))
+ QString msg = QString::fromLatin1("QtMetaMethod.connect: failed to connect to %1::%2()")
.arg(QLatin1String(sender->metaObject()->className()))
.arg(QLatin1String(d->m_signature));
return throwError(exec, GeneralError, msg.toLatin1().constData());
@@ -1541,14 +1541,14 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb
}
if (!ret) {
- QString msg = QString(QLatin1String("QtMetaMethod.disconnect: failed to disconnect from %1::%2()"))
+ QString msg = QString::fromLatin1("QtMetaMethod.disconnect: failed to disconnect from %1::%2()")
.arg(QLatin1String(sender->metaObject()->className()))
.arg(QLatin1String(d->m_signature));
return throwError(exec, GeneralError, msg.toLatin1().constData());
}
}
} else {
- QString msg = QString(QLatin1String("QtMetaMethod.%1: %2::%3() is not a signal"))
+ QString msg = QString::fromLatin1("QtMetaMethod.%1: %2::%3() is not a signal")
.arg(QLatin1String(d->m_isConnect ? "connect": "disconnect"))
.arg(QLatin1String(sender->metaObject()->className()))
.arg(QLatin1String(d->m_signature));
diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
index 30926e1..39ccefe 100644
--- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
@@ -357,7 +357,7 @@ HashMap<String, String> parseAttributes(const String& string, bool& attrsOK)
state.gotAttributes = false;
QXmlStreamReader stream;
- QString dummy = QString(QLatin1String("<?xml version=\"1.0\"?><attrs %1 />")).arg(string);
+ QString dummy = QString::fromLatin1("<?xml version=\"1.0\"?><attrs %1 />").arg(string);
stream.addData(dummy);
while (!stream.atEnd()) {
stream.readNext();
@@ -622,7 +622,7 @@ void XMLTokenizer::parseProcessingInstruction()
#if ENABLE(XSLT)
m_sawXSLTransform = !m_sawFirstElement && pi->isXSL();
- if (m_sawXSLTransform && !m_doc->transformSourceDocument()))
+ if (m_sawXSLTransform && !m_doc->transformSourceDocument())
stopParsing();
#endif
}
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
index e68be2b..bff9edb 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
@@ -286,10 +286,10 @@ String Path::debugString() const
switch (cur.type) {
case QPainterPath::MoveToElement:
- ret += QString(QLatin1String("M %1 %2")).arg(cur.x).arg(cur.y);
+ ret += QString::fromLatin1("M %1 %2").arg(cur.x).arg(cur.y);
break;
case QPainterPath::LineToElement:
- ret += QString(QLatin1String("L %1 %2")).arg(cur.x).arg(cur.y);
+ ret += QString::fromLatin1("L %1 %2").arg(cur.x).arg(cur.y);
break;
case QPainterPath::CurveToElement:
{
@@ -299,7 +299,7 @@ String Path::debugString() const
Q_ASSERT(c1.type == QPainterPath::CurveToDataElement);
Q_ASSERT(c2.type == QPainterPath::CurveToDataElement);
- ret += QString(QLatin1String("C %1 %2 %3 %4 %5 %6")).arg(cur.x).arg(cur.y).arg(c1.x).arg(c1.y).arg(c2.x).arg(c2.y);
+ ret += QString::fromLatin1("C %1 %2 %3 %4 %5 %6").arg(cur.x).arg(cur.y).arg(c1.x).arg(c1.y).arg(c2.x).arg(c2.y);
i += 2;
break;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 01b68eb..77add54 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1986,10 +1986,12 @@ bool QWebPage::isContentEditable() const
/*!
\property QWebPage::forwardUnsupportedContent
- \brief whether QWebPage should forward unsupported content through the
- unsupportedContent signal
+ \brief whether QWebPage should forward unsupported content
- If disabled the download of such content is aborted immediately.
+ If enabled, the unsupportedContent() signal is emitted with a network reply that
+ can be used to read the content.
+
+ If disabled, the download of such content is aborted immediately.
By default unsupported content is not forwarded.
*/
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
index 1ad23f6..b516263 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
@@ -213,17 +213,25 @@ QWebSettings *QWebSettings::globalSettings()
Each QWebPage object has its own QWebSettings object, which configures the
settings for that page. If a setting is not configured, then it is looked
up in the global settings object, which can be accessed using
- QWebSettings::globalSettings().
+ globalSettings().
- QWebSettings allows configuring font properties such as font size and font
- family, the location of a custom stylesheet, and generic attributes like java
- script, plugins, etc. The \l{QWebSettings::WebAttribute}{WebAttribute}
- enum further describes this.
+ QWebSettings allows configuration of browser properties, such as font sizes and
+ families, the location of a custom style sheet, and generic attributes like
+ JavaScript and plugins. Individual attributes are set using the setAttribute()
+ function. The \l{QWebSettings::WebAttribute}{WebAttribute} enum further describes
+ each attribute.
- QWebSettings also configures global properties such as the web page memory
- cache and the web page icon database, local database storage and offline
+ QWebSettings also configures global properties such as the Web page memory
+ cache and the Web page icon database, local database storage and offline
applications storage.
+ \section1 Enabling Plugins
+
+ Support for browser plugins can enabled by setting the
+ \l{QWebSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications,
+ this attribute is enabled for all pages by setting it on the
+ \l{globalSettings()}{global settings object}.
+
\section1 Web Application Support
WebKit provides support for features specified in \l{HTML 5} that improve the
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
index 06305e0..119c126 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
+++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
@@ -96,7 +96,8 @@
Since WebKit supports the Netscape Plugin API, Qt applications can display
Web pages that embed common plugins, as long as the user has the appropriate
- binary files for those plugins installed.
+ binary files for those plugins installed and the \l{QWebSettings::PluginsEnabled}
+ attribute is set for the application.
The following locations are searched for plugins: