1 #ifndef MafwGstRendererPlaylistFileUtility_H
2 #define MafwGstRendererPlaylistFileUtility_H
6 #include <totem-pl-parser/1/plparser/totem-pl-parser.h>
12 * Utility class for parsing playlist files.
14 class MafwGstRendererPlaylistFileUtility : public QObject
21 MafwGstRendererPlaylistFileUtility(QObject* parent);
26 ~MafwGstRendererPlaylistFileUtility();
29 * Returns the parsed URI list
30 * @return list of parsed URIs
32 QStringList getUriList();
35 * Starts playlist file parsing, parsingReady is signalled when parsing
36 * has been done. Parsed uris can be fetched using getUri() function.
37 * @param uri The absolute uri to the playlist file.
39 void parsePlaylistFile(const QUrl& uri);
42 * Removes the first unused uri parsed from playlist and returns it.
43 * @return The first unused playlist uri or empty string if each uris are
44 * used or parsing has been failed.
46 QString takeFirstUri();
49 * Saves the pending error that will be fired, if no new URI's are found.
50 * This error saving feature is needed because we don't get the proper
51 * "parsing ended" signals from Totem playlist parser.
52 * @param error The error to be saved.
54 void setPendingError(MafwError& error);
57 * Returns the saved error.
58 * @return The saved error.
60 MafwError takePendingError();
63 /** Signal telling that first uri on playlist file is parsed. */
64 void firstItemParsed();
65 /** Signal telling that parsing is ready. */
66 void parsingReady(bool succeeded);
69 static void readyCb(TotemPlParser* parser,
70 GAsyncResult *async_result,
71 MafwGstRendererPlaylistFileUtility* self);
72 static void uriParsed(TotemPlParser *parser,
75 MafwGstRendererPlaylistFileUtility* self);
78 /** Modifies the resulting item URI if necessary.
79 * Unfortunately there are various reasons why this is required.
81 QString manHandleURI(const QString &itemUri) const;
84 /** Unique id (=pointer) of currently used parser. */
85 TotemPlParser* m_parserId;
86 /** The list of parsed uris. */
87 QStringList m_uriList;
88 /** Parsing the first item */
90 /** The pending error */
91 MafwError m_pendingError;
94 #endif // MafwGstRendererPlaylistFileUtility_H