MPEG system streams work too, now

Original commit message from CVS:
MPEG system streams work too, now
This commit is contained in:
Ronald S. Bultje 2003-11-02 21:22:09 +00:00
parent 2869025b0a
commit d71c0d2065
7 changed files with 84 additions and 73 deletions

View file

@ -30,12 +30,9 @@ GST_DEBUG_CATEGORY_EXTERN (GST_CAT_SEEK);
static GstElementDetails mpeg_demux_details = {
"MPEG Demuxer",
"Codec/Demuxer",
"LGPL",
"Demultiplexes MPEG1 and MPEG2 System Streams",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>\n"
"Wim Taymans <wim.taymans@chello.be>",
"(C) 1999",
"Wim Taymans <wim.taymans@chello.be>"
};
/* MPEG2Demux signals and args */
@ -154,6 +151,7 @@ GST_PAD_TEMPLATE_FACTORY (subtitle_factory,
);
static void gst_mpeg_demux_class_init (GstMPEGDemuxClass *klass);
static void gst_mpeg_demux_base_init (GstMPEGDemuxClass *klass);
static void gst_mpeg_demux_init (GstMPEGDemux *mpeg_demux);
static gboolean gst_mpeg_demux_parse_packhead (GstMPEGParse *mpeg_parse, GstBuffer *buffer);
@ -187,7 +185,7 @@ mpeg_demux_get_type (void)
if (!mpeg_demux_type) {
static const GTypeInfo mpeg_demux_info = {
sizeof(GstMPEGDemuxClass),
NULL,
(GBaseInitFunc)gst_mpeg_demux_base_init,
NULL,
(GClassInitFunc)gst_mpeg_demux_class_init,
NULL,
@ -201,6 +199,29 @@ mpeg_demux_get_type (void)
return mpeg_demux_type;
}
static void
gst_mpeg_demux_base_init (GstMPEGDemuxClass *klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (video_src_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (private1_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (private2_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (pcm_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (subtitle_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (audio_factory));
gst_element_class_set_details (element_class, &mpeg_demux_details);
}
static void
gst_mpeg_demux_class_init (GstMPEGDemuxClass *klass)
{
@ -1231,25 +1252,8 @@ gst_mpeg_demux_get_index (GstElement *element)
gboolean
gst_mpeg_demux_plugin_init (GModule *module, GstPlugin *plugin)
gst_mpeg_demux_plugin_init (GstPlugin *plugin)
{
GstElementFactory *factory;
/* create an elementfactory for the mpeg_demux element */
factory = gst_element_factory_new ("mpegdemux", GST_TYPE_MPEG_DEMUX,
&mpeg_demux_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (video_src_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (private1_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (private2_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (pcm_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (subtitle_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (audio_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
return gst_element_register (plugin, "mpegdemux",
GST_RANK_PRIMARY, GST_TYPE_MPEG_DEMUX);
}

View file

@ -103,7 +103,7 @@ struct _GstMPEGDemuxClass {
GType gst_mpeg_demux_get_type(void);
gboolean gst_mpeg_demux_plugin_init (GModule *module, GstPlugin *plugin);
gboolean gst_mpeg_demux_plugin_init (GstPlugin *plugin);
#ifdef __cplusplus
}

View file

@ -33,12 +33,9 @@ GST_DEBUG_CATEGORY_EXTERN (GST_CAT_SEEK);
static GstElementDetails mpeg_parse_details = {
"MPEG System Parser",
"Codec/Parser",
"LGPL",
"Parses MPEG1 and MPEG2 System Streams",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>\n"
"Wim Taymans <wim.taymans@chello.be>",
"(C) 1999",
"Wim Taymans <wim.taymans@chello.be>"
};
#define CLASS(o) GST_MPEG_PARSE_CLASS (G_OBJECT_GET_CLASS (o))
@ -84,6 +81,7 @@ GST_PAD_TEMPLATE_FACTORY (src_factory,
);
static void gst_mpeg_parse_class_init (GstMPEGParseClass *klass);
static void gst_mpeg_parse_base_init (GstMPEGParseClass *klass);
static void gst_mpeg_parse_init (GstMPEGParse *mpeg_parse);
static GstElementStateReturn
gst_mpeg_parse_change_state (GstElement *element);
@ -117,7 +115,8 @@ gst_mpeg_parse_get_type (void)
if (!mpeg_parse_type) {
static const GTypeInfo mpeg_parse_info = {
sizeof(GstMPEGParseClass), NULL,
sizeof(GstMPEGParseClass),
(GBaseInitFunc)gst_mpeg_parse_base_init,
NULL,
(GClassInitFunc)gst_mpeg_parse_class_init,
NULL,
@ -131,6 +130,18 @@ gst_mpeg_parse_get_type (void)
return mpeg_parse_type;
}
static void
gst_mpeg_parse_base_init (GstMPEGParseClass *klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_element_class_set_details (element_class, &mpeg_parse_details);
}
static void
gst_mpeg_parse_class_init (GstMPEGParseClass *klass)
{
@ -911,21 +922,10 @@ gst_mpeg_parse_release_locks (GstElement *element)
}
gboolean
gst_mpeg_parse_plugin_init (GModule *module, GstPlugin *plugin)
gst_mpeg_parse_plugin_init (GstPlugin *plugin)
{
GstElementFactory *factory;
/* create an elementfactory for the mpeg_parse element */
factory = gst_element_factory_new ("mpegparse", GST_TYPE_MPEG_PARSE,
&mpeg_parse_details);
g_return_val_if_fail(factory != NULL, FALSE);
scr_format = gst_format_register ("scr", "The MPEG system clock reference time");
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
return gst_element_register (plugin, "mpegparse",
GST_RANK_NONE, GST_TYPE_MPEG_PARSE);
}

View file

@ -98,7 +98,7 @@ struct _GstMPEGParseClass {
GType gst_mpeg_parse_get_type(void);
gboolean gst_mpeg_parse_plugin_init (GModule *module, GstPlugin *plugin);
gboolean gst_mpeg_parse_plugin_init (GstPlugin *plugin);
const GstFormat*
gst_mpeg_parse_get_src_formats (GstPad *pad);

View file

@ -23,7 +23,7 @@
#include "gstrfc2250enc.h"
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
plugin_init (GstPlugin *plugin)
{
/* short-circuit here; this is potentially dangerous since if the second
* or third init fails then the whole plug-in will be placed on the register
@ -33,16 +33,23 @@ plugin_init (GModule *module, GstPlugin *plugin)
if (!gst_library_load ("gstbytestream"))
return FALSE;
if (!gst_mpeg_parse_plugin_init (module, plugin)) return FALSE;
if (!gst_mpeg_demux_plugin_init (module, plugin)) return FALSE;
if (!gst_rfc2250_enc_plugin_init (module, plugin)) return FALSE;
if (!gst_mpeg_parse_plugin_init (plugin) ||
!gst_mpeg_demux_plugin_init (plugin) ||
!gst_rfc2250_enc_plugin_init (plugin))
return FALSE;
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"mpegstream",
plugin_init
};
"MPEG system stream parser",
plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View file

@ -28,11 +28,8 @@
static GstElementDetails rfc2250_enc_details = {
"RFC 2250 packet encoder",
"Codec/Parser",
"LGPL",
"transforms MPEG1/2 video to an RFC 2250 compliant format",
VERSION,
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2001",
"Wim Taymans <wim.taymans@chello.be>"
};
#define CLASS(o) GST_RFC2250_ENC_CLASS (G_OBJECT_GET_CLASS (o))
@ -75,6 +72,7 @@ GST_PAD_TEMPLATE_FACTORY (src_factory,
);
static void gst_rfc2250_enc_class_init (GstRFC2250EncClass *klass);
static void gst_rfc2250_enc_base_init (GstRFC2250EncClass *klass);
static void gst_rfc2250_enc_init (GstRFC2250Enc *rfc2250_enc);
static GstElementStateReturn
gst_rfc2250_enc_change_state (GstElement *element);
@ -94,7 +92,8 @@ gst_rfc2250_enc_get_type (void)
if (!rfc2250_enc_type) {
static const GTypeInfo rfc2250_enc_info = {
sizeof(GstRFC2250EncClass), NULL,
sizeof(GstRFC2250EncClass),
(GBaseInitFunc)gst_rfc2250_enc_base_init,
NULL,
(GClassInitFunc)gst_rfc2250_enc_class_init,
NULL,
@ -108,6 +107,18 @@ gst_rfc2250_enc_get_type (void)
return rfc2250_enc_type;
}
static void
gst_rfc2250_enc_base_init (GstRFC2250EncClass *klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_element_class_set_details (element_class, &rfc2250_enc_details);
}
static void
gst_rfc2250_enc_class_init (GstRFC2250EncClass *klass)
{
@ -324,19 +335,8 @@ gst_rfc2250_enc_get_property (GObject *object, guint prop_id, GValue *value, GPa
gboolean
gst_rfc2250_enc_plugin_init (GModule *module, GstPlugin *plugin)
gst_rfc2250_enc_plugin_init (GstPlugin *plugin)
{
GstElementFactory *factory;
/* create an elementfactory for the rfc2250_enc element */
factory = gst_element_factory_new ("rfc2250enc", GST_TYPE_RFC2250_ENC,
&rfc2250_enc_details);
g_return_val_if_fail(factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
return gst_element_register (plugin, "rfc2250enc",
GST_RANK_NONE, GST_TYPE_RFC2250_ENC);
}

View file

@ -78,7 +78,7 @@ struct _GstRFC2250EncClass {
GType gst_rfc2250_enc_get_type(void);
gboolean gst_rfc2250_enc_plugin_init (GModule *module, GstPlugin *plugin);
gboolean gst_rfc2250_enc_plugin_init (GstPlugin *plugin);
#ifdef __cplusplus