mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
avi: use G_DEFINE_TYPE
This commit is contained in:
parent
dea50d0b98
commit
a80f3a5d74
3 changed files with 52 additions and 133 deletions
|
@ -72,9 +72,6 @@ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_STATIC_CAPS ("video/x-msvideo")
|
||||
);
|
||||
|
||||
static void gst_avi_demux_base_init (GstAviDemuxClass * klass);
|
||||
static void gst_avi_demux_class_init (GstAviDemuxClass * klass);
|
||||
static void gst_avi_demux_init (GstAviDemux * avi);
|
||||
static void gst_avi_demux_finalize (GObject * object);
|
||||
|
||||
static void gst_avi_demux_reset (GstAviDemux * avi);
|
||||
|
@ -118,43 +115,29 @@ static void gst_avi_demux_get_buffer_info (GstAviDemux * avi,
|
|||
|
||||
static void gst_avi_demux_parse_idit (GstAviDemux * avi, GstBuffer * buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* GObject methods */
|
||||
|
||||
GType
|
||||
gst_avi_demux_get_type (void)
|
||||
{
|
||||
static GType avi_demux_type = 0;
|
||||
|
||||
if (!avi_demux_type) {
|
||||
static const GTypeInfo avi_demux_info = {
|
||||
sizeof (GstAviDemuxClass),
|
||||
(GBaseInitFunc) gst_avi_demux_base_init,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_avi_demux_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GstAviDemux),
|
||||
0,
|
||||
(GInstanceInitFunc) gst_avi_demux_init,
|
||||
};
|
||||
|
||||
avi_demux_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstAviDemux", &avi_demux_info, 0);
|
||||
}
|
||||
|
||||
return avi_demux_type;
|
||||
}
|
||||
#define gst_avi_demux_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstAviDemux, gst_avi_demux, GST_TYPE_ELEMENT);
|
||||
|
||||
static void
|
||||
gst_avi_demux_base_init (GstAviDemuxClass * klass)
|
||||
gst_avi_demux_class_init (GstAviDemuxClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstPadTemplate *videosrctempl, *audiosrctempl, *subsrctempl;
|
||||
GstCaps *audcaps, *vidcaps, *subcaps;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux",
|
||||
0, "Demuxer for AVI streams");
|
||||
|
||||
gobject_class->finalize = gst_avi_demux_finalize;
|
||||
|
||||
gstelement_class->change_state =
|
||||
GST_DEBUG_FUNCPTR (gst_avi_demux_change_state);
|
||||
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_avi_demux_set_index);
|
||||
gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_avi_demux_get_index);
|
||||
|
||||
audcaps = gst_riff_create_audio_template_caps ();
|
||||
gst_caps_append (audcaps, gst_caps_new_simple ("audio/x-avi-unknown", NULL));
|
||||
audiosrctempl = gst_pad_template_new ("audio_%02d",
|
||||
|
@ -169,12 +152,13 @@ gst_avi_demux_base_init (GstAviDemuxClass * klass)
|
|||
subcaps = gst_caps_new_simple ("application/x-subtitle-avi", NULL);
|
||||
subsrctempl = gst_pad_template_new ("subtitle_%02d",
|
||||
GST_PAD_SRC, GST_PAD_SOMETIMES, subcaps);
|
||||
gst_element_class_add_pad_template (element_class, audiosrctempl);
|
||||
gst_element_class_add_pad_template (element_class, videosrctempl);
|
||||
gst_element_class_add_pad_template (element_class, subsrctempl);
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_element_class_add_pad_template (gstelement_class, audiosrctempl);
|
||||
gst_element_class_add_pad_template (gstelement_class, videosrctempl);
|
||||
gst_element_class_add_pad_template (gstelement_class, subsrctempl);
|
||||
gst_element_class_add_pad_template (gstelement_class,
|
||||
gst_static_pad_template_get (&sink_templ));
|
||||
gst_element_class_set_details_simple (element_class, "Avi demuxer",
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class, "Avi demuxer",
|
||||
"Codec/Demuxer",
|
||||
"Demultiplex an avi file into audio and video",
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
||||
|
@ -182,25 +166,6 @@ gst_avi_demux_base_init (GstAviDemuxClass * klass)
|
|||
"Thijs Vermeir <thijsvermeir@gmail.com>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_avi_demux_class_init (GstAviDemuxClass * klass)
|
||||
{
|
||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux",
|
||||
0, "Demuxer for AVI streams");
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->finalize = gst_avi_demux_finalize;
|
||||
gstelement_class->change_state =
|
||||
GST_DEBUG_FUNCPTR (gst_avi_demux_change_state);
|
||||
|
||||
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_avi_demux_set_index);
|
||||
gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_avi_demux_get_index);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_avi_demux_init (GstAviDemux * avi)
|
||||
{
|
||||
|
|
|
@ -191,9 +191,6 @@ static GstStaticPadTemplate audio_sink_factory =
|
|||
"wmaversion = (int) [ 1, 2 ] ")
|
||||
);
|
||||
|
||||
static void gst_avi_mux_base_init (gpointer g_class);
|
||||
static void gst_avi_mux_class_init (GstAviMuxClass * klass);
|
||||
static void gst_avi_mux_init (GstAviMux * avimux);
|
||||
static void gst_avi_mux_pad_reset (GstAviPad * avipad, gboolean free);
|
||||
|
||||
static GstFlowReturn gst_avi_mux_collect_pads (GstCollectPads * pads,
|
||||
|
@ -209,58 +206,9 @@ static void gst_avi_mux_get_property (GObject * object,
|
|||
static GstStateChangeReturn gst_avi_mux_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gst_avi_mux_get_type (void)
|
||||
{
|
||||
static GType avimux_type = 0;
|
||||
|
||||
if (!avimux_type) {
|
||||
static const GTypeInfo avimux_info = {
|
||||
sizeof (GstAviMuxClass),
|
||||
gst_avi_mux_base_init,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_avi_mux_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GstAviMux),
|
||||
0,
|
||||
(GInstanceInitFunc) gst_avi_mux_init,
|
||||
};
|
||||
static const GInterfaceInfo tag_setter_info = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
avimux_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0);
|
||||
g_type_add_interface_static (avimux_type, GST_TYPE_TAG_SETTER,
|
||||
&tag_setter_info);
|
||||
}
|
||||
return avimux_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_avi_mux_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&src_factory));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&audio_sink_factory));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&video_sink_factory));
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "Avi muxer",
|
||||
"Codec/Muxer",
|
||||
"Muxes audio and video into an avi stream",
|
||||
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (avimux_debug, "avimux", 0, "Muxer for AVI streams");
|
||||
}
|
||||
#define gst_avi_mux_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstAviMux, gst_avi_mux, GST_TYPE_ELEMENT,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
|
||||
|
||||
static void
|
||||
gst_avi_mux_finalize (GObject * object)
|
||||
|
@ -298,7 +246,7 @@ gst_avi_mux_class_init (GstAviMuxClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
GST_DEBUG_CATEGORY_INIT (avimux_debug, "avimux", 0, "Muxer for AVI streams");
|
||||
|
||||
gobject_class->get_property = gst_avi_mux_get_property;
|
||||
gobject_class->set_property = gst_avi_mux_set_property;
|
||||
|
@ -313,6 +261,18 @@ gst_avi_mux_class_init (GstAviMuxClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_avi_mux_request_new_pad);
|
||||
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_avi_mux_release_pad);
|
||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_avi_mux_change_state);
|
||||
|
||||
gst_element_class_add_pad_template (gstelement_class,
|
||||
gst_static_pad_template_get (&src_factory));
|
||||
gst_element_class_add_pad_template (gstelement_class,
|
||||
gst_static_pad_template_get (&audio_sink_factory));
|
||||
gst_element_class_add_pad_template (gstelement_class,
|
||||
gst_static_pad_template_get (&video_sink_factory));
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class, "Avi muxer",
|
||||
"Codec/Muxer",
|
||||
"Muxes audio and video into an avi stream",
|
||||
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
|
||||
}
|
||||
|
||||
/* reset pad to initial state
|
||||
|
|
|
@ -81,8 +81,8 @@ static GstStateChangeReturn gst_avi_subtitle_change_state (GstElement * element,
|
|||
static gboolean gst_avi_subtitle_send_event (GstElement * element,
|
||||
GstEvent * event);
|
||||
|
||||
GST_BOILERPLATE (GstAviSubtitle, gst_avi_subtitle, GstElement,
|
||||
GST_TYPE_ELEMENT);
|
||||
#define gst_avi_subtitle_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstAviSubtitle, gst_avi_subtitle, GST_TYPE_ELEMENT);
|
||||
|
||||
#define IS_BOM_UTF8(data) ((GST_READ_UINT32_BE(data) >> 8) == 0xEFBBBF)
|
||||
#define IS_BOM_UTF16_BE(data) (GST_READ_UINT16_BE(data) == 0xFEFF)
|
||||
|
@ -318,37 +318,31 @@ gst_avi_subtitle_send_event (GstElement * element, GstEvent * event)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_avi_subtitle_base_init (gpointer klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (avisubtitle_debug, "avisubtitle", 0,
|
||||
"parse avi subtitle stream");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&sink_template));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&src_template));
|
||||
|
||||
gst_element_class_set_details_simple (element_class,
|
||||
"Avi subtitle parser", "Codec/Parser/Subtitle",
|
||||
"Parse avi subtitle stream", "Thijs Vermeir <thijsvermeir@gmail.com>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_avi_subtitle_class_init (GstAviSubtitleClass * klass)
|
||||
{
|
||||
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (avisubtitle_debug, "avisubtitle", 0,
|
||||
"parse avi subtitle stream");
|
||||
|
||||
gstelement_class->change_state =
|
||||
GST_DEBUG_FUNCPTR (gst_avi_subtitle_change_state);
|
||||
gstelement_class->send_event =
|
||||
GST_DEBUG_FUNCPTR (gst_avi_subtitle_send_event);
|
||||
|
||||
gst_element_class_add_pad_template (gstelement_class,
|
||||
gst_static_pad_template_get (&sink_template));
|
||||
gst_element_class_add_pad_template (gstelement_class,
|
||||
gst_static_pad_template_get (&src_template));
|
||||
|
||||
gst_element_class_set_details_simple (gstelement_class,
|
||||
"Avi subtitle parser", "Codec/Parser/Subtitle",
|
||||
"Parse avi subtitle stream", "Thijs Vermeir <thijsvermeir@gmail.com>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_avi_subtitle_init (GstAviSubtitle * self, GstAviSubtitleClass * klass)
|
||||
gst_avi_subtitle_init (GstAviSubtitle * self)
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
||||
|
|
Loading…
Reference in a new issue