mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 17:48:26 +00:00
androidmedia: Properly set subclasses metadata/pad templates in base_init
This commit is contained in:
parent
303a2eaec4
commit
75493a7731
2 changed files with 124 additions and 55 deletions
|
@ -69,13 +69,41 @@ enum
|
||||||
|
|
||||||
/* class initialization */
|
/* class initialization */
|
||||||
|
|
||||||
#define DEBUG_INIT \
|
static void gst_amc_audio_dec_class_init (GstAmcAudioDecClass * klass);
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_amc_audio_dec_debug_category, "amcaudiodec", 0, \
|
static void gst_amc_audio_dec_init (GstAmcAudioDec * self);
|
||||||
"Android MediaCodec audio decoder");
|
static void gst_amc_audio_dec_base_init (gpointer g_class);
|
||||||
#define parent_class gst_amc_audio_dec_parent_class
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstAmcAudioDec, gst_amc_audio_dec,
|
static GstAudioDecoderClass *parent_class = NULL;
|
||||||
GST_TYPE_AUDIO_DECODER, DEBUG_INIT);
|
|
||||||
|
GType
|
||||||
|
gst_amc_audio_dec_get_type (void)
|
||||||
|
{
|
||||||
|
static volatile gsize type = 0;
|
||||||
|
|
||||||
|
if (g_once_init_enter (&type)) {
|
||||||
|
GType _type;
|
||||||
|
static const GTypeInfo info = {
|
||||||
|
sizeof (GstAmcAudioDecClass),
|
||||||
|
gst_amc_audio_dec_base_init,
|
||||||
|
NULL,
|
||||||
|
(GClassInitFunc) gst_amc_audio_dec_class_init,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
sizeof (GstAmcAudioDec),
|
||||||
|
0,
|
||||||
|
(GInstanceInitFunc) gst_amc_audio_dec_init,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
_type = g_type_register_static (GST_TYPE_AUDIO_DECODER, "GstAmcAudioDec",
|
||||||
|
&info, 0);
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (gst_amc_audio_dec_debug_category, "amcaudiodec", 0, "Android MediaCodec audio decoder");
|
||||||
|
|
||||||
|
g_once_init_leave (&type, _type);
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
create_sink_caps (const GstAmcCodecInfo * codec_info)
|
create_sink_caps (const GstAmcCodecInfo * codec_info)
|
||||||
|
@ -265,33 +293,17 @@ create_src_caps (const GstAmcCodecInfo * codec_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_amc_audio_dec_class_init (GstAmcAudioDecClass * klass)
|
gst_amc_audio_dec_base_init (gpointer g_class)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstAmcAudioDecClass *amcaudiodec_class = GST_AMC_AUDIO_DEC_CLASS (g_class);
|
||||||
GstAudioDecoderClass *audiodec_class = GST_AUDIO_DECODER_CLASS (klass);
|
|
||||||
GstAmcAudioDecClass *amcaudiodec_class = GST_AMC_AUDIO_DEC_CLASS (klass);
|
|
||||||
const GstAmcCodecInfo *codec_info;
|
const GstAmcCodecInfo *codec_info;
|
||||||
GstPadTemplate *templ;
|
GstPadTemplate *templ;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gchar *longname;
|
gchar *longname;
|
||||||
|
|
||||||
gobject_class->finalize = gst_amc_audio_dec_finalize;
|
|
||||||
|
|
||||||
element_class->change_state =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_amc_audio_dec_change_state);
|
|
||||||
|
|
||||||
audiodec_class->start = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_start);
|
|
||||||
audiodec_class->stop = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_stop);
|
|
||||||
audiodec_class->open = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_open);
|
|
||||||
audiodec_class->close = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_close);
|
|
||||||
audiodec_class->flush = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_flush);
|
|
||||||
audiodec_class->set_format = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_set_format);
|
|
||||||
audiodec_class->handle_frame =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_amc_audio_dec_handle_frame);
|
|
||||||
|
|
||||||
codec_info =
|
codec_info =
|
||||||
g_type_get_qdata (G_TYPE_FROM_CLASS (klass), gst_amc_codec_info_quark);
|
g_type_get_qdata (G_TYPE_FROM_CLASS (g_class), gst_amc_codec_info_quark);
|
||||||
/* This happens for the base class and abstract subclasses */
|
/* This happens for the base class and abstract subclasses */
|
||||||
if (!codec_info)
|
if (!codec_info)
|
||||||
return;
|
return;
|
||||||
|
@ -317,6 +329,28 @@ gst_amc_audio_dec_class_init (GstAmcAudioDecClass * klass)
|
||||||
g_free (longname);
|
g_free (longname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_amc_audio_dec_class_init (GstAmcAudioDecClass * klass)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
GstAudioDecoderClass *audiodec_class = GST_AUDIO_DECODER_CLASS (klass);
|
||||||
|
|
||||||
|
gobject_class->finalize = gst_amc_audio_dec_finalize;
|
||||||
|
|
||||||
|
element_class->change_state =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_amc_audio_dec_change_state);
|
||||||
|
|
||||||
|
audiodec_class->start = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_start);
|
||||||
|
audiodec_class->stop = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_stop);
|
||||||
|
audiodec_class->open = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_open);
|
||||||
|
audiodec_class->close = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_close);
|
||||||
|
audiodec_class->flush = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_flush);
|
||||||
|
audiodec_class->set_format = GST_DEBUG_FUNCPTR (gst_amc_audio_dec_set_format);
|
||||||
|
audiodec_class->handle_frame =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_amc_audio_dec_handle_frame);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_amc_audio_dec_init (GstAmcAudioDec * self)
|
gst_amc_audio_dec_init (GstAmcAudioDec * self)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,12 +97,41 @@ enum
|
||||||
|
|
||||||
/* class initialization */
|
/* class initialization */
|
||||||
|
|
||||||
#define DEBUG_INIT \
|
static void gst_amc_video_dec_class_init (GstAmcVideoDecClass * klass);
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_amc_video_dec_debug_category, "amcvideodec", 0, \
|
static void gst_amc_video_dec_init (GstAmcVideoDec * self);
|
||||||
"Android MediaCodec video decoder");
|
static void gst_amc_video_dec_base_init (gpointer g_class);
|
||||||
#define parent_class gst_amc_video_dec_parent_class
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstAmcVideoDec, gst_amc_video_dec,
|
static GstVideoDecoderClass *parent_class = NULL;
|
||||||
GST_TYPE_VIDEO_DECODER, DEBUG_INIT);
|
|
||||||
|
GType
|
||||||
|
gst_amc_video_dec_get_type (void)
|
||||||
|
{
|
||||||
|
static volatile gsize type = 0;
|
||||||
|
|
||||||
|
if (g_once_init_enter (&type)) {
|
||||||
|
GType _type;
|
||||||
|
static const GTypeInfo info = {
|
||||||
|
sizeof (GstAmcVideoDecClass),
|
||||||
|
gst_amc_video_dec_base_init,
|
||||||
|
NULL,
|
||||||
|
(GClassInitFunc) gst_amc_video_dec_class_init,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
sizeof (GstAmcVideoDec),
|
||||||
|
0,
|
||||||
|
(GInstanceInitFunc) gst_amc_video_dec_init,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
_type = g_type_register_static (GST_TYPE_VIDEO_DECODER, "GstAmcVideoDec",
|
||||||
|
&info, 0);
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (gst_amc_video_dec_debug_category, "amcvideodec", 0, "Android MediaCodec video decoder");
|
||||||
|
|
||||||
|
g_once_init_leave (&type, _type);
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
create_sink_caps (const GstAmcCodecInfo * codec_info)
|
create_sink_caps (const GstAmcCodecInfo * codec_info)
|
||||||
|
@ -394,36 +423,17 @@ create_src_caps (const GstAmcCodecInfo * codec_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_amc_video_dec_class_init (GstAmcVideoDecClass * klass)
|
gst_amc_video_dec_base_init (gpointer g_class)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstAmcVideoDecClass *amcvideodec_class = GST_AMC_VIDEO_DEC_CLASS (g_class);
|
||||||
GstVideoDecoderClass *videodec_class = GST_VIDEO_DECODER_CLASS (klass);
|
|
||||||
GstAmcVideoDecClass *amcvideodec_class = GST_AMC_VIDEO_DEC_CLASS (klass);
|
|
||||||
const GstAmcCodecInfo *codec_info;
|
const GstAmcCodecInfo *codec_info;
|
||||||
GstPadTemplate *templ;
|
GstPadTemplate *templ;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gchar *longname;
|
gchar *longname;
|
||||||
|
|
||||||
gobject_class->finalize = gst_amc_video_dec_finalize;
|
|
||||||
|
|
||||||
element_class->change_state =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_amc_video_dec_change_state);
|
|
||||||
|
|
||||||
videodec_class->start = GST_DEBUG_FUNCPTR (gst_amc_video_dec_start);
|
|
||||||
videodec_class->stop = GST_DEBUG_FUNCPTR (gst_amc_video_dec_stop);
|
|
||||||
videodec_class->open = GST_DEBUG_FUNCPTR (gst_amc_video_dec_open);
|
|
||||||
videodec_class->close = GST_DEBUG_FUNCPTR (gst_amc_video_dec_close);
|
|
||||||
videodec_class->reset = GST_DEBUG_FUNCPTR (gst_amc_video_dec_reset);
|
|
||||||
videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_amc_video_dec_set_format);
|
|
||||||
videodec_class->handle_frame =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_amc_video_dec_handle_frame);
|
|
||||||
videodec_class->finish = GST_DEBUG_FUNCPTR (gst_amc_video_dec_finish);
|
|
||||||
videodec_class->decide_allocation =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_amc_video_dec_decide_allocation);
|
|
||||||
|
|
||||||
codec_info =
|
codec_info =
|
||||||
g_type_get_qdata (G_TYPE_FROM_CLASS (klass), gst_amc_codec_info_quark);
|
g_type_get_qdata (G_TYPE_FROM_CLASS (g_class), gst_amc_codec_info_quark);
|
||||||
/* This happens for the base class and abstract subclasses */
|
/* This happens for the base class and abstract subclasses */
|
||||||
if (!codec_info)
|
if (!codec_info)
|
||||||
return;
|
return;
|
||||||
|
@ -449,6 +459,31 @@ gst_amc_video_dec_class_init (GstAmcVideoDecClass * klass)
|
||||||
g_free (longname);
|
g_free (longname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_amc_video_dec_class_init (GstAmcVideoDecClass * klass)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
GstVideoDecoderClass *videodec_class = GST_VIDEO_DECODER_CLASS (klass);
|
||||||
|
|
||||||
|
gobject_class->finalize = gst_amc_video_dec_finalize;
|
||||||
|
|
||||||
|
element_class->change_state =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_amc_video_dec_change_state);
|
||||||
|
|
||||||
|
videodec_class->start = GST_DEBUG_FUNCPTR (gst_amc_video_dec_start);
|
||||||
|
videodec_class->stop = GST_DEBUG_FUNCPTR (gst_amc_video_dec_stop);
|
||||||
|
videodec_class->open = GST_DEBUG_FUNCPTR (gst_amc_video_dec_open);
|
||||||
|
videodec_class->close = GST_DEBUG_FUNCPTR (gst_amc_video_dec_close);
|
||||||
|
videodec_class->reset = GST_DEBUG_FUNCPTR (gst_amc_video_dec_reset);
|
||||||
|
videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_amc_video_dec_set_format);
|
||||||
|
videodec_class->handle_frame =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_amc_video_dec_handle_frame);
|
||||||
|
videodec_class->finish = GST_DEBUG_FUNCPTR (gst_amc_video_dec_finish);
|
||||||
|
videodec_class->decide_allocation =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_amc_video_dec_decide_allocation);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_amc_video_dec_init (GstAmcVideoDec * self)
|
gst_amc_video_dec_init (GstAmcVideoDec * self)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue