return;
}
- // Just use the first URI available
- string uri = null;
- if (this.item.uris.size != 0) {
- uri = this.item.uris.get (0);
- }
-
if (this.item.size > 0 && this.transcoder == null) {
- this.handle_interactive_item (uri);
+ this.handle_interactive_item ();
} else {
- this.handle_streaming_item (uri);
+ this.handle_streaming_item ();
}
}
}
}
- private void handle_streaming_item (string? uri) {
- dynamic Element src = null;
+ private void handle_streaming_item () {
+ Element src = null;
- if (uri != null) {
- // URI provided, try to create source element from it
- src = Element.make_from_uri (URIType.SRC, uri, null);
- } else {
- // No URI provided, ask for source element
- src = this.item.create_stream_source ();
- }
+ src = this.item.create_stream_source ();
if (src == null) {
this.handle_error (new HTTPRequestError.NOT_FOUND ("Not Found"));
return;
}
- // For rtspsrc since some RTSP sources takes a while to start
- // transmitting
- src.tcp_timeout = (int64) 60000000;
-
try {
if (this.transcoder != null) {
src = this.transcoder.create_source (this.item, src);
}
}
- private void handle_interactive_item (string? uri) {
- if (uri == null) {
+ private void handle_interactive_item () {
+ if (this.item.uris.size == 0) {
var error = new HTTPRequestError.NOT_FOUND (
"Requested item '%s' didn't provide a URI\n",
this.item.id);
return;
}
- this.serve_uri (uri, this.item.size);
+ this.serve_uri (this.item.uris.get (0), this.item.size);
}
private void on_item_found (GLib.Object source_object,
// Live media items need to provide a nice working implementation of this
// method if they can/do no provide a valid URI
public virtual Gst.Element? create_stream_source () {
- return null;
+ dynamic Gst.Element src = null;
+
+ if (this.uris.size != 0) {
+ src = Gst.Element.make_from_uri (
+ Gst.URIType.SRC, this.uris.get(0),null);
+ }
+ if (src != null) {
+ weak ObjectClass cls = (ObjectClass) src.get_type().class_peek();
+
+ // For rtspsrc since some RTSP sources takes a while to start
+ // transmitting
+ if (cls.find_property ("tcp-timeout") != null) {
+ src.tcp_timeout = (int64) 60000000;
+ }
+ }
+ return src;
}
internal int compare_transcoders (void *a, void *b) {