mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
gst/mpegstream/: Check for error codes from the negotiation functions. Make sure we really set the pad caps when a ne...
Original commit message from CVS: * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_get_video_stream), (gst_mpeg_demux_get_audio_stream), (gst_mpeg_demux_process_private): * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_send_data): Check for error codes from the negotiation functions. Make sure we really set the pad caps when a new pad is created.
This commit is contained in:
parent
7f5110c404
commit
48858d6543
3 changed files with 40 additions and 16 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-07-26 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_get_video_stream),
|
||||
(gst_mpeg_demux_get_audio_stream),
|
||||
(gst_mpeg_demux_process_private):
|
||||
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_send_data):
|
||||
Check for error codes from the negotiation functions. Make sure
|
||||
we really set the pad caps when a new pad is created.
|
||||
|
||||
2004-07-26 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
|
||||
|
|
|
@ -370,6 +370,7 @@ gst_mpeg_demux_get_video_stream (GstMPEGDemux * mpeg_demux,
|
|||
GstMPEGVideoStream *video_str;
|
||||
gchar *name;
|
||||
GstCaps *caps;
|
||||
gboolean set_caps = FALSE;
|
||||
|
||||
g_return_val_if_fail (stream_nr < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS, NULL);
|
||||
g_return_val_if_fail (type > GST_MPEG_DEMUX_VIDEO_UNKNOWN &&
|
||||
|
@ -380,7 +381,6 @@ gst_mpeg_demux_get_video_stream (GstMPEGDemux * mpeg_demux,
|
|||
if (str == NULL) {
|
||||
video_str = g_new0 (GstMPEGVideoStream, 1);
|
||||
str = (GstMPEGStream *) video_str;
|
||||
str->type = GST_MPEG_DEMUX_VIDEO_UNKNOWN;
|
||||
|
||||
name = g_strdup_printf ("video_%02d", stream_nr);
|
||||
CLASS (mpeg_demux)->init_stream (mpeg_demux, type, str, stream_nr, name,
|
||||
|
@ -388,6 +388,8 @@ gst_mpeg_demux_get_video_stream (GstMPEGDemux * mpeg_demux,
|
|||
g_free (name);
|
||||
|
||||
mpeg_demux->video_stream[stream_nr] = str;
|
||||
|
||||
set_caps = TRUE;
|
||||
} else {
|
||||
/* This stream may have been created by a derived class, reset the
|
||||
size. */
|
||||
|
@ -395,16 +397,18 @@ gst_mpeg_demux_get_video_stream (GstMPEGDemux * mpeg_demux,
|
|||
mpeg_demux->video_stream[stream_nr] = str = (GstMPEGStream *) video_str;
|
||||
}
|
||||
|
||||
if (str->type != GST_MPEG_DEMUX_VIDEO_MPEG ||
|
||||
video_str->mpeg_version != mpeg_version) {
|
||||
if (set_caps || video_str->mpeg_version != mpeg_version) {
|
||||
/* We need to set new caps for this pad. */
|
||||
caps = gst_caps_new_simple ("video/mpeg",
|
||||
"mpegversion", G_TYPE_INT, mpeg_version,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
gst_pad_set_explicit_caps (str->pad, caps);
|
||||
if (!gst_pad_set_explicit_caps (str->pad, caps)) {
|
||||
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_demux),
|
||||
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
||||
return str;
|
||||
}
|
||||
|
||||
/* Store the current values. */
|
||||
str->type = GST_MPEG_DEMUX_VIDEO_MPEG;
|
||||
video_str->mpeg_version = mpeg_version;
|
||||
}
|
||||
|
||||
|
@ -418,6 +422,7 @@ gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
|
|||
GstMPEGStream *str;
|
||||
gchar *name;
|
||||
GstCaps *caps;
|
||||
gboolean set_caps = FALSE;
|
||||
|
||||
g_return_val_if_fail (stream_nr < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS, NULL);
|
||||
g_return_val_if_fail (type > GST_MPEG_DEMUX_AUDIO_UNKNOWN &&
|
||||
|
@ -427,7 +432,6 @@ gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
|
|||
|
||||
if (str == NULL) {
|
||||
str = g_new0 (GstMPEGStream, 1);
|
||||
str->type = GST_MPEG_DEMUX_AUDIO_MPEG;
|
||||
|
||||
name = g_strdup_printf ("audio_%02d", stream_nr);
|
||||
CLASS (mpeg_demux)->init_stream (mpeg_demux, type, str, stream_nr, name,
|
||||
|
@ -435,19 +439,24 @@ gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
|
|||
g_free (name);
|
||||
|
||||
mpeg_demux->audio_stream[stream_nr] = str;
|
||||
|
||||
/* new pad, set caps */
|
||||
set_caps = TRUE;
|
||||
} else {
|
||||
/* This stream may have been created by a derived class, reset the
|
||||
size. */
|
||||
str = g_renew (GstMPEGStream, str, 1);
|
||||
}
|
||||
|
||||
if (str->type != GST_MPEG_DEMUX_AUDIO_MPEG) {
|
||||
if (set_caps) {
|
||||
/* We need to set new caps for this pad. */
|
||||
caps = gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 1, NULL);
|
||||
gst_pad_set_explicit_caps (str->pad, caps);
|
||||
|
||||
str->type = GST_MPEG_DEMUX_AUDIO_MPEG;
|
||||
if (!gst_pad_set_explicit_caps (str->pad, caps)) {
|
||||
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_demux),
|
||||
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
|
|
|
@ -306,14 +306,20 @@ gst_mpeg_parse_send_data (GstMPEGParse * mpeg_parse, GstData * data,
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
if (!GST_PAD_CAPS (mpeg_parse->srcpad)) {
|
||||
if (!gst_pad_is_negotiated (mpeg_parse->srcpad)) {
|
||||
gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
|
||||
GstCaps *caps;
|
||||
|
||||
gst_pad_set_explicit_caps (mpeg_parse->srcpad,
|
||||
gst_caps_new_simple ("video/mpeg",
|
||||
"mpegversion", G_TYPE_INT, (mpeg2 ? 2 : 1),
|
||||
"systemstream", G_TYPE_BOOLEAN, TRUE,
|
||||
"parsed", G_TYPE_BOOLEAN, TRUE, NULL));
|
||||
caps = gst_caps_new_simple ("video/mpeg",
|
||||
"mpegversion", G_TYPE_INT, (mpeg2 ? 2 : 1),
|
||||
"systemstream", G_TYPE_BOOLEAN, TRUE,
|
||||
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
|
||||
if (!gst_pad_set_explicit_caps (mpeg_parse->srcpad, caps)) {
|
||||
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_parse),
|
||||
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GST_BUFFER_TIMESTAMP (data) = time;
|
||||
|
|
Loading…
Reference in a new issue