mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
discoverer: Add APIs to simply get installer details for missing plugins
Currently the API is far from optimal and the user has to work around our badly defined API to simply install missing plugins. API: new: gst_discoverer_info_get_missing_elements_installer_details deprecated: gst_discoverer_info_get_misc gst_discoverer_stream_info_get_misc https://bugzilla.gnome.org/show_bug.cgi?id=720596
This commit is contained in:
parent
310f486422
commit
622007e7db
6 changed files with 61 additions and 6 deletions
|
@ -2761,6 +2761,7 @@ gst_discoverer_stream_info_ref
|
|||
gst_discoverer_stream_info_unref
|
||||
gst_discoverer_stream_info_list_free
|
||||
gst_discoverer_stream_info_get_stream_type_nick
|
||||
gst_discoverer_info_get_missing_elements_installer_details
|
||||
gst_discoverer_info_get_audio_streams
|
||||
gst_discoverer_info_get_container_streams
|
||||
gst_discoverer_info_get_streams
|
||||
|
|
|
@ -353,7 +353,7 @@ G_DEFINE_TYPE (GstDiscovererInfo, gst_discoverer_info, G_TYPE_OBJECT);
|
|||
static void
|
||||
gst_discoverer_info_init (GstDiscovererInfo * info)
|
||||
{
|
||||
/* Nothing needs initialization */
|
||||
info->missing_elements_details = g_ptr_array_new_with_free_func (g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -375,6 +375,8 @@ gst_discoverer_info_finalize (GObject * object)
|
|||
|
||||
if (info->toc)
|
||||
gst_toc_unref (info->toc);
|
||||
|
||||
g_ptr_array_unref (info->missing_elements_details);
|
||||
}
|
||||
|
||||
static GstDiscovererInfo *
|
||||
|
@ -687,6 +689,9 @@ gst_discoverer_stream_info_get_stream_id (GstDiscovererStreamInfo * info)
|
|||
* gst_discoverer_stream_info_get_misc:
|
||||
* @info: a #GstDiscovererStreamInfo
|
||||
*
|
||||
* Deprecated: This functions is deprecated since version 1.4, use
|
||||
* gst_discoverer_stream_get_missing_elements_installer_details
|
||||
*
|
||||
* Returns: (transfer none): additional information regarding the stream (for
|
||||
* example codec version, profile, etc..). If you wish to use the #GstStructure
|
||||
* after the life-time of @info you will need to copy it.
|
||||
|
@ -1010,6 +1015,9 @@ DISCOVERER_INFO_ACCESSOR_CODE (seekable, gboolean, FALSE);
|
|||
* gst_discoverer_info_get_misc:
|
||||
* @info: a #GstDiscovererInfo
|
||||
*
|
||||
* Deprecated: This functions is deprecated since version 1.4, use
|
||||
* gst_discoverer_info_get_missing_elements_installer_details
|
||||
*
|
||||
* Returns: (transfer none): Miscellaneous information stored as a #GstStructure
|
||||
* (for example: information about missing plugins). If you wish to use the
|
||||
* #GstStructure after the life-time of @info, you will need to copy it.
|
||||
|
@ -1068,3 +1076,38 @@ DISCOVERER_INFO_ACCESSOR_CODE (toc, const GstToc *, NULL);
|
|||
*
|
||||
* Decrements the reference count of @info.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* gst_discoverer_info_get_missing_elements_installer_details:
|
||||
* @info: a #GstDiscovererStreamInfo to retrieve installer detail
|
||||
* for the missing element
|
||||
*
|
||||
* Get the installer details for missing elements
|
||||
*
|
||||
* Returns: (transfer full): (array zero-terminated=1): An array of strings
|
||||
* containing informations about how to install the various missing elements
|
||||
* for @info to be usable. Free with g_strfreev.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
const gchar **
|
||||
gst_discoverer_info_get_missing_elements_installer_details (const
|
||||
GstDiscovererInfo * info)
|
||||
{
|
||||
|
||||
if (info->result != GST_DISCOVERER_MISSING_PLUGINS) {
|
||||
GST_WARNING_OBJECT (info, "Trying to get missing element installed details "
|
||||
"but result is not 'MISSING_PLUGINS'");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (info->missing_elements_details->pdata[info->missing_elements_details->
|
||||
len]) {
|
||||
GST_DEBUG ("Adding NULL pointer to the end of missing_elements_details");
|
||||
g_ptr_array_add (info->missing_elements_details, NULL);
|
||||
}
|
||||
|
||||
return (const gchar **) info->missing_elements_details->pdata;
|
||||
}
|
||||
|
|
|
@ -1383,9 +1383,13 @@ handle_message (GstDiscoverer * dc, GstMessage * msg)
|
|||
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg),
|
||||
"Setting result to MISSING_PLUGINS");
|
||||
dc->priv->current_info->result = GST_DISCOVERER_MISSING_PLUGINS;
|
||||
/* FIXME 2.0 Remove completely the ->misc
|
||||
* Keep the old behaviour for now.
|
||||
*/
|
||||
if (dc->priv->current_info->misc)
|
||||
gst_structure_free (dc->priv->current_info->misc);
|
||||
dc->priv->current_info->misc = gst_structure_copy (structure);
|
||||
g_ptr_array_add (dc->priv->current_info->missing_elements_details,
|
||||
gst_missing_plugin_message_get_installer_detail (msg));
|
||||
} else if (sttype == _STREAM_TOPOLOGY_QUARK) {
|
||||
if (dc->priv->current_topology)
|
||||
gst_structure_free (dc->priv->current_topology);
|
||||
|
|
|
@ -204,6 +204,7 @@ gboolean gst_discoverer_info_get_seekable(const GstDiscovererIn
|
|||
const GstStructure* gst_discoverer_info_get_misc(const GstDiscovererInfo* info);
|
||||
const GstTagList* gst_discoverer_info_get_tags(const GstDiscovererInfo* info);
|
||||
const GstToc* gst_discoverer_info_get_toc(const GstDiscovererInfo* info);
|
||||
const gchar** gst_discoverer_info_get_missing_elements_installer_details(const GstDiscovererInfo* info);
|
||||
|
||||
GList * gst_discoverer_info_get_streams (GstDiscovererInfo *info,
|
||||
GType streamtype);
|
||||
|
|
|
@ -100,6 +100,7 @@ struct _GstDiscovererInfo {
|
|||
GstTagList *tags;
|
||||
GstToc *toc;
|
||||
gboolean seekable;
|
||||
GPtrArray *missing_elements_details;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
|
|
@ -409,10 +409,15 @@ print_info (GstDiscovererInfo * info, GError * err)
|
|||
{
|
||||
g_print ("Missing plugins\n");
|
||||
if (verbose) {
|
||||
gchar *tmp =
|
||||
gst_structure_to_string (gst_discoverer_info_get_misc (info));
|
||||
g_print (" (%s)\n", tmp);
|
||||
g_free (tmp);
|
||||
gint i = 0;
|
||||
const gchar **installer_details =
|
||||
gst_discoverer_info_get_missing_elements_installer_details (info);
|
||||
|
||||
while (installer_details[i]) {
|
||||
g_print (" (%s)\n", installer_details[i]);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue