av_codec_next (deprecated) -> av_codec_iterate

https://bugzilla.gnome.org/show_bug.cgi?id=792900
This commit is contained in:
Mathieu Duponchelle 2018-06-29 21:20:36 +02:00
parent 37b58e0753
commit e4bf6147a0
4 changed files with 36 additions and 50 deletions

View file

@ -861,19 +861,18 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
};
GType type;
AVCodec *in_plugin;
void *i = 0;
gint rank;
in_plugin = av_codec_next (NULL);
GST_LOG ("Registering decoders");
while (in_plugin) {
while ((in_plugin = (AVCodec *) av_codec_iterate (&i))) {
gchar *type_name;
/* only decoders */
if (!av_codec_is_decoder (in_plugin)
|| in_plugin->type != AVMEDIA_TYPE_AUDIO) {
goto next;
continue;
}
/* no quasi codecs, please */
@ -888,7 +887,7 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
#else
in_plugin->id <= AV_CODEC_ID_PCM_S16BE_PLANAR)) {
#endif
goto next;
continue;
}
/* No decoders depending on external libraries (we don't build them, but
@ -898,7 +897,7 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
GST_DEBUG
("Not using external library decoder %s. Use the gstreamer-native ones instead.",
in_plugin->name);
goto next;
continue;
}
GST_DEBUG ("Trying plugin %s [%s]", in_plugin->name, in_plugin->long_name);
@ -919,7 +918,7 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
!strcmp (in_plugin->name, "dvdsub") ||
!strcmp (in_plugin->name, "dvbsub")) {
GST_LOG ("Ignoring decoder %s", in_plugin->name);
goto next;
continue;
}
/* construct the type */
@ -963,9 +962,6 @@ gst_ffmpegauddec_register (GstPlugin * plugin)
}
g_free (type_name);
next:
in_plugin = av_codec_next (in_plugin);
}
GST_LOG ("Finished Registering decoders");

View file

@ -772,18 +772,18 @@ gst_ffmpegaudenc_register (GstPlugin * plugin)
};
GType type;
AVCodec *in_plugin;
void *i = 0;
GST_LOG ("Registering encoders");
in_plugin = av_codec_next (NULL);
while (in_plugin) {
while ((in_plugin = (AVCodec *) av_codec_iterate (&i))) {
gchar *type_name;
guint rank;
/* Skip non-AV codecs */
if (in_plugin->type != AVMEDIA_TYPE_AUDIO)
goto next;
continue;
/* no quasi codecs, please */
if (in_plugin->id == AV_CODEC_ID_PCM_S16LE_PLANAR ||
@ -797,7 +797,7 @@ gst_ffmpegaudenc_register (GstPlugin * plugin)
#else
in_plugin->id <= AV_CODEC_ID_PCM_S16BE_PLANAR)) {
#endif
goto next;
continue;
}
/* No encoders depending on external libraries (we don't build them, but
@ -807,12 +807,12 @@ gst_ffmpegaudenc_register (GstPlugin * plugin)
GST_DEBUG
("Not using external library encoder %s. Use the gstreamer-native ones instead.",
in_plugin->name);
goto next;
continue;
}
/* only encoders */
if (!av_codec_is_encoder (in_plugin)) {
goto next;
continue;
}
/* FIXME : We should have a method to know cheaply whether we have a mapping
@ -824,7 +824,7 @@ gst_ffmpegaudenc_register (GstPlugin * plugin)
if (!strcmp (in_plugin->name, "vorbis")
|| !strcmp (in_plugin->name, "flac")) {
GST_LOG ("Ignoring encoder %s", in_plugin->name);
goto next;
continue;
}
/* construct the type */
@ -866,9 +866,6 @@ gst_ffmpegaudenc_register (GstPlugin * plugin)
}
g_free (type_name);
next:
in_plugin = av_codec_next (in_plugin);
}
GST_LOG ("Finished registering encoders");

View file

