diff options
author | Yves Lefebvre <ivanohe@abacom.com> | 2009-01-08 08:19:25 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2009-01-08 08:19:25 +0000 |
commit | f4567b2c7c6aac0b7895717adce522c19433ade2 (patch) | |
tree | 54fde19ec49ca3c23ca56997b6e98f369d78e150 | |
parent | 488fb36616667520416148b170f2f323527a80ae (diff) |
gst/mpegstream/: Fix some caps leaks. Fixes bug #564885.GIT_CONVERSION
Original commit message from CVS:
Patch by: Yves Lefebvre <ivanohe at abacom dot com>
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_video_stream),
(gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_reset):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream), (gst_mpeg_demux_reset):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_chain):
Fix some caps leaks. Fixes bug #564885.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | gst/mpegstream/gstdvddemux.c | 20 | ||||
-rw-r--r-- | gst/mpegstream/gstmpegdemux.c | 11 | ||||
-rw-r--r-- | gst/mpegstream/gstmpegparse.c | 13 |
4 files changed, 47 insertions, 10 deletions
@@ -1,3 +1,16 @@ +2009-01-08 Sebastian Dröge <sebastian.droege@collabora.co.uk> + + Patch by: Yves Lefebvre <ivanohe at abacom dot com> + + * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_video_stream), + (gst_dvd_demux_get_audio_stream), + (gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_reset): + * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_init_stream), + (gst_mpeg_demux_get_video_stream), + (gst_mpeg_demux_get_audio_stream), (gst_mpeg_demux_reset): + * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_chain): + Fix some caps leaks. Fixes bug #564885. + 2009-01-02 Alessandro Decina <alessandro.d@gmail.com> * ext/cdio/gstcdio.c: diff --git a/gst/mpegstream/gstdvddemux.c b/gst/mpegstream/gstdvddemux.c index 0878fbcc..e2561382 100644 --- a/gst/mpegstream/gstdvddemux.c +++ b/gst/mpegstream/gstdvddemux.c @@ -474,6 +474,8 @@ gst_dvd_demux_get_video_stream (GstMPEGDemux * mpeg_demux, gint mpeg_version = *((gint *) info); if (dvd_demux->mpeg_version != mpeg_version) { + if (str->caps) + gst_caps_unref (str->caps); str->caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, mpeg_version, "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); @@ -593,6 +595,8 @@ gst_dvd_demux_get_audio_stream (GstMPEGDemux * mpeg_demux, /* Determine the number of channels. */ channels = ((sample_info >> 8) & 0x7) + 1; + if (str->caps) + gst_caps_unref (str->caps); str->caps = gst_caps_new_simple ("audio/x-lpcm", "width", G_TYPE_INT, width, "rate", G_TYPE_INT, rate, @@ -612,11 +616,15 @@ gst_dvd_demux_get_audio_stream (GstMPEGDemux * mpeg_demux, break; case GST_DVD_DEMUX_AUDIO_AC3: + if (str->caps) + gst_caps_unref (str->caps); str->caps = gst_caps_new_simple ("audio/x-ac3", NULL); codec = "AC-3 audio"; break; case GST_DVD_DEMUX_AUDIO_DTS: + if (str->caps) + gst_caps_unref (str->caps); str->caps = gst_caps_new_simple ("audio/x-dts", NULL); codec = "DTS audio"; break; @@ -650,8 +658,8 @@ gst_dvd_demux_get_audio_stream (GstMPEGDemux * mpeg_demux, t = g_strdup_printf ("audio-%d-language", stream_nr); lang_code = - gst_structure_get_string (gst_event_get_structure (dvd_demux-> - langcodes), t); + gst_structure_get_string (gst_event_get_structure + (dvd_demux->langcodes), t); g_free (t); } @@ -720,6 +728,8 @@ gst_dvd_demux_get_subpicture_stream (GstMPEGDemux * mpeg_demux, if (str->type != GST_DVD_DEMUX_SUBP_DVD) { /* We need to set new caps for this pad. */ + if (str->caps) + gst_caps_unref (str->caps); str->caps = gst_caps_new_simple ("video/x-dvd-subpicture", NULL); if (!gst_pad_set_caps (str->pad, str->caps)) { @@ -746,8 +756,8 @@ gst_dvd_demux_get_subpicture_stream (GstMPEGDemux * mpeg_demux, t = g_strdup_printf ("subtitle-%d-language", stream_nr); lang_code = - gst_structure_get_string (gst_event_get_structure (dvd_demux-> - langcodes), t); + gst_structure_get_string (gst_event_get_structure + (dvd_demux->langcodes), t); g_free (t); } @@ -1164,6 +1174,8 @@ gst_dvd_demux_reset (GstDVDDemux * dvd_demux) gst_element_remove_pad (GST_ELEMENT (dvd_demux), dvd_demux->subpicture_stream[i]->pad); + if (dvd_demux->subpicture_stream[i]->caps) + gst_caps_unref (dvd_demux->subpicture_stream[i]->caps); if (dvd_demux->subpicture_stream[i]->tags) gst_tag_list_free (dvd_demux->subpicture_stream[i]->tags); g_free (dvd_demux->subpicture_stream[i]); diff --git a/gst/mpegstream/gstmpegdemux.c b/gst/mpegstream/gstmpegdemux.c index 620d4ca4..b867807a 100644 --- a/gst/mpegstream/gstmpegdemux.c +++ b/gst/mpegstream/gstmpegdemux.c @@ -331,6 +331,7 @@ gst_mpeg_demux_init_stream (GstMPEGDemux * mpeg_demux, str->last_flow = GST_FLOW_OK; str->buffers_sent = 0; str->tags = NULL; + str->caps = NULL; } static GstMPEGStream * @@ -373,6 +374,8 @@ gst_mpeg_demux_get_video_stream (GstMPEGDemux * mpeg_demux, GstTagList *list; /* We need to set new caps for this pad. */ + if (str->caps) + gst_caps_unref (str->caps); str->caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, mpeg_version, "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); @@ -445,6 +448,8 @@ gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux, GstTagList *list; /* We need to set new caps for this pad. */ + if (str->caps) + gst_caps_unref (str->caps); str->caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1, NULL); if (!gst_pad_set_caps (str->pad, str->caps)) { @@ -1334,6 +1339,8 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux) gst_event_new_eos ()); gst_element_remove_pad (GST_ELEMENT (mpeg_demux), mpeg_demux->video_stream[i]->pad); + if (mpeg_demux->video_stream[i]->caps) + gst_caps_unref (mpeg_demux->video_stream[i]->caps); g_free (mpeg_demux->video_stream[i]); mpeg_demux->video_stream[i] = NULL; } @@ -1345,6 +1352,8 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux) mpeg_demux->audio_stream[i]->pad); if (mpeg_demux->audio_stream[i]->tags) gst_tag_list_free (mpeg_demux->audio_stream[i]->tags); + if (mpeg_demux->audio_stream[i]->caps) + gst_caps_unref (mpeg_demux->audio_stream[i]->caps); g_free (mpeg_demux->audio_stream[i]); mpeg_demux->audio_stream[i] = NULL; } @@ -1354,6 +1363,8 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux) gst_event_new_eos ()); gst_element_remove_pad (GST_ELEMENT (mpeg_demux), mpeg_demux->private_stream[i]->pad); + if (mpeg_demux->private_stream[i]->caps) + gst_caps_unref (mpeg_demux->private_stream[i]->caps); g_free (mpeg_demux->private_stream[i]); mpeg_demux->private_stream[i] = NULL; } diff --git a/gst/mpegstream/gstmpegparse.c b/gst/mpegstream/gstmpegparse.c index aa5c6146..83c64e9e 100644 --- a/gst/mpegstream/gstmpegparse.c +++ b/gst/mpegstream/gstmpegparse.c @@ -782,17 +782,18 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer) /* Make sure the output pad has proper capabilities. */ if (!GST_PAD_CAPS (mpeg_parse->sinkpad)) { gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize); - - if (!gst_pad_set_caps (mpeg_parse->sinkpad, - gst_caps_new_simple ("video/mpeg", - "mpegversion", G_TYPE_INT, (mpeg2 ? 2 : 1), - "systemstream", G_TYPE_BOOLEAN, TRUE, - "parsed", G_TYPE_BOOLEAN, TRUE, NULL)) < 0) { + GstCaps *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_caps (mpeg_parse->sinkpad, caps) < 0) { GST_ELEMENT_ERROR (mpeg_parse, CORE, NEGOTIATION, (NULL), (NULL)); gst_buffer_unref (buffer); result = GST_FLOW_ERROR; + gst_caps_unref (caps); break; } + gst_caps_unref (caps); } /* Send the buffer. */ |