[gst-devel] mpeg2parse mpeg1 support
vishnu at pobox.com
vishnu at pobox.com
Fri Oct 26 11:28:08 CEST 2001
Since mpeg2parse seems able to parse mpeg1 streams, i decided to
try to get mpeg1 working. i'm not sure what is the correct way
to fix this. Wim, can you comment?
--
Victory to the Divine Mother!! ... after all,
http://sahajayoga.org http://why-compete.org
-------------- next part --------------
Index: mpeg2parse.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/mpeg2/parse/mpeg2parse.c,v
retrieving revision 1.37
diff -u -p -r1.37 mpeg2parse.c
--- mpeg2parse.c 2001/10/23 19:50:41 1.37
+++ mpeg2parse.c 2001/10/26 18:26:46
@@ -41,6 +41,7 @@ enum {
enum {
ARG_0,
ARG_BIT_RATE,
+ ARG_MPEG2,
/* FILL ME */
};
@@ -67,13 +68,25 @@ GST_PADTEMPLATE_FACTORY (audio_factory,
)
);
-GST_PADTEMPLATE_FACTORY (video_factory,
+GST_PADTEMPLATE_FACTORY (video1_factory,
"video_[0-15]",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"mpeg2parse_video",
"video/mpeg",
+ "mpegversion", GST_PROPS_INT (1),
+ "systemstream", GST_PROPS_BOOLEAN (FALSE)
+ )
+);
+
+GST_PADTEMPLATE_FACTORY (video2_factory,
+ "video_[0-15]",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_CAPS_NEW (
+ "mpeg2parse_video",
+ "video/mpeg",
"mpegversion", GST_PROPS_INT (2),
"systemstream", GST_PROPS_BOOLEAN (FALSE)
)
@@ -157,6 +170,10 @@ gst_mpeg2parse_class_init (Mpeg2ParseCla
g_param_spec_uint("bit_rate","bit_rate","bit_rate",
0,G_MAXUINT,0,G_PARAM_READABLE)); // CHECKME
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MPEG2,
+ g_param_spec_boolean ("mpeg2", "", "",
+ FALSE, G_PARAM_READABLE));
+
gobject_class->get_property = gst_mpeg2parse_get_property;
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
@@ -345,7 +362,10 @@ parse_syshead (Mpeg2Parse * mpeg2parse)
name = g_strdup_printf ("video_%02d", stream_id & 0x0F);
stream_num = stream_id & 0x0F;
outpad = &mpeg2parse->video_pad[stream_num];
- newtemp = GST_PADTEMPLATE_GET (video_factory);
+ if (!mpeg2parse->MPEG2)
+ newtemp = GST_PADTEMPLATE_GET (video1_factory);
+ else
+ newtemp = GST_PADTEMPLATE_GET (video2_factory);
}
GST_DEBUG (0, "mpeg2parse::parse_syshead: stream ID 0x%02X (%s)\n", stream_id, name);
@@ -357,7 +377,7 @@ parse_syshead (Mpeg2Parse * mpeg2parse)
// this should trigger the NEW_PAD signal, which should be caught by
// the app and used to attach to desired streams.
if (outpad && *outpad == NULL) {
- (*outpad) = gst_pad_new_from_template (newtemp, name);
+ *outpad = gst_pad_new_from_template (newtemp, name);
gst_pad_set_caps (*outpad, gst_pad_get_padtemplate_caps (*outpad));
gst_element_add_pad (GST_ELEMENT (mpeg2parse), (*outpad));
}
@@ -736,7 +756,7 @@ parse_pes (Mpeg2Parse *mpeg2parse)
}
else if ((id >= 0xE0) && (id <= 0xEF)) {
name = g_strdup_printf("video_%d",id - 0xE0);
- newtemp = GST_PADTEMPLATE_GET (video_factory);
+ newtemp = GST_PADTEMPLATE_GET (video2_factory);
}
else {
name = g_strdup_printf("unknown");
@@ -964,6 +984,9 @@ gst_mpeg2parse_get_property (GObject *ob
g_value_set_uint (value, mpeg2parse->bit_rate*316); // hu?
break;
}
+ case ARG_MPEG2:
+ g_value_set_boolean (value, mpeg2parse->MPEG2);
+ break;
default: {
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -990,7 +1013,8 @@ plugin_init (GModule *module, GstPlugin
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (sink_factory));
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (audio_factory));
- gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (video_factory));
+ gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (video1_factory));
+ gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (video2_factory));
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (private1_factory));
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (private2_factory));
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (subtitle_factory));
More information about the gstreamer-devel
mailing list