diff options
-rw-r--r-- | docs/libs/farsight2-libs-sections.txt | 3 | ||||
-rw-r--r-- | gst-libs/gst/farsight/fs-utils.c | 59 | ||||
-rw-r--r-- | gst-libs/gst/farsight/fs-utils.h | 3 |
3 files changed, 64 insertions, 1 deletions
diff --git a/docs/libs/farsight2-libs-sections.txt b/docs/libs/farsight2-libs-sections.txt index cd20114a..c84ec657 100644 --- a/docs/libs/farsight2-libs-sections.txt +++ b/docs/libs/farsight2-libs-sections.txt @@ -289,7 +289,8 @@ fs_rtp_header_extension_list_get_type <FILE>fs-utils</FILE> <TITLE>Utility functions</TITLE> <INCLUDE>gst/farsight/fs-utils.h</INCLUDE> +fs_utils_set_bitrate fs_utils_get_default_codec_preferences fs_utils_get_default_element_properties -fs_utils_set_bitrate +fs_utils_get_default_rtp_header_extension_preferences </SECTION> diff --git a/gst-libs/gst/farsight/fs-utils.c b/gst-libs/gst/farsight/fs-utils.c index 46f3484f..41f8b1c0 100644 --- a/gst-libs/gst/farsight/fs-utils.c +++ b/gst-libs/gst/farsight/fs-utils.c @@ -28,6 +28,8 @@ #include <string.h> +#include "fs-rtp.h" + /** * SECTION:fs-utils * @short_description: Miscellaneous useful functions @@ -208,3 +210,60 @@ fs_utils_set_bitrate (GstElement *element, glong bitrate) g_warning ("bitrate parameter of unknown type"); } } + +static GList * +load_default_rtp_hdrext_preferences_from_path (const gchar *element_name, + const gchar *path, FsMediaType media_type) +{ + GList *rtp_hdrext_prefs = NULL; + gchar *filename; + + filename = g_build_filename (path, PACKAGE, FS2_MAJORMINOR, element_name, + "default-codec-preferences", NULL); + rtp_hdrext_prefs = fs_rtp_header_extension_list_from_keyfile (filename, + media_type, NULL); + g_free (filename); + + return rtp_hdrext_prefs; +} + +/** + * fs_utils_get_default_rtp_header_extension_preferences + * @element: Element for which to fetch default RTP Header Extension preferences + * @media_type: The #FsMediaType for which to get default RTP Header Extension + * preferences + * + * These default rtp header extension preferences should work with the elements + * that are available in the main GStreamer element repositories. + * They should be suitable for standards based protocols like SIP or XMPP. + * + * Returns: The default rtp header extension preferences for this plugin, + * this #GList should be freed with fs_codec_list_destroy() + */ +GList * +fs_utils_get_default_rtp_header_extension_preferences (GstElement *element, + FsMediaType media_type) +{ + const gchar * const * system_data_dirs = g_get_system_data_dirs (); + GList *rtp_hdrext_prefs = NULL; + guint i; + const gchar *factory_name = factory_name_from_element (element); + + if (!factory_name) + return NULL; + + rtp_hdrext_prefs = load_default_rtp_hdrext_preferences_from_path ( + factory_name, g_get_user_data_dir (), media_type); + if (rtp_hdrext_prefs) + return rtp_hdrext_prefs; + + for (i = 0; system_data_dirs[i]; i++) + { + rtp_hdrext_prefs = load_default_rtp_hdrext_preferences_from_path ( + factory_name, system_data_dirs[i], media_type); + if (rtp_hdrext_prefs) + return rtp_hdrext_prefs; + } + + return NULL; +} diff --git a/gst-libs/gst/farsight/fs-utils.h b/gst-libs/gst/farsight/fs-utils.h index 3ba5f8f3..3a2ddf43 100644 --- a/gst-libs/gst/farsight/fs-utils.h +++ b/gst-libs/gst/farsight/fs-utils.h @@ -37,6 +37,9 @@ GKeyFile *fs_utils_get_default_element_properties (GstElement *element); void fs_utils_set_bitrate (GstElement *element, glong bitrate); +GList *fs_utils_get_default_rtp_header_extension_preferences ( + GstElement *element, FsMediaType media_type); + G_END_DECLS #endif /* __FS_UTILS_H__ */ |