--- /dev/null
+#ifndef MafwGstRendererPlaylistFileUtility_H
+#define MafwGstRendererPlaylistFileUtility_H
+
+#include <QObject>
+#include <QStringList>
+#include <totem-pl-parser/1/plparser/totem-pl-parser.h>
+#include <MafwError.h>
+
+class QUrl;
+
+/**
+ * Utility class for parsing playlist files.
+ */
+class MafwGstRendererPlaylistFileUtility : public QObject
+{
+ Q_OBJECT
+public:
+ /**
+ * Constructor
+ */
+ MafwGstRendererPlaylistFileUtility(QObject* parent);
+
+ /**
+ * Destructor
+ */
+ ~MafwGstRendererPlaylistFileUtility();
+
+ /**
+ * Returns the parsed URI list
+ * @return list of parsed URIs
+ */
+ QStringList getUriList();
+
+ /**
+ * Starts playlist file parsing, parsingReady is signalled when parsing
+ * has been done. Parsed uris can be fetched using getUri() function.
+ * @param uri The absolute uri to the playlist file.
+ */
+ void parsePlaylistFile(const QUrl& uri);
+
+ /**
+ * Removes the first unused uri parsed from playlist and returns it.
+ * @return The first unused playlist uri or empty string if each uris are
+ * used or parsing has been failed.
+ */
+ QString takeFirstUri();
+
+ /**
+ * Saves the pending error that will be fired, if no new URI's are found.
+ * This error saving feature is needed because we don't get the proper
+ * "parsing ended" signals from Totem playlist parser.
+ * @param error The error to be saved.
+ */
+ void setPendingError(MafwError& error);
+
+ /**
+ * Returns the saved error.
+ * @return The saved error.
+ */
+ MafwError takePendingError();
+
+Q_SIGNALS:
+ /** Signal telling that first uri on playlist file is parsed. */
+ void firstItemParsed();
+ /** Signal telling that parsing is ready. */
+ void parsingReady(bool succeeded);
+
+private:
+ static void readyCb(TotemPlParser* parser,
+ GAsyncResult *async_result,
+ MafwGstRendererPlaylistFileUtility* self);
+ static void uriParsed(TotemPlParser *parser,
+ gchar* uri,
+ gpointer metadata,
+ MafwGstRendererPlaylistFileUtility* self);
+
+private:
+ /** Modifies the resulting item URI if necessary.
+ * Unfortunately there are various reasons why this is required.
+ */
+ QString manHandleURI(const QString &itemUri) const;
+
+private:
+ /** Unique id (=pointer) of currently used parser. */
+ TotemPlParser* m_parserId;
+ /** The list of parsed uris. */
+ QStringList m_uriList;
+ /** Parsing the first item */
+ bool m_firstItem;
+ /** The pending error */
+ MafwError m_pendingError;
+};
+
+#endif // MafwGstRendererPlaylistFileUtility_H