diff options
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/platform/gstreamer/common/qgst_p.h | 1 | ||||
-rw-r--r-- | src/multimedia/platform/gstreamer/common/qgstutils.cpp | 19 | ||||
-rw-r--r-- | src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/platform/windows/player/mfmetadata.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/platform/windows/player/mftvideo.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/qmediametadata.cpp | 1 | ||||
-rw-r--r-- | src/multimedia/video/qvideosurfaceformat.cpp | 188 | ||||
-rw-r--r-- | src/multimedia/video/qvideosurfaceformat.h | 11 |
8 files changed, 12 insertions, 218 deletions
diff --git a/src/multimedia/platform/gstreamer/common/qgst_p.h b/src/multimedia/platform/gstreamer/common/qgst_p.h index b779960f9..f4cb5684d 100644 --- a/src/multimedia/platform/gstreamer/common/qgst_p.h +++ b/src/multimedia/platform/gstreamer/common/qgst_p.h @@ -154,7 +154,6 @@ public: Q_MULTIMEDIA_EXPORT QSize resolution() const; Q_MULTIMEDIA_EXPORT QVideoFrame::PixelFormat pixelFormat() const; - Q_MULTIMEDIA_EXPORT QSize pixelAspectRatio() const; Q_MULTIMEDIA_EXPORT QGRange<float> frameRateRange() const; QByteArray toString() const { return gst_structure_to_string(structure); } diff --git a/src/multimedia/platform/gstreamer/common/qgstutils.cpp b/src/multimedia/platform/gstreamer/common/qgstutils.cpp index 1fed48717..ae8a625e0 100644 --- a/src/multimedia/platform/gstreamer/common/qgstutils.cpp +++ b/src/multimedia/platform/gstreamer/common/qgstutils.cpp @@ -362,9 +362,6 @@ QVideoSurfaceFormat QGstUtils::formatForCaps( if (infoPtr->fps_d > 0) format.setFrameRate(qreal(infoPtr->fps_n) / infoPtr->fps_d); - if (infoPtr->par_d > 0) - format.setPixelAspectRatio(infoPtr->par_n, infoPtr->par_d); - return format; } } @@ -519,22 +516,6 @@ QVideoFrame::PixelFormat QGstStructure::pixelFormat() const return pixelFormat; } -QSize QGstStructure::pixelAspectRatio() const -{ - QSize ratio(1, 1); - - gint aspectNum = 0; - gint aspectDenum = 0; - if (structure && gst_structure_get_fraction(structure, "pixel-aspect-ratio", &aspectNum, &aspectDenum)) { - if (aspectDenum > 0) { - ratio.rwidth() = aspectNum; - ratio.rheight() = aspectDenum; - } - } - - return ratio; -} - QGRange<float> QGstStructure::frameRateRange() const { float minRate = 0.; diff --git a/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp b/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp index f0cc0ddbe..4f5eadc64 100644 --- a/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp +++ b/src/multimedia/platform/windows/evr/evrd3dpresentengine.cpp @@ -373,10 +373,6 @@ done: : qt_evr_pixelFormatFromD3DFormat(d3dFormat), m_useTextureRendering ? QVideoFrame::GLTextureHandle : QVideoFrame::NoHandle); - UINT32 horizontal = 1, vertical = 1; - hr = MFGetAttributeRatio(format, MF_MT_PIXEL_ASPECT_RATIO, &horizontal, &vertical); - if (SUCCEEDED(hr)) - m_surfaceFormat.setPixelAspectRatio(horizontal, vertical); } else { releaseResources(); } diff --git a/src/multimedia/platform/windows/player/mfmetadata.cpp b/src/multimedia/platform/windows/player/mfmetadata.cpp index 3800deb67..a6b16e2d4 100644 --- a/src/multimedia/platform/windows/player/mfmetadata.cpp +++ b/src/multimedia/platform/windows/player/mfmetadata.cpp @@ -314,8 +314,6 @@ QMediaMetaData MFMetaData::fromNative(IMFMediaSource* mediaSource) mediaKey = QMediaMetaData::Resolution; } else if (key == PKEY_Video_Orientation) { mediaKey = QMediaMetaData::Orientation; -// } else if (key == PKEY_Video_HorizontalAspectRatio) { -// mediaKey = QMediaMetaData::PixelAspectRatio; // } else if (key == PKEY_Video_FrameRate) { // mediaKey = QMediaMetaData::VideoFrameRate; } else if (key == PKEY_Video_EncodingBitrate) { diff --git a/src/multimedia/platform/windows/player/mftvideo.cpp b/src/multimedia/platform/windows/player/mftvideo.cpp index 8bb2f86be..8d318a6f6 100644 --- a/src/multimedia/platform/windows/player/mftvideo.cpp +++ b/src/multimedia/platform/windows/player/mftvideo.cpp @@ -654,10 +654,6 @@ QVideoSurfaceFormat MFTransform::videoFormatForMFMediaType(IMFMediaType *mediaTy QVideoFrame::PixelFormat pixelFormat = formatFromSubtype(subtype); QVideoSurfaceFormat format(size, pixelFormat); - UINT32 num, den; - if (SUCCEEDED(MFGetAttributeRatio(mediaType, MF_MT_PIXEL_ASPECT_RATIO, &num, &den))) { - format.setPixelAspectRatio(num, den); - } if (SUCCEEDED(MFGetAttributeRatio(mediaType, MF_MT_FRAME_RATE, &num, &den))) { format.setFrameRate(qreal(num)/den); } diff --git a/src/multimedia/qmediametadata.cpp b/src/multimedia/qmediametadata.cpp index 2e4f335ce..7a2ee634f 100644 --- a/src/multimedia/qmediametadata.cpp +++ b/src/multimedia/qmediametadata.cpp @@ -112,7 +112,6 @@ QT_BEGIN_NAMESPACE \header \li {3,1} Image and video attributes \row \li Resolution \li The dimensions of an image or video. \li QSize - \row \li PixelAspectRatio \li The pixel aspect ratio of an image or video. \li QSize \row \li Orientation \li Orientation of an image or video. \li int (degrees) \header \li {3,1} diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp index d80389151..05901b679 100644 --- a/src/multimedia/video/qvideosurfaceformat.cpp +++ b/src/multimedia/video/qvideosurfaceformat.cpp @@ -59,7 +59,6 @@ public: : pixelFormat(format) , handleType(type) , frameSize(size) - , pixelAspectRatio(1, 1) , viewport(QPoint(0, 0), size) { } @@ -70,20 +69,11 @@ public: && handleType == other.handleType && scanLineDirection == other.scanLineDirection && frameSize == other.frameSize - && pixelAspectRatio == other.pixelAspectRatio && viewport == other.viewport && frameRatesEqual(frameRate, other.frameRate) && ycbcrColorSpace == other.ycbcrColorSpace - && mirrored == other.mirrored - && propertyNames.count() == other.propertyNames.count()) { - for (int i = 0; i < propertyNames.count(); ++i) { - int j = other.propertyNames.indexOf(propertyNames.at(i)); - - if (j == -1 || propertyValues.at(i) != other.propertyValues.at(j)) - return false; - } + && mirrored == other.mirrored) return true; - } return false; } @@ -97,13 +87,10 @@ public: QVideoFrame::HandleType handleType = QVideoFrame::NoHandle; QVideoSurfaceFormat::Direction scanLineDirection = QVideoSurfaceFormat::TopToBottom; QSize frameSize; - QSize pixelAspectRatio; QVideoSurfaceFormat::YCbCrColorSpace ycbcrColorSpace = QVideoSurfaceFormat::YCbCr_Undefined; QRect viewport; qreal frameRate = 0.0; bool mirrored = false; - QList<QByteArray> propertyNames; - QList<QVariant> propertyValues; }; /*! @@ -129,7 +116,7 @@ public: than the nearest optimal size of a video frame. For example the width of a frame may be extended so that the start of each scan line is eight byte aligned. - Other common properties are the pixelAspectRatio(), scanLineDirection(), and frameRate(). + Other common properties are the scanLineDirection(), and frameRate(). Additionally a stream may have some additional type specific properties which are listed by the dynamicPropertyNames() function and can be accessed using the property(), and setProperty() functions. @@ -358,32 +345,6 @@ void QVideoSurfaceFormat::setFrameRate(qreal rate) } /*! - Returns a video stream's pixel aspect ratio. -*/ -QSize QVideoSurfaceFormat::pixelAspectRatio() const -{ - return d->pixelAspectRatio; -} - -/*! - Sets a video stream's pixel aspect \a ratio. -*/ -void QVideoSurfaceFormat::setPixelAspectRatio(const QSize &ratio) -{ - d->pixelAspectRatio = ratio; -} - -/*! - \overload - - Sets the \a horizontal and \a vertical elements of a video stream's pixel aspect ratio. -*/ -void QVideoSurfaceFormat::setPixelAspectRatio(int horizontal, int vertical) -{ - d->pixelAspectRatio = QSize(horizontal, vertical); -} - -/*! Returns the Y'CbCr color space of a video stream. */ QVideoSurfaceFormat::YCbCrColorSpace QVideoSurfaceFormat::yCbCrColorSpace() const @@ -432,137 +393,13 @@ void QVideoSurfaceFormat::setMirrored(bool mirrored) /*! Returns a suggested size in pixels for the video stream. - This is the size of the viewport scaled according to the pixel aspect ratio. + This is the same as the size of the viewport. */ QSize QVideoSurfaceFormat::sizeHint() const { - QSize size = d->viewport.size(); - - if (d->pixelAspectRatio.height() != 0) - size.setWidth(size.width() * d->pixelAspectRatio.width() / d->pixelAspectRatio.height()); - - return size; + return d->viewport.size(); } -/*! - Returns a list of video format dynamic property names. -*/ -QList<QByteArray> QVideoSurfaceFormat::propertyNames() const -{ - return (QList<QByteArray>() - << "handleType" - << "pixelFormat" - << "frameSize" - << "frameWidth" - << "viewport" - << "scanLineDirection" - << "frameRate" - << "pixelAspectRatio" - << "sizeHint" - << "yCbCrColorSpace" - << "mirrored") - + d->propertyNames; -} - -/*! - Returns the value of the video format's \a name property. -*/ -QVariant QVideoSurfaceFormat::property(const char *name) const -{ - if (qstrcmp(name, "handleType") == 0) { - return QVariant::fromValue(d->handleType); - } else if (qstrcmp(name, "pixelFormat") == 0) { - return QVariant::fromValue(d->pixelFormat); - } else if (qstrcmp(name, "frameSize") == 0) { - return d->frameSize; - } else if (qstrcmp(name, "frameWidth") == 0) { - return d->frameSize.width(); - } else if (qstrcmp(name, "frameHeight") == 0) { - return d->frameSize.height(); - } else if (qstrcmp(name, "viewport") == 0) { - return d->viewport; - } else if (qstrcmp(name, "scanLineDirection") == 0) { - return QVariant::fromValue(d->scanLineDirection); - } else if (qstrcmp(name, "frameRate") == 0) { - return QVariant::fromValue(d->frameRate); - } else if (qstrcmp(name, "pixelAspectRatio") == 0) { - return QVariant::fromValue(d->pixelAspectRatio); - } else if (qstrcmp(name, "sizeHint") == 0) { - return sizeHint(); - } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { - return QVariant::fromValue(d->ycbcrColorSpace); - } else if (qstrcmp(name, "mirrored") == 0) { - return d->mirrored; - } else { - int id = 0; - for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} - - return id < d->propertyValues.count() - ? d->propertyValues.at(id) - : QVariant(); - } -} - -/*! - Sets the video format's \a name property to \a value. - - Trying to set a read only property will be ignored. - -*/ -void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value) -{ - if (qstrcmp(name, "handleType") == 0) { - // read only. - } else if (qstrcmp(name, "pixelFormat") == 0) { - // read only. - } else if (qstrcmp(name, "frameSize") == 0) { - if (value.canConvert<QSize>()) { - d->frameSize = qvariant_cast<QSize>(value); - d->viewport = QRect(QPoint(0, 0), d->frameSize); - } - } else if (qstrcmp(name, "frameWidth") == 0) { - // read only. - } else if (qstrcmp(name, "frameHeight") == 0) { - // read only. - } else if (qstrcmp(name, "viewport") == 0) { - if (value.canConvert<QRect>()) - d->viewport = qvariant_cast<QRect>(value); - } else if (qstrcmp(name, "scanLineDirection") == 0) { - if (value.canConvert<Direction>()) - d->scanLineDirection = qvariant_cast<Direction>(value); - } else if (qstrcmp(name, "frameRate") == 0) { - if (value.canConvert<qreal>()) - d->frameRate = qvariant_cast<qreal>(value); - } else if (qstrcmp(name, "pixelAspectRatio") == 0) { - if (value.canConvert<QSize>()) - d->pixelAspectRatio = qvariant_cast<QSize>(value); - } else if (qstrcmp(name, "sizeHint") == 0) { - // read only. - } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { - if (value.canConvert<YCbCrColorSpace>()) - d->ycbcrColorSpace = qvariant_cast<YCbCrColorSpace>(value); - } else if (qstrcmp(name, "mirrored") == 0) { - if (value.canConvert<bool>()) - d->mirrored = qvariant_cast<bool>(value); - } else { - int id = 0; - for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} - - if (id < d->propertyValues.count()) { - if (value.isNull()) { - d->propertyNames.removeAt(id); - d->propertyValues.removeAt(id); - } else { - d->propertyValues[id] = value; - } - } else if (!value.isNull()) { - d->propertyNames.append(QByteArray(name)); - d->propertyValues.append(value); - } - } -} - - #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, QVideoSurfaceFormat::YCbCrColorSpace cs) { @@ -584,9 +421,6 @@ QDebug operator<<(QDebug dbg, QVideoSurfaceFormat::YCbCrColorSpace cs) case QVideoSurfaceFormat::YCbCr_xvYCC709: dbg << "YCbCr_xvYCC709"; break; - case QVideoSurfaceFormat::YCbCr_CustomMatrix: - dbg << "YCbCr_CustomMatrix"; - break; default: dbg << "YCbCr_Undefined"; break; @@ -614,13 +448,15 @@ QDebug operator<<(QDebug dbg, const QVideoSurfaceFormat &f) QDebugStateSaver saver(dbg); dbg.nospace(); dbg << "QVideoSurfaceFormat(" << f.pixelFormat() << ", " << f.frameSize() - << ", viewport=" << f.viewport() << ", pixelAspectRatio=" << f.pixelAspectRatio() + << ", viewport=" << f.viewport() << ", handleType=" << f.handleType() << ", yCbCrColorSpace=" << f.yCbCrColorSpace() - << ')'; - - const auto propertyNames = f.propertyNames(); - for (const QByteArray& propertyName : propertyNames) - dbg << "\n " << propertyName.data() << " = " << f.property(propertyName.data()); + << ')' + << "\n pixel format=" << f.pixelFormat() + << "\n frame size=" << f.frameSize() + << "\n viewport=" << f.viewport() + << "\n yCbCrColorSpace=" << f.yCbCrColorSpace() + << "\n frameRate=" << f.frameRate() + << "\n mirrored=" << f.isMirrored(); return dbg; } diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h index 417b53d8f..dca8c808c 100644 --- a/src/multimedia/video/qvideosurfaceformat.h +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -71,9 +71,6 @@ public: YCbCr_xvYCC601, YCbCr_xvYCC709, YCbCr_JPEG, -#ifndef Q_QDOC - YCbCr_CustomMatrix -#endif }; QVideoSurfaceFormat(); @@ -110,10 +107,6 @@ public: qreal frameRate() const; void setFrameRate(qreal rate); - QSize pixelAspectRatio() const; - void setPixelAspectRatio(const QSize &ratio); - void setPixelAspectRatio(int width, int height); - YCbCrColorSpace yCbCrColorSpace() const; void setYCbCrColorSpace(YCbCrColorSpace colorSpace); @@ -122,10 +115,6 @@ public: QSize sizeHint() const; - QList<QByteArray> propertyNames() const; - QVariant property(const char *name) const; - void setProperty(const char *name, const QVariant &value); - private: QSharedDataPointer<QVideoSurfaceFormatPrivate> d; }; |