00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "urihandler.h"
00018 #include "element.h"
00019 #include <gst/gsturi.h>
00020 #include <QtCore/QUrl>
00021 #include <QtCore/QStringList>
00022
00023 namespace QGst {
00024
00025
00026 bool UriHandler::protocolIsSupported(UriType type, const char *protocol)
00027 {
00028 return gst_uri_protocol_is_supported(static_cast<GstURIType>(type), protocol);
00029 }
00030
00031
00032 ElementPtr UriHandler::makeFromUri(UriType type, const QUrl & uri, const char *elementName)
00033 {
00034 GstElement *e = gst_element_make_from_uri(static_cast<GstURIType>(type), uri.toEncoded(), elementName);
00035 if (e) {
00036 gst_object_ref_sink(e);
00037 }
00038 return ElementPtr::wrap(e, false);
00039 }
00040
00041 UriType UriHandler::uriType() const
00042 {
00043 return static_cast<UriType>(gst_uri_handler_get_uri_type(object<GstURIHandler>()));
00044 }
00045
00046 QStringList UriHandler::supportedProtocols() const
00047 {
00048 QStringList result;
00049 char **protocols = gst_uri_handler_get_protocols(object<GstURIHandler>());
00050 if (protocols) {
00051 for (char **p = protocols; p && *p; ++p) {
00052 result.append(QString::fromUtf8(*p));
00053 }
00054 }
00055 return result;
00056 }
00057
00058 QUrl UriHandler::uri() const
00059 {
00060
00061
00062 return QUrl::fromPercentEncoding(gst_uri_handler_get_uri(object<GstURIHandler>()));
00063 }
00064
00065 bool UriHandler::setUri(const QUrl & uri)
00066 {
00067 return gst_uri_handler_set_uri(object<GstURIHandler>(), uri.toEncoded());
00068 }
00069
00070 }