2 * This file is a part of MAFW
4 * Copyright (C) 2007, 2008, 2009 Nokia Corporation, all rights reserved.
6 * Contact: Visa Smolander <visa.smolander@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
31 #include "mafw-gst-renderer-utils.h"
34 #define G_LOG_DOMAIN "mafw-gst-renderer-utils"
39 * @dst: location for utf8 version of @src.
41 * Tries to convert @src into UTF-8, placing it into @dst.
43 * Returns: TRUE on success.
45 gboolean convert_utf8(const gchar *src, gchar **dst)
51 if (g_utf8_validate(src, -1, NULL)) {
56 *dst = g_locale_to_utf8(src, -1, NULL, NULL, &error);
58 g_warning("utf8 conversion failed '%s' (%d: %s)",
59 src, error->code, error->message);
66 gboolean uri_is_playlist(const gchar *uri) {
67 /* TODO: Return if the uri is a playlist or not, using the mime type
68 instead of the file extension. */
69 if ((g_str_has_suffix(uri, ".pls")) ||
70 (g_str_has_suffix(uri, ".m3u")) ||
71 (g_str_has_suffix(uri, ".smil")) ||
72 (g_str_has_suffix(uri, ".smi")) ||
73 (g_str_has_suffix(uri, ".wpl")) ||
74 (g_str_has_suffix(uri, ".wax")) ||
75 (g_str_has_suffix(uri, ".uni")) ||
76 (g_str_has_suffix(uri, ".ram")) ||
77 /* (g_str_has_suffix(uri, ".ra")) || */
78 (g_str_has_suffix(uri, ".asx")) ||
79 (g_str_has_suffix(uri, ".rpm")))
88 * @uri: the URI to be checked.
90 * Check if given URI is a stream (not a local resource). To not depend on
91 * gnomevfs for this, we assume everything that doesn't start with "file://" is
94 * Returns: TRUE if the URI is not local.
96 gboolean uri_is_stream(const gchar *uri)
101 return !g_str_has_prefix(uri, "file://");
105 /* vi: set noexpandtab ts=8 sw=8 cino=t0,(0: */