mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
av: canonicalise av plugin name more consistently in more places
Use g_strdelimit(), make sure to include comma as well, which isn't included in G_STR_DELIMITERS. https://bugzilla.gnome.org/show_bug.cgi?id=734451
This commit is contained in:
parent
dbb6beba92
commit
83ce87e7c8
3 changed files with 21 additions and 44 deletions
|
@ -864,7 +864,6 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
|
||||||
|
|
||||||
while (in_plugin) {
|
while (in_plugin) {
|
||||||
gchar *type_name;
|
gchar *type_name;
|
||||||
gchar *plugin_name;
|
|
||||||
|
|
||||||
/* only decoders */
|
/* only decoders */
|
||||||
if (!av_codec_is_decoder (in_plugin)
|
if (!av_codec_is_decoder (in_plugin)
|
||||||
|
@ -910,10 +909,8 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct the type */
|
/* construct the type */
|
||||||
plugin_name = g_strdup ((gchar *) in_plugin->name);
|
type_name = g_strdup_printf ("avdec_%s", in_plugin->name);
|
||||||
g_strdelimit (plugin_name, NULL, '_');
|
g_strdelimit (type_name, ".,|-<> ", '_');
|
||||||
type_name = g_strdup_printf ("avdec_%s", plugin_name);
|
|
||||||
g_free (plugin_name);
|
|
||||||
|
|
||||||
type = g_type_from_name (type_name);
|
type = g_type_from_name (type_name);
|
||||||
|
|
||||||
|
|
|
@ -181,21 +181,16 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass * klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
AVInputFormat *in_plugin;
|
AVInputFormat *in_plugin;
|
||||||
gchar *p, *name;
|
|
||||||
GstCaps *sinkcaps;
|
GstCaps *sinkcaps;
|
||||||
GstPadTemplate *sinktempl, *audiosrctempl, *videosrctempl;
|
GstPadTemplate *sinktempl, *audiosrctempl, *videosrctempl;
|
||||||
gchar *longname, *description;
|
gchar *longname, *description, *name;
|
||||||
|
|
||||||
in_plugin = (AVInputFormat *)
|
in_plugin = (AVInputFormat *)
|
||||||
g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_FFDEMUX_PARAMS_QDATA);
|
g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_FFDEMUX_PARAMS_QDATA);
|
||||||
g_assert (in_plugin != NULL);
|
g_assert (in_plugin != NULL);
|
||||||
|
|
||||||
p = name = g_strdup (in_plugin->name);
|
name = g_strdup (in_plugin->name);
|
||||||
while (*p) {
|
g_strdelimit (name, ".,|-<> ", '_');
|
||||||
if (*p == '.' || *p == ',')
|
|
||||||
*p = '_';
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* construct the element details struct */
|
/* construct the element details struct */
|
||||||
longname = g_strdup_printf ("libav %s demuxer", in_plugin->long_name);
|
longname = g_strdup_printf ("libav %s demuxer", in_plugin->long_name);
|
||||||
|
@ -1961,7 +1956,6 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
||||||
|
|
||||||
while (in_plugin) {
|
while (in_plugin) {
|
||||||
gchar *type_name, *typefind_name;
|
gchar *type_name, *typefind_name;
|
||||||
gchar *p, *name = NULL;
|
|
||||||
gint rank;
|
gint rank;
|
||||||
gboolean register_typefind_func = TRUE;
|
gboolean register_typefind_func = TRUE;
|
||||||
|
|
||||||
|
@ -2082,15 +2076,9 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = name = g_strdup (in_plugin->name);
|
|
||||||
while (*p) {
|
|
||||||
if (*p == '.' || *p == ',')
|
|
||||||
*p = '_';
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* construct the type */
|
/* construct the type */
|
||||||
type_name = g_strdup_printf ("avdemux_%s", name);
|
type_name = g_strdup_printf ("avdemux_%s", in_plugin->name);
|
||||||
|
g_strdelimit (type_name, ".,|-<> ", '_');
|
||||||
|
|
||||||
/* if it's already registered, drop it */
|
/* if it's already registered, drop it */
|
||||||
if (g_type_from_name (type_name)) {
|
if (g_type_from_name (type_name)) {
|
||||||
|
@ -2098,7 +2086,8 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
typefind_name = g_strdup_printf ("avtype_%s", name);
|
typefind_name = g_strdup_printf ("avtype_%s", in_plugin->name);
|
||||||
|
g_strdelimit (typefind_name, ".,|-<> ", '_');
|
||||||
|
|
||||||
/* create the type now */
|
/* create the type now */
|
||||||
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
||||||
|
@ -2114,11 +2103,10 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
||||||
!gst_type_find_register (plugin, typefind_name, rank,
|
!gst_type_find_register (plugin, typefind_name, rank,
|
||||||
gst_ffmpegdemux_type_find, extensions, NULL, in_plugin,
|
gst_ffmpegdemux_type_find, extensions, NULL, in_plugin,
|
||||||
NULL))) {
|
NULL))) {
|
||||||
g_warning ("Register of type avdemux_%s failed", name);
|
g_warning ("Registration of type %s failed", type_name);
|
||||||
g_free (type_name);
|
g_free (type_name);
|
||||||
g_free (typefind_name);
|
g_free (typefind_name);
|
||||||
g_free (extensions);
|
g_free (extensions);
|
||||||
g_free (name);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2127,7 +2115,6 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
||||||
g_free (extensions);
|
g_free (extensions);
|
||||||
|
|
||||||
next:
|
next:
|
||||||
g_free (name);
|
|
||||||
in_plugin = av_iformat_next (in_plugin);
|
in_plugin = av_iformat_next (in_plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
||||||
AVOutputFormat *in_plugin;
|
AVOutputFormat *in_plugin;
|
||||||
GstCaps *srccaps, *audiosinkcaps, *videosinkcaps;
|
GstCaps *srccaps, *audiosinkcaps, *videosinkcaps;
|
||||||
enum AVCodecID *video_ids = NULL, *audio_ids = NULL;
|
enum AVCodecID *video_ids = NULL, *audio_ids = NULL;
|
||||||
gchar *longname, *description;
|
gchar *longname, *description, *name;
|
||||||
const char *replacement;
|
const char *replacement;
|
||||||
gboolean is_formatter;
|
gboolean is_formatter;
|
||||||
|
|
||||||
|
@ -203,6 +203,9 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
||||||
GST_FFMUX_PARAMS_QDATA);
|
GST_FFMUX_PARAMS_QDATA);
|
||||||
g_assert (in_plugin != NULL);
|
g_assert (in_plugin != NULL);
|
||||||
|
|
||||||
|
name = g_strdup (in_plugin->name);
|
||||||
|
g_strdelimit (name, ".,|-<> ", '_');
|
||||||
|
|
||||||
/* construct the element details struct */
|
/* construct the element details struct */
|
||||||
replacement = gst_ffmpegmux_get_replacement (in_plugin->name);
|
replacement = gst_ffmpegmux_get_replacement (in_plugin->name);
|
||||||
is_formatter = gst_ffmpegmux_is_formatter (in_plugin->name);
|
is_formatter = gst_ffmpegmux_is_formatter (in_plugin->name);
|
||||||
|
@ -229,19 +232,17 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
||||||
g_free (description);
|
g_free (description);
|
||||||
|
|
||||||
/* Try to find the caps that belongs here */
|
/* Try to find the caps that belongs here */
|
||||||
srccaps = gst_ffmpeg_formatid_to_caps (in_plugin->name);
|
srccaps = gst_ffmpeg_formatid_to_caps (name);
|
||||||
if (!srccaps) {
|
if (!srccaps) {
|
||||||
GST_DEBUG ("Couldn't get source caps for muxer '%s', skipping format",
|
GST_DEBUG ("Couldn't get source caps for muxer '%s', skipping", name);
|
||||||
in_plugin->name);
|
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_ffmpeg_formatid_get_codecids (in_plugin->name,
|
if (!gst_ffmpeg_formatid_get_codecids (in_plugin->name,
|
||||||
&video_ids, &audio_ids, in_plugin)) {
|
&video_ids, &audio_ids, in_plugin)) {
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
GST_DEBUG
|
GST_DEBUG ("Couldn't get sink caps for muxer '%s'. Most likely because "
|
||||||
("Couldn't get sink caps for muxer '%s'. Most likely because no input format mapping exists.",
|
"no input format mapping exists.", name);
|
||||||
in_plugin->name);
|
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,6 +284,8 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
||||||
|
|
||||||
beach:
|
beach:
|
||||||
klass->in_plugin = in_plugin;
|
klass->in_plugin = in_plugin;
|
||||||
|
|
||||||
|
g_free (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -909,7 +912,6 @@ gst_ffmpegmux_register (GstPlugin * plugin)
|
||||||
|
|
||||||
while (in_plugin) {
|
while (in_plugin) {
|
||||||
gchar *type_name;
|
gchar *type_name;
|
||||||
gchar *p;
|
|
||||||
GstRank rank = GST_RANK_MARGINAL;
|
GstRank rank = GST_RANK_MARGINAL;
|
||||||
|
|
||||||
if ((!strncmp (in_plugin->name, "u16", 3)) ||
|
if ((!strncmp (in_plugin->name, "u16", 3)) ||
|
||||||
|
@ -961,16 +963,7 @@ gst_ffmpegmux_register (GstPlugin * plugin)
|
||||||
|
|
||||||
/* construct the type */
|
/* construct the type */
|
||||||
type_name = g_strdup_printf ("avmux_%s", in_plugin->name);
|
type_name = g_strdup_printf ("avmux_%s", in_plugin->name);
|
||||||
|
g_strdelimit (type_name, ".,|-<> ", '_');
|
||||||
p = type_name;
|
|
||||||
|
|
||||||
while (*p) {
|
|
||||||
if (*p == '.')
|
|
||||||
*p = '_';
|
|
||||||
if (*p == ',')
|
|
||||||
*p = '_';
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
type = g_type_from_name (type_name);
|
type = g_type_from_name (type_name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue