mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
ffdec: Don't use an allocated 1-entry structure for private data.
If there's only one entry, just use that entry.
This commit is contained in:
parent
bd1b315c43
commit
019a6020e4
1 changed files with 7 additions and 22 deletions
|
@ -169,13 +169,6 @@ struct _GstFFMpegDecClass
|
||||||
GstPadTemplate *srctempl, *sinktempl;
|
GstPadTemplate *srctempl, *sinktempl;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _GstFFMpegDecClassParams GstFFMpegDecClassParams;
|
|
||||||
|
|
||||||
struct _GstFFMpegDecClassParams
|
|
||||||
{
|
|
||||||
AVCodec *in_plugin;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define GST_TYPE_FFMPEGDEC \
|
#define GST_TYPE_FFMPEGDEC \
|
||||||
(gst_ffmpegdec_get_type())
|
(gst_ffmpegdec_get_type())
|
||||||
#define GST_FFMPEGDEC(obj) \
|
#define GST_FFMPEGDEC(obj) \
|
||||||
|
@ -296,26 +289,22 @@ static void
|
||||||
gst_ffmpegdec_base_init (GstFFMpegDecClass * klass)
|
gst_ffmpegdec_base_init (GstFFMpegDecClass * klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
GstFFMpegDecClassParams *params;
|
|
||||||
GstElementDetails details;
|
GstElementDetails details;
|
||||||
GstPadTemplate *sinktempl, *srctempl;
|
GstPadTemplate *sinktempl, *srctempl;
|
||||||
GstCaps *sinkcaps, *srccaps;
|
GstCaps *sinkcaps, *srccaps;
|
||||||
AVCodec *in_plugin;
|
AVCodec *in_plugin;
|
||||||
|
|
||||||
params =
|
in_plugin =
|
||||||
(GstFFMpegDecClassParams *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
|
(AVCodec *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
|
||||||
GST_FFDEC_PARAMS_QDATA);
|
GST_FFDEC_PARAMS_QDATA);
|
||||||
g_assert (params != NULL);
|
g_assert (in_plugin != NULL);
|
||||||
|
|
||||||
in_plugin = params->in_plugin;
|
|
||||||
|
|
||||||
/* construct the element details struct */
|
/* construct the element details struct */
|
||||||
details.longname = g_strdup_printf ("FFmpeg %s decoder",
|
details.longname = g_strdup_printf ("FFmpeg %s decoder",
|
||||||
params->in_plugin->long_name);
|
in_plugin->long_name);
|
||||||
details.klass = g_strdup_printf ("Codec/Decoder/%s",
|
details.klass = g_strdup_printf ("Codec/Decoder/%s",
|
||||||
(params->in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio");
|
(in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio");
|
||||||
details.description = g_strdup_printf ("FFmpeg %s decoder",
|
details.description = g_strdup_printf ("FFmpeg %s decoder", in_plugin->name);
|
||||||
params->in_plugin->name);
|
|
||||||
details.author = "Wim Taymans <wim.taymans@gmail.com>, "
|
details.author = "Wim Taymans <wim.taymans@gmail.com>, "
|
||||||
"Ronald Bultje <rbultje@ronald.bitfreak.net>, "
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>, "
|
||||||
"Edward Hervey <bilboed@bilboed.com>";
|
"Edward Hervey <bilboed@bilboed.com>";
|
||||||
|
@ -2779,7 +2768,6 @@ gst_ffmpegdec_register (GstPlugin * plugin)
|
||||||
GST_LOG ("Registering decoders");
|
GST_LOG ("Registering decoders");
|
||||||
|
|
||||||
while (in_plugin) {
|
while (in_plugin) {
|
||||||
GstFFMpegDecClassParams *params;
|
|
||||||
gchar *type_name;
|
gchar *type_name;
|
||||||
gchar *plugin_name;
|
gchar *plugin_name;
|
||||||
|
|
||||||
|
@ -2849,12 +2837,9 @@ gst_ffmpegdec_register (GstPlugin * plugin)
|
||||||
type = g_type_from_name (type_name);
|
type = g_type_from_name (type_name);
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
params = g_new0 (GstFFMpegDecClassParams, 1);
|
|
||||||
params->in_plugin = in_plugin;
|
|
||||||
|
|
||||||
/* create the gtype now */
|
/* create the gtype 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);
|
||||||
g_type_set_qdata (type, GST_FFDEC_PARAMS_QDATA, (gpointer) params);
|
g_type_set_qdata (type, GST_FFDEC_PARAMS_QDATA, (gpointer) in_plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (Ronald) MPEG-4 gets a higher priority because it has been well-
|
/* (Ronald) MPEG-4 gets a higher priority because it has been well-
|
||||||
|
|
Loading…
Reference in a new issue