jpeg: allow per feature registration

Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
This commit is contained in:
Stéphane Cerveau 2021-02-12 10:09:46 +01:00
parent a633f4b12e
commit 13a4c15b99
8 changed files with 106 additions and 39 deletions

View file

@ -21,16 +21,12 @@
#endif
#include <string.h>
#include <stdio.h>
#include <jpeglib.h>
#include <gst/gst.h>
#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)

View file

@ -38,8 +38,9 @@
#endif
#include <string.h>
#include "gstjpegdec.h"
#include "gstjpeg.h"
#include "gstjpegdec.h"
#include "gstjpegelements.h"
#include <gst/video/video.h>
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
@ -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)

View file

@ -0,0 +1,37 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Stéphane Cerveau <scerveau@collabora.com>
*
* 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__ */

View file

@ -37,8 +37,9 @@
#endif
#include <string.h>
#include "gstjpegenc.h"
#include "gstjpeg.h"
#include "gstjpegenc.h"
#include "gstjpegelements.h"
#include <gst/video/video.h>
#include <gst/video/gstvideometa.h>
#include <gst/base/base.h>
@ -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 =

52
ext/jpeg/gstjpegplugin.c Normal file
View file

@ -0,0 +1,52 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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 <config.h>
#endif
#include <string.h>
#include <stdio.h>
#include <jpeglib.h>
#include <gst/gst.h>
#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)

View file

@ -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,

View file

@ -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,

View file

@ -1,5 +1,6 @@
jpeg_sources = [
'gstjpeg.c',
'gstjpegplugin.c',
'gstjpegenc.c',
'gstjpegdec.c',
]