summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-10-27 15:16:50 (GMT)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-12-08 15:06:30 (GMT)
commit8e91b3b3c516e41174f27d40690c7416802f9e4f (patch)
tree5df11fe8c658e920e7100fe6fa637782810bcb75
parenteccffea36909702c66eaed2e5bf5abfe24c33e2d (diff)
downloadgst-plugins-bad-8e91b3b3c516e41174f27d40690c7416802f9e4f.tar.gz
gst-plugins-bad-8e91b3b3c516e41174f27d40690c7416802f9e4f.tar.xz
ac3parse: improve src caps settings
-rw-r--r--gst/audioparsers/gstac3parse.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c
index 4b74a52..c497fea 100644
--- a/gst/audioparsers/gstac3parse.c
+++ b/gst/audioparsers/gstac3parse.c
@@ -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;