application-development: interfaces: rewrite URI handler section

This commit is contained in:
Reynaldo H. Verdejo Pinochet 2017-09-07 17:35:41 -07:00
parent f10932113a
commit d97a8e58cc

View file

@ -19,28 +19,31 @@ scope and purpose of each interface.
[element-object]: application-development/basics/elements.md#using-an-element-as-a-gobject [element-object]: application-development/basics/elements.md#using-an-element-as-a-gobject
## The URI interface ## The URI Handler interface
In all examples so far, we have only supported local files through the In the examples so far, we have only showed support for local files
“filesrc” element. GStreamer, obviously, supports many more location using the “filesrc” element, but GStreamer supports many more location
sources. However, we don't want applications to need to know any sources.
particular element implementation details, such as element names for
particular network source types and so on. Therefore, there is a URI GStreamer doesn't require applications to know any `URI` specifics, like
interface, which can be used to get the source element that supports a what element to use for a particular network source types. These details
particular URI type. There is no strict rule for URI naming, but in are abstracted by the `GstURIHandler` interface.
general we follow naming conventions that others use too. For example,
assuming you have the correct plugins installed, GStreamer supports: There is no strict rule for `URI` naming, but in general, we follow
common-usage naming conventions. For example, assuming you have the
correct plugins installed, GStreamer supports:
``` ```
file:///<path>/<file> file:///<path>/<file>
http://<host>/<path>/<file> http://<host>/<path>/<file>
mms://<host>/<path>/<file> mms://<host>/<path>/<file>
dvb://<CHANNEL>
... ...
``` ```
In order to get the source or sink element supporting a particular URI, In order to get the source or sink element supporting a particular URI,
use `gst_element_make_from_uri ()`, with the URI type being either use `gst_element_make_from_uri ()` with `GST_URI_SRC` or `GST_URI_SINK`
`GST_URI_SRC` for a source element, or `GST_URI_SINK` for a sink as `GstURIType` depending in the direction you need.
element.
You can convert filenames to and from URIs using GLib's You can convert filenames to and from URIs using GLib's
`g_filename_to_uri ()` and `g_uri_to_filename ()`. `g_filename_to_uri ()` and `g_uri_to_filename ()`.