mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +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) {
|
||||
gchar *type_name;
|
||||
gchar *plugin_name;
|
||||
|
||||
/* only decoders */
|
||||
if (!av_codec_is_decoder (in_plugin)
|
||||
|
@ -910,10 +909,8 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
|
|||
}
|
||||
|
||||
/* construct the type */
|
||||
plugin_name = g_strdup ((gchar *) in_plugin->name);
|
||||
g_strdelimit (plugin_name, NULL, '_');
|
||||
type_name = g_strdup_printf ("avdec_%s", plugin_name);
|
||||
g_free (plugin_name);
|
||||
type_name = g_strdup_printf ("avdec_%s", in_plugin->name);
|
||||
g_strdelimit (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);
|
||||
AVInputFormat *in_plugin;
|
||||
gchar *p, *name;
|
||||
GstCaps *sinkcaps;
|
||||
GstPadTemplate *sinktempl, *audiosrctempl, *videosrctempl;
|
||||
gchar *longname, *description;
|
||||
gchar *longname, *description, *name;
|
||||
|
||||
in_plugin = (AVInputFormat *)
|
||||
g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_FFDEMUX_PARAMS_QDATA);
|
||||
g_assert (in_plugin != NULL);
|
||||
|
||||
p = name = g_strdup (in_plugin->name);
|
||||
while (*p) {
|
||||
if (*p == '.' || *p == ',')
|
||||
*p = '_';
|
||||
p++;
|
||||
}
|
||||
name = g_strdup (in_plugin->name);
|
||||
g_strdelimit (name, ".,|-<> ", '_');
|
||||
|
||||
/* construct the element details struct */
|
||||
longname = g_strdup_printf ("libav %s demuxer", in_plugin->long_name);
|
||||
|
@ -1961,7 +1956,6 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
|||
|
||||
while (in_plugin) {
|
||||
gchar *type_name, *typefind_name;
|
||||
gchar *p, *name = NULL;
|
||||
gint rank;
|
||||
gboolean register_typefind_func = TRUE;
|
||||
|
||||
|
@ -2082,15 +2076,9 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
|||
goto next;
|
||||
}
|
||||
|
||||
p = name = g_strdup (in_plugin->name);
|
||||
while (*p) {
|
||||
if (*p == '.' || *p == ',')
|
||||
*p = '_';
|
||||
p++;
|
||||
}
|
||||
|
||||
/* 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 (g_type_from_name (type_name)) {
|
||||
|
@ -2098,7 +2086,8 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
|||
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 */
|
||||
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_ffmpegdemux_type_find, extensions, NULL, in_plugin,
|
||||
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 (typefind_name);
|
||||
g_free (extensions);
|
||||
g_free (name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2127,7 +2115,6 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
|
|||
g_free (extensions);
|
||||
|
||||
next:
|
||||
g_free (name);
|
||||
in_plugin = av_iformat_next (in_plugin);
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
|||
AVOutputFormat *in_plugin;
|
||||
GstCaps *srccaps, *audiosinkcaps, *videosinkcaps;
|
||||
enum AVCodecID *video_ids = NULL, *audio_ids = NULL;
|
||||
gchar *longname, *description;
|
||||
gchar *longname, *description, *name;
|
||||
const char *replacement;
|
||||
gboolean is_formatter;
|
||||
|
||||
|
@ -203,6 +203,9 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
|||
GST_FFMUX_PARAMS_QDATA);
|
||||
g_assert (in_plugin != NULL);
|
||||
|
||||
name = g_strdup (in_plugin->name);
|
||||
g_strdelimit (name, ".,|-<> ", '_');
|
||||
|
||||
/* construct the element details struct */
|
||||
replacement = gst_ffmpegmux_get_replacement (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);
|
||||
|
||||
/* 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) {
|
||||
GST_DEBUG ("Couldn't get source caps for muxer '%s', skipping format",
|
||||
in_plugin->name);
|
||||
GST_DEBUG ("Couldn't get source caps for muxer '%s', skipping", name);
|
||||
goto beach;
|
||||
}
|
||||
|
||||
if (!gst_ffmpeg_formatid_get_codecids (in_plugin->name,
|
||||
&video_ids, &audio_ids, in_plugin)) {
|
||||
gst_caps_unref (srccaps);
|
||||
GST_DEBUG
|
||||
("Couldn't get sink caps for muxer '%s'. Most likely because no input format mapping exists.",
|
||||
in_plugin->name);
|
||||
GST_DEBUG ("Couldn't get sink caps for muxer '%s'. Most likely because "
|
||||
"no input format mapping exists.", name);
|
||||
goto beach;
|
||||
}
|
||||
|
||||
|
@ -283,6 +284,8 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
|||
|
||||
beach:
|
||||
klass->in_plugin = in_plugin;
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -909,7 +912,6 @@ gst_ffmpegmux_register (GstPlugin * plugin)
|
|||
|
||||
while (in_plugin) {
|
||||
gchar *type_name;
|
||||
gchar *p;
|
||||
GstRank rank = GST_RANK_MARGINAL;
|
||||
|
||||
if ((!strncmp (in_plugin->name, "u16", 3)) ||
|
||||
|
@ -961,16 +963,7 @@ gst_ffmpegmux_register (GstPlugin * plugin)
|
|||
|
||||
/* construct the type */
|
||||
type_name = g_strdup_printf ("avmux_%s", in_plugin->name);
|
||||
|
||||
p = type_name;
|
||||
|
||||
while (*p) {
|
||||
if (*p == '.')
|
||||
*p = '_';
|
||||
if (*p == ',')
|
||||
*p = '_';
|
||||
p++;
|
||||
}
|
||||
g_strdelimit (type_name, ".,|-<> ", '_');
|
||||
|
||||
type = g_type_from_name (type_name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue