399
398
* Free-function: g_free
401
* Returns: (transfer full) (array zero-terminated=1): the location for this
402
* URI. Returns NULL if the URI isn't valid. If the URI does not contain
403
* a location, an empty string is returned.
400
* Returns: (transfer full): the location for this URI. Returns NULL if the
401
* URI isn't valid. If the URI does not contain a location, an empty
402
* string is returned.
406
405
gst_uri_get_location (const gchar * uri)
440
439
* gst_uri_construct:
441
440
* @protocol: Protocol for URI
442
* @location: (array zero-terminated=1) (transfer none): Location for URI
441
* @location: (transfer none): Location for URI
444
443
* Constructs a URI for a given valid protocol and location.
446
445
* Free-function: g_free
448
* Returns: (transfer full) (array zero-terminated=1): a new string for this
449
* URI. Returns NULL if the given URI protocol is not valid, or the given
447
* Returns: (transfer full): a new string for this URI. Returns NULL if the
448
* given URI protocol is not valid, or the given location is NULL.
453
451
gst_uri_construct (const gchar * protocol, const gchar * location)
562
558
* @type: Whether to create a source or a sink
563
559
* @uri: URI to create an element for
564
560
* @elementname: (allow-none): Name of created element, can be NULL.
561
* @error: (allow-none): address where to store error information, or NULL.
566
563
* Creates an element for handling the given URI.
571
568
gst_element_make_from_uri (const GstURIType type, const gchar * uri,
572
const gchar * elementname)
569
const gchar * elementname, GError ** error)
574
571
GList *possibilities, *walk;
576
573
GstElement *ret = NULL;
575
g_return_val_if_fail (gst_is_initialized (), NULL);
578
576
g_return_val_if_fail (GST_URI_TYPE_IS_VALID (type), NULL);
579
577
g_return_val_if_fail (gst_uri_is_valid (uri), NULL);
578
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
581
580
GST_DEBUG ("type:%d, uri:%s, elementname:%s", type, uri, elementname);
583
582
protocol = gst_uri_get_protocol (uri);
584
583
possibilities = get_element_factories_from_uri_protocol (type, protocol);
587
585
if (!possibilities) {
588
586
GST_DEBUG ("No %s for URI '%s'", type == GST_URI_SINK ? "sink" : "source",
588
/* The error message isn't great, but we don't expect applications to
589
* show that error to users, but call the missing plugins functions */
590
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
591
_("No URI handler for the %s protocol found"), protocol);
593
597
possibilities = g_list_sort (possibilities, (GCompareFunc) sort_by_rank);
594
598
walk = possibilities;
597
gst_element_factory_create (GST_ELEMENT_FACTORY_CAST (walk->data),
598
elementname)) != NULL) {
600
GstElementFactory *factory = walk->data;
601
GError *uri_err = NULL;
603
ret = gst_element_factory_create (factory, elementname);
599
605
GstURIHandler *handler = GST_URI_HANDLER (ret);
601
if (gst_uri_handler_set_uri (handler, uri, NULL))
607
if (gst_uri_handler_set_uri (handler, uri, &uri_err))
603
GST_WARNING ("element %s didn't accept the URI", GST_ELEMENT_NAME (ret));
610
GST_WARNING ("%s didn't accept URI '%s': %s", GST_OBJECT_NAME (ret), uri,
613
if (error != NULL && *error == NULL)
614
g_propagate_error (error, uri_err);
616
g_error_free (uri_err);
604
618
gst_object_unref (ret);
647
666
* Gets the list of protocols supported by @handler. This list may not be
650
* Returns: (transfer none) (array zero-terminated=1) (element-type utf8): the
651
* supported protocols. Returns NULL if the @handler isn't implemented
652
* properly, or the @handler doesn't support any protocols.
669
* Returns: (transfer none) (element-type utf8): the supported protocols.
670
* Returns NULL if the @handler isn't implemented properly, or the @handler
671
* doesn't support any protocols.
654
673
const gchar *const *
655
674
gst_uri_handler_get_protocols (GstURIHandler * handler)
743
762
if (!found_protocol) {
744
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_PROTOCOL,
763
g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
745
764
_("URI scheme '%s' not supported"), protocol);
746
765
g_free (protocol);