From: <wt...@fr...> - 2004-07-26 15:17:41
|
CVS Root: /cvs/gstreamer Module: gst-plugins Changes by: wtay Date: Tue Jul 27 2004 01:17:38 EST Log message: * 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. Modified files: . : ChangeLog gst/mpegstream : gstmpegdemux.c gstmpegparse.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.915&r2=1.916 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/mpegstream/gstmpegdemux.c.diff?r1=1.63&r2=1.64 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/mpegstream/gstmpegparse.c.diff?r1=1.59&r2=1.60 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.915 retrieving revision 1.916 diff -u -d -r1.915 -r1.916 --- ChangeLog 26 Jul 2004 13:30:28 -0000 1.915 +++ ChangeLog 26 Jul 2004 15:17:25 -0000 1.916 @@ -1,3 +1,12 @@ +2004-07-26 Wim Taymans <wi...@fl...> + + * 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: Index: gstmpegdemux.c RCS file: /cvs/gstreamer/gst-plugins/gst/mpegstream/gstmpegdemux.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- gstmpegdemux.c 9 Jul 2004 14:11:02 -0000 1.63 +++ gstmpegdemux.c 26 Jul 2004 15:17:25 -0000 1.64 @@ -370,6 +370,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ GstMPEGStream *str; 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 @@ str = g_new0 (GstMPEGStream, 1); - str->type = GST_MPEG_DEMUX_AUDIO_MPEG; name = g_strdup_printf ("audio_%02d", stream_nr); @@ -435,19 +439,24 @@ mpeg_demux->audio_stream[stream_nr] = str; + /* new pad, set caps */ str = g_renew (GstMPEGStream, str, 1); - if (str->type != GST_MPEG_DEMUX_AUDIO_MPEG) { + if (set_caps) { caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1, NULL); - return str; Index: gstmpegparse.c RCS file: /cvs/gstreamer/gst-plugins/gst/mpegstream/gstmpegparse.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- gstmpegparse.c 21 May 2004 22:39:27 -0000 1.59 +++ gstmpegparse.c 26 Jul 2004 15:17:25 -0000 1.60 @@ -306,14 +306,20 @@ break; } - 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; |