Make sure caps are fixed when creating a new video pad
Original commit message from CVS: Make sure caps are fixed when creating a new video pad
This commit is contained in:
parent
e4da6de082
commit
9ce42abf61
@ -394,6 +394,7 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
|
|||||||
gchar *name = NULL;
|
gchar *name = NULL;
|
||||||
GstMPEGStream **outstream = NULL;
|
GstMPEGStream **outstream = NULL;
|
||||||
GstPadTemplate *newtemp = NULL;
|
GstPadTemplate *newtemp = NULL;
|
||||||
|
GstCaps *caps = NULL;
|
||||||
|
|
||||||
stream_id = *buf++;
|
stream_id = *buf++;
|
||||||
if (!(stream_id & 0x80)) {
|
if (!(stream_id & 0x80)) {
|
||||||
@ -437,6 +438,22 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
|
|||||||
name = g_strdup_printf ("video_%02d", stream_id & 0x0F);
|
name = g_strdup_printf ("video_%02d", stream_id & 0x0F);
|
||||||
outstream = &mpeg_demux->video_stream[stream_id & 0x0F];
|
outstream = &mpeg_demux->video_stream[stream_id & 0x0F];
|
||||||
newtemp = GST_PAD_TEMPLATE_GET (video_src_factory);
|
newtemp = GST_PAD_TEMPLATE_GET (video_src_factory);
|
||||||
|
if (!GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux)) {
|
||||||
|
caps = GST_CAPS_NEW (
|
||||||
|
"mpeg_demux_video_mpeg1",
|
||||||
|
"video/mpeg",
|
||||||
|
"mpegversion", GST_PROPS_INT (1),
|
||||||
|
"systemstream", GST_PROPS_BOOLEAN (FALSE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
caps = GST_CAPS_NEW (
|
||||||
|
"mpeg_demux_video_mpeg2",
|
||||||
|
"video/mpeg",
|
||||||
|
"mpegversion", GST_PROPS_INT (2),
|
||||||
|
"systemstream", GST_PROPS_BOOLEAN (FALSE)
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG ("unkown stream id %d", stream_id);
|
GST_DEBUG ("unkown stream id %d", stream_id);
|
||||||
}
|
}
|
||||||
@ -452,15 +469,19 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
|
|||||||
*/
|
*/
|
||||||
if (outstream && *outstream == NULL) {
|
if (outstream && *outstream == NULL) {
|
||||||
GstPad **outpad;
|
GstPad **outpad;
|
||||||
GstCaps *caps;
|
|
||||||
|
|
||||||
*outstream = gst_mpeg_demux_new_stream ();
|
*outstream = gst_mpeg_demux_new_stream ();
|
||||||
outpad = &((*outstream)->pad);
|
outpad = &((*outstream)->pad);
|
||||||
|
|
||||||
*outpad = gst_pad_new_from_template (newtemp, name);
|
*outpad = gst_pad_new_from_template (newtemp, name);
|
||||||
caps = gst_pad_template_get_caps (newtemp);
|
if (!caps) {
|
||||||
gst_pad_try_set_caps (*outpad, caps);
|
caps = gst_pad_template_get_caps (newtemp);
|
||||||
gst_caps_unref (caps);
|
gst_pad_try_set_caps (*outpad, caps);
|
||||||
|
gst_caps_unref(caps);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gst_pad_try_set_caps (*outpad, caps);
|
||||||
|
}
|
||||||
|
|
||||||
gst_pad_set_formats_function (*outpad, gst_mpeg_demux_get_src_formats);
|
gst_pad_set_formats_function (*outpad, gst_mpeg_demux_get_src_formats);
|
||||||
gst_pad_set_convert_function (*outpad, gst_mpeg_parse_convert_src);
|
gst_pad_set_convert_function (*outpad, gst_mpeg_parse_convert_src);
|
||||||
@ -851,6 +872,7 @@ gst_mpeg_demux_parse_pes (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
|
|||||||
/* the app and used to attach to desired streams. */
|
/* the app and used to attach to desired streams. */
|
||||||
if ((*outstream) == NULL) {
|
if ((*outstream) == NULL) {
|
||||||
gchar *name = NULL;
|
gchar *name = NULL;
|
||||||
|
GstCaps *caps = NULL;
|
||||||
|
|
||||||
/* we have to name the stream approriately */
|
/* we have to name the stream approriately */
|
||||||
if (id == 0xBD) {
|
if (id == 0xBD) {
|
||||||
@ -885,13 +907,28 @@ gst_mpeg_demux_parse_pes (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
|
|||||||
/* video */
|
/* video */
|
||||||
name = g_strdup_printf ("video_%02d", id - 0xE0);
|
name = g_strdup_printf ("video_%02d", id - 0xE0);
|
||||||
newtemp = GST_PAD_TEMPLATE_GET (video_src_factory);
|
newtemp = GST_PAD_TEMPLATE_GET (video_src_factory);
|
||||||
|
if (!GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux)) {
|
||||||
|
caps = GST_CAPS_NEW (
|
||||||
|
"mpeg_demux_video_mpeg1",
|
||||||
|
"video/mpeg",
|
||||||
|
"mpegversion", GST_PROPS_INT (1),
|
||||||
|
"systemstream", GST_PROPS_BOOLEAN (FALSE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
caps = GST_CAPS_NEW (
|
||||||
|
"mpeg_demux_video_mpeg2",
|
||||||
|
"video/mpeg",
|
||||||
|
"mpegversion", GST_PROPS_INT (2),
|
||||||
|
"systemstream", GST_PROPS_BOOLEAN (FALSE)
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* unkown */
|
/* unkown */
|
||||||
name = g_strdup_printf ("unknown");
|
name = g_strdup_printf ("unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newtemp) {
|
if (newtemp) {
|
||||||
GstCaps *caps;
|
|
||||||
|
|
||||||
*outstream = gst_mpeg_demux_new_stream ();
|
*outstream = gst_mpeg_demux_new_stream ();
|
||||||
outpad = &((*outstream)->pad);
|
outpad = &((*outstream)->pad);
|
||||||
@ -899,9 +936,14 @@ gst_mpeg_demux_parse_pes (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
|
|||||||
/* create the pad and add it to self */
|
/* create the pad and add it to self */
|
||||||
*outpad = gst_pad_new_from_template (newtemp, name);
|
*outpad = gst_pad_new_from_template (newtemp, name);
|
||||||
if (ps_id_code < 0xA0 || ps_id_code > 0xA7) {
|
if (ps_id_code < 0xA0 || ps_id_code > 0xA7) {
|
||||||
caps = gst_pad_template_get_caps (newtemp);
|
if (!caps) {
|
||||||
gst_pad_try_set_caps (*outpad, caps);
|
caps = gst_pad_template_get_caps (newtemp);
|
||||||
gst_caps_unref (caps);
|
gst_pad_try_set_caps (*outpad, caps);
|
||||||
|
gst_caps_unref(caps);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gst_pad_try_set_caps (*outpad, caps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gst_mpeg_demux_lpcm_set_caps(*outpad,
|
gst_mpeg_demux_lpcm_set_caps(*outpad,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user