transcoder: Automatically generate enums GTypes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1840>
This commit is contained in:
Thibault Saunier 2020-11-25 22:21:35 -03:00 committed by GStreamer Merge Bot
parent 0a1dcc9546
commit 7cf6e4d8f2
4 changed files with 21 additions and 27 deletions

View file

@ -1352,27 +1352,6 @@ gst_transcoder_set_avoid_reencoding (GstTranscoder * self,
g_object_set (self->transcodebin, "avoid-reencoding", avoid_reencoding, NULL);
}
#define C_ENUM(v) ((gint) v)
#define C_FLAGS(v) ((guint) v)
GType
gst_transcoder_error_get_type (void)
{
static gsize id = 0;
static const GEnumValue values[] = {
{C_ENUM (GST_TRANSCODER_ERROR_FAILED), "GST_TRANSCODER_ERROR_FAILED",
"failed"},
{0, NULL, NULL}
};
if (g_once_init_enter (&id)) {
GType tmp = g_enum_register_static ("GstTranscoderError", values);
g_once_init_leave (&id, tmp);
}
return (GType) id;
}
/**
* gst_transcoder_error_get_name:
* @error: a #GstTranscoderError

View file

@ -8,6 +8,7 @@
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
#include "transcoder-prelude.h"
#include "transcoder-enumtypes.h"
G_BEGIN_DECLS
@ -16,7 +17,6 @@ typedef struct _GstTranscoderSignalDispatcherInterface GstTranscoderSignalDispat
/*********** Error definitions ************/
#define GST_TRANSCODER_ERROR (gst_transcoder_error_quark ())
#define GST_TYPE_TRANSCODER_ERROR (gst_transcoder_error_get_type ())
/**
* GstTranscoderError:
@ -29,8 +29,6 @@ typedef enum {
GST_TRANSCODER_API
GQuark gst_transcoder_error_quark (void);
GST_TRANSCODER_API
GType gst_transcoder_error_get_type (void);
GST_TRANSCODER_API
const gchar * gst_transcoder_error_get_name (GstTranscoderError error);
/*********** GstTranscoder definition ************/

View file

@ -3,8 +3,21 @@ headers = files(['gsttranscoder.h', 'transcoder-prelude.h'])
install_headers(headers, subdir : 'gstreamer-' + api_version + '/gst/transcoder')
transcoder_enums = gnome.mkenums_simple('transcoder-enumtypes',
sources : headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/transcoder/transcoder-prelude.h>',
decorator: 'GST_TRANSCODER_API',
install_header: true,
install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/transcoder'))
gsttranscoder_c = transcoder_enums[0]
gsttranscoder_h = transcoder_enums[1]
transcoder_gen_sources = [gsttranscoder_h]
gst_transcoder = library('gsttranscoder-' + api_version,
sources,
sources + [gsttranscoder_c] + transcoder_gen_sources,
install: true,
include_directories : [configinc, libsinc],
dependencies: [gst_dep, gstpbutils_dep],
@ -22,7 +35,7 @@ pkgconfig.generate(gst_transcoder,
if build_gir
transcoder_gir = gnome.generate_gir(gst_transcoder,
sources : sources + headers,
sources : sources + headers + [gsttranscoder_h],
nsversion : api_version,
namespace : 'GstTranscoder',
identifier_prefix : 'Gst',
@ -34,11 +47,13 @@ if build_gir
install : true,
extra_args : gir_init_section
)
transcoder_gen_sources += transcoder_gir
endif
gst_transcoder_dep = declare_dependency(link_with: gst_transcoder,
dependencies : [gst_dep, gstpbutils_dep],
include_directories : [libsinc]
include_directories : [libsinc],
sources: transcoder_gen_sources,
)
meson.override_dependency('gstreamer-transcoder-1.0', gst_transcoder_dep)

View file

@ -33,4 +33,6 @@
# endif
#endif
#include <gst/transcoder/transcoder-enumtypes.h>
#endif /* __GST_TRANSCODER_PRELUDE_H__ */