@ -2231,19 +2231,18 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
GType type;
AVCodec *in_plugin;
gint rank;
in_plugin = av_codec_next (NULL);
void *i = 0;
GST_LOG ("Registering decoders");
while (in_plugin) {
while ((in_plugin = (AVCodec *) av_codec_iterate (&i))) {
gchar *type_name;
gchar *plugin_name;
/* only video decoders */
if (!av_codec_is_decoder (in_plugin)
|| in_plugin->type != AVMEDIA_TYPE_VIDEO)
goto next;
continue;
/* no quasi codecs, please */
if (in_plugin->id == AV_CODEC_ID_RAWVIDEO ||
@ -2262,7 +2261,7 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
|| in_plugin->id == AV_CODEC_ID_WRAPPED_AVFRAME
#endif
|| in_plugin->id == AV_CODEC_ID_ZLIB) {
goto next;
continue;
}
/* No decoders depending on external libraries (we don't build them, but
@ -2272,7 +2271,7 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
GST_DEBUG
("Not using external library decoder %s. Use the gstreamer-native ones instead.",
in_plugin->name);
goto next;
continue;
}
/* No vdpau plugins until we can figure out how to properly use them
@ -2281,42 +2280,42 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
GST_DEBUG
("Ignoring VDPAU decoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (g_str_has_suffix (in_plugin->name, "_xvmc")) {
GST_DEBUG
("Ignoring XVMC decoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (strstr (in_plugin->name, "vaapi")) {
GST_DEBUG
("Ignoring VAAPI decoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (g_str_has_suffix (in_plugin->name, "_qsv")) {
GST_DEBUG
("Ignoring qsv decoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (g_str_has_suffix (in_plugin->name, "_cuvid")) {
GST_DEBUG
("Ignoring CUVID decoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (g_str_has_suffix (in_plugin->name, "_v4l2m2m")) {
GST_DEBUG
("Ignoring V4L2 mem-to-mem decoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
GST_DEBUG ("Trying plugin %s [%s]", in_plugin->name, in_plugin->long_name);
@ -2335,7 +2334,7 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
!strcmp (in_plugin->name, "dvdsub") ||
!strcmp (in_plugin->name, "dvbsub")) {
GST_LOG ("Ignoring decoder %s", in_plugin->name);
goto next;
continue;
}
/* construct the type */
@ -2393,9 +2392,6 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
}
g_free (type_name);
next:
in_plugin = av_codec_next (in_plugin);
}
GST_LOG ("Finished Registering decoders");

View file

@ -837,6 +837,7 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
};
GType type;
AVCodec *in_plugin;
void *i = 0;
GST_LOG ("Registering encoders");
@ -844,13 +845,12 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
/* build global ffmpeg param/property info */
gst_ffmpeg_cfg_init ();
in_plugin = av_codec_next (NULL);
while (in_plugin) {
while ((in_plugin = (AVCodec *) av_codec_iterate (&i))) {
gchar *type_name;
/* Skip non-AV codecs */
if (in_plugin->type != AVMEDIA_TYPE_VIDEO)
goto next;
continue;
/* no quasi codecs, please */
if (in_plugin->id == AV_CODEC_ID_RAWVIDEO ||
@ -869,7 +869,7 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
|| in_plugin->id == AV_CODEC_ID_WRAPPED_AVFRAME
#endif
|| in_plugin->id == AV_CODEC_ID_ZLIB) {
goto next;
continue;
}
/* No encoders depending on external libraries (we don't build them, but
@ -879,41 +879,41 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
GST_DEBUG
("Not using external library encoder %s. Use the gstreamer-native ones instead.",
in_plugin->name);
goto next;
continue;
}
if (strstr (in_plugin->name, "vaapi")) {
GST_DEBUG
("Ignoring VAAPI encoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (strstr (in_plugin->name, "nvenc")) {
GST_DEBUG
("Ignoring nvenc encoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (g_str_has_suffix (in_plugin->name, "_qsv")) {
GST_DEBUG
("Ignoring qsv encoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
if (g_str_has_suffix (in_plugin->name, "_v4l2m2m")) {
GST_DEBUG
("Ignoring V4L2 mem-to-mem encoder %s. We can't handle this outside of ffmpeg",
in_plugin->name);
goto next;
continue;
}
/* only video encoders */
if (!av_codec_is_encoder (in_plugin)
|| in_plugin->type != AVMEDIA_TYPE_VIDEO)
goto next;
continue;
/* FIXME : We should have a method to know cheaply whether we have a mapping
* for the given plugin or not */
@ -923,7 +923,7 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
/* no codecs for which we're GUARANTEED to have better alternatives */
if (!strcmp (in_plugin->name, "gif")) {
GST_LOG ("Ignoring encoder %s", in_plugin->name);
goto next;
continue;
}
/* construct the type */
@ -955,9 +955,6 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
}
g_free (type_name);
next:
in_plugin = av_codec_next (in_plugin);
}
GST_LOG ("Finished registering encoders");