* @param uri to create the data source for.
* @return A data source representing the uri
*/
- public abstract DataSource create_data_source (string uri);
+ public abstract DataSource? create_data_source (string uri);
}
using Gst;
+internal errordomain Rygel.GstDataSourceError {
+ NOT_COMPATIBLE
+}
+
internal class Rygel.GstDataSource : Rygel.DataSource, GLib.Object {
internal dynamic Element src;
private Pipeline pipeline;
private GstSink sink;
private uint bus_watch_id;
- public GstDataSource (string uri) {
+ public GstDataSource (string uri) throws Error {
this.src = GstUtils.create_source_for_uri (uri);
+ if (this.src == null) {
+ var msg = _("Could not create GstElement for URI %s");
+
+ throw new GstDataSourceError.NOT_COMPATIBLE (msg, uri);
+ }
}
~GstDataSource () {
return this.transcoders;
}
- public override DataSource create_data_source (string uri) {
- return new GstDataSource (uri);
+ public override DataSource? create_data_source (string uri) {
+ try {
+ return new GstDataSource (uri);
+ } catch (Error error) {
+ return null;
+ }
}
public DataSource create_data_source_from_element (Element element) {
return null;
}
- public override DataSource create_data_source (string uri) {
+ public override DataSource? create_data_source (string uri) {
+ if (!uri.has_prefix ("file://")) {
+ return null;
+ }
+
return new SimpleDataSource (uri);
}
}
return null;
}
- public override DataSource create_data_source (string uri) {
+ public override DataSource? create_data_source (string uri) {
return null;
}
}