}
}
-template <int type> struct MpvProperty;
-
-template <> struct MpvProperty<MPV_FORMAT_NONE> {
- static void read(struct mpv_event_property *property) {
- Q_ASSERT(property->format == MPV_FORMAT_NONE);
- }
-};
-
-template <> struct MpvProperty<MPV_FORMAT_FLAG> {
- static bool read(struct mpv_event_property *property) {
- Q_ASSERT(property->format == MPV_FORMAT_FLAG);
- Q_CHECK_PTR(property->data);
- return *static_cast<int *>(property->data) ? true : false;
- }
-};
-
-template <> struct MpvProperty<MPV_FORMAT_INT64> {
- static qint64 read(struct mpv_event_property *property) {
- Q_ASSERT(property->format == MPV_FORMAT_INT64);
- Q_CHECK_PTR(property->data);
- return *static_cast<qint64 *>(property->data);
- }
-};
-
-template <> struct MpvProperty<MPV_FORMAT_DOUBLE> {
- static double read(struct mpv_event_property *property) {
- Q_ASSERT(property->format == MPV_FORMAT_DOUBLE);
- Q_CHECK_PTR(property->data);
- return *static_cast<double *>(property->data);
- }
-};
-
-template <> struct MpvProperty<MPV_FORMAT_NODE> {
- static mpv_node *read(struct mpv_event_property *property) {
- Q_ASSERT(property->format == MPV_FORMAT_NODE);
- if (!property->data)
- qWarning("Property data data is null");
- return static_cast<mpv_node *>(property->data);
- }
-};
-
-template <> struct MpvProperty<MPV_FORMAT_STRING> {
- static char *read(struct mpv_event_property *property) {
- Q_ASSERT(property->format == MPV_FORMAT_STRING);
- Q_CHECK_PTR(property->data);
- return *static_cast<char **>(property->data);
- }
-};
-
-template <int TYPE>
-decltype(auto) readProperty(struct mpv_event_property *property) {
- return MpvProperty<TYPE>::read(property);
-}
-
int MpvInstance::readTrackIndex(const QString &qstr) {
qCDebug(mpvBackend).nospace() << "Trying to read id from >" << qstr << "<";