ac3parse: improve src caps settings

This commit is contained in:
Mark Nauwelaerts 2009-10-27 16:16:50 +01:00
parent eccffea369
commit 8e91b3b3c5

View file

@ -411,12 +411,17 @@ gst_ac3_parse_parse_frame (GstBaseParse * parse, GstBuffer * buf)
goto broken_header;
GST_LOG_OBJECT (parse, "size: %u, rate: %u, chans: %u", fsize, rate, chans);
{
GstCaps *caps = gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT,
rate, "channels", G_TYPE_INT, chans, NULL);
if (G_UNLIKELY (ac3parse->sample_rate != rate || ac3parse->channels != chans)) {
GstCaps *caps = gst_caps_new_simple ("audio/x-ac3",
"framed", G_TYPE_BOOLEAN, TRUE, "rate", G_TYPE_INT, rate,
"channels", G_TYPE_INT, chans, NULL);
gst_buffer_set_caps (buf, caps);
gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps);
gst_caps_unref (caps);
ac3parse->sample_rate = rate;
ac3parse->channels = chans;
}
return GST_FLOW_OK;