diff --git a/ext/jpeg/gstjpeg.c b/ext/jpeg/gstjpeg.c index 9ecdd5dc24..8c83a09c1f 100644 --- a/ext/jpeg/gstjpeg.c +++ b/ext/jpeg/gstjpeg.c @@ -21,16 +21,12 @@ #endif #include +#include +#include #include #include "gstjpeg.h" -#include "gstjpegdec.h" -#include "gstjpegenc.h" -#if 0 -#include "gstsmokeenc.h" -#include "gstsmokedec.h" -#endif GType gst_idct_method_get_type (void) @@ -48,34 +44,3 @@ gst_idct_method_get_type (void) } return idct_method_type; } - -static gboolean -plugin_init (GstPlugin * plugin) -{ - - if (!gst_element_register (plugin, "jpegenc", GST_RANK_PRIMARY, - GST_TYPE_JPEGENC)) - return FALSE; - - if (!gst_element_register (plugin, "jpegdec", GST_RANK_PRIMARY, - GST_TYPE_JPEG_DEC)) - return FALSE; - -#if 0 - if (!gst_element_register (plugin, "smokeenc", GST_RANK_PRIMARY, - GST_TYPE_SMOKEENC)) - return FALSE; - - if (!gst_element_register (plugin, "smokedec", GST_RANK_PRIMARY, - GST_TYPE_SMOKEDEC)) - return FALSE; -#endif - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - jpeg, - "JPeg plugin library", - plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index c4bb732a9c..800a9f181c 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -38,8 +38,9 @@ #endif #include -#include "gstjpegdec.h" #include "gstjpeg.h" +#include "gstjpegdec.h" +#include "gstjpegelements.h" #include #include #include @@ -109,6 +110,8 @@ static gboolean gst_jpeg_dec_sink_event (GstVideoDecoder * bdec, #define gst_jpeg_dec_parent_class parent_class G_DEFINE_TYPE (GstJpegDec, gst_jpeg_dec, GST_TYPE_VIDEO_DECODER); +GST_ELEMENT_REGISTER_DEFINE (jpegdec, "jpegdec", GST_RANK_PRIMARY, + GST_TYPE_JPEG_DEC); static void gst_jpeg_dec_finalize (GObject * object) diff --git a/ext/jpeg/gstjpegelements.h b/ext/jpeg/gstjpegelements.h new file mode 100644 index 0000000000..24828eb2ad --- /dev/null +++ b/ext/jpeg/gstjpegelements.h @@ -0,0 +1,37 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * @Author: Stéphane Cerveau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef __GST_JPEG_ELEMENTS_H__ +#define __GST_JPEG_ELEMENTS_H__ + +G_BEGIN_DECLS + +GST_ELEMENT_REGISTER_DECLARE (jpegenc); +GST_ELEMENT_REGISTER_DECLARE (jpegdec); +#if 0 +GST_ELEMENT_REGISTER_DECLARE (smokeenc); +GST_ELEMENT_REGISTER_DECLARE (smokedec); +#endif + +G_END_DECLS + +#endif /* __GST_JPEG_ELEMENTS_H__ */ diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c index 5533feb00f..323d7953a0 100644 --- a/ext/jpeg/gstjpegenc.c +++ b/ext/jpeg/gstjpegenc.c @@ -37,8 +37,9 @@ #endif #include -#include "gstjpegenc.h" #include "gstjpeg.h" +#include "gstjpegenc.h" +#include "gstjpegelements.h" #include #include #include @@ -93,6 +94,8 @@ static gboolean gst_jpegenc_propose_allocation (GstVideoEncoder * encoder, #define gst_jpegenc_parent_class parent_class G_DEFINE_TYPE (GstJpegEnc, gst_jpegenc, GST_TYPE_VIDEO_ENCODER); +GST_ELEMENT_REGISTER_DEFINE (jpegenc, "jpegenc", GST_RANK_PRIMARY, + GST_TYPE_JPEGENC); /* *INDENT-OFF* */ static GstStaticPadTemplate gst_jpegenc_sink_pad_template = diff --git a/ext/jpeg/gstjpegplugin.c b/ext/jpeg/gstjpegplugin.c new file mode 100644 index 0000000000..f3a033b474 --- /dev/null +++ b/ext/jpeg/gstjpegplugin.c @@ -0,0 +1,52 @@ + +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include + +#include "gstjpegelements.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (jpegenc, plugin); + ret |= GST_ELEMENT_REGISTER (jpegdec, plugin); + +#if 0 + ret |= GST_ELEMENT_REGISTER (smokeenc, plugin); + ret |= GST_ELEMENT_REGISTER (smokedec, plugin); +#endif + + return ret; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + jpeg, + "JPeg plugin library", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/ext/jpeg/gstsmokedec.c b/ext/jpeg/gstsmokedec.c index 82b69eefad..42c57757a4 100644 --- a/ext/jpeg/gstsmokedec.c +++ b/ext/jpeg/gstsmokedec.c @@ -86,6 +86,9 @@ gst_smokedec_get_type (void) return smokedec_type; } +GST_ELEMENT_REGISTER_DEFINE (smokedec, "smokedec", GST_RANK_PRIMARY, + GST_TYPE_SMOKEDEC); + static GstStaticPadTemplate gst_smokedec_src_pad_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, diff --git a/ext/jpeg/gstsmokeenc.c b/ext/jpeg/gstsmokeenc.c index e50dfab031..fb5e0b7bf3 100644 --- a/ext/jpeg/gstsmokeenc.c +++ b/ext/jpeg/gstsmokeenc.c @@ -103,6 +103,9 @@ gst_smokeenc_get_type (void) return smokeenc_type; } +GST_ELEMENT_REGISTER_DEFINE (smokeenc, "smokeenc", GST_RANK_PRIMARY, + GST_TYPE_SMOKEENC); + static GstStaticPadTemplate gst_smokeenc_sink_pad_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, diff --git a/ext/jpeg/meson.build b/ext/jpeg/meson.build index b995c81554..35c4465e90 100644 --- a/ext/jpeg/meson.build +++ b/ext/jpeg/meson.build @@ -1,5 +1,6 @@ jpeg_sources = [ 'gstjpeg.c', + 'gstjpegplugin.c', 'gstjpegenc.c', 'gstjpegdec.c', ]