diff options
author | Rene Stadler <mail@renestadler.de> | 2008-03-24 12:32:59 +0000 |
---|---|---|
committer | Rene Stadler <mail@renestadler.de> | 2008-03-24 12:32:59 +0000 |
commit | fe1f183340452ee6d65e667ce1c8b3ee58aaec32 (patch) | |
tree | 372746cf6c2e92ae4f06f32a1a94ed8287f15be0 /gst/replaygain | |
parent | cc2d5bd32b8db721e15aa4fa62cdc4852d233351 (diff) | |
download | gst-plugins-bad-fe1f183340452ee6d65e667ce1c8b3ee58aaec32.tar.gz gst-plugins-bad-fe1f183340452ee6d65e667ce1c8b3ee58aaec32.tar.bz2 gst-plugins-bad-fe1f183340452ee6d65e667ce1c8b3ee58aaec32.zip |
Make rganalysis and rglimiter elements GAP-flag aware.
Original commit message from CVS:
* gst/replaygain/gstrganalysis.c (gst_rg_analysis_init),
(gst_rg_analysis_transform_ip):
* gst/replaygain/gstrglimiter.c (gst_rg_limiter_init),
(gst_rg_limiter_transform_ip):
Make rganalysis and rglimiter elements GAP-flag aware.
* tests/check/elements/rganalysis.c: (test_gap_buffers),
(rganalysis_suite):
* tests/check/elements/rglimiter.c (test_gap), (rglimiter_suite):
Add tests to verify gap-awareness.
Diffstat (limited to 'gst/replaygain')
-rw-r--r-- | gst/replaygain/gstrganalysis.c | 8 | ||||
-rw-r--r-- | gst/replaygain/gstrglimiter.c | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gst/replaygain/gstrganalysis.c b/gst/replaygain/gstrganalysis.c index 24367786..613c0876 100644 --- a/gst/replaygain/gstrganalysis.c +++ b/gst/replaygain/gstrganalysis.c @@ -288,6 +288,10 @@ gst_rg_analysis_class_init (GstRgAnalysisClass * klass) static void gst_rg_analysis_init (GstRgAnalysis * filter, GstRgAnalysisClass * gclass) { + GstBaseTransform *base = GST_BASE_TRANSFORM (filter); + + gst_base_transform_set_gap_aware (base, TRUE); + filter->num_tracks = 0; filter->forced = FORCED_DEFAULT; filter->reference_level = RG_REFERENCE_LEVEL; @@ -452,6 +456,10 @@ gst_rg_analysis_transform_ip (GstBaseTransform * base, GstBuffer * buf) if (filter->skip) return GST_FLOW_OK; + /* Buffers made up of silence have no influence on the analysis: */ + if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)) + return GST_FLOW_OK; + GST_LOG_OBJECT (filter, "processing buffer of size %u", GST_BUFFER_SIZE (buf)); diff --git a/gst/replaygain/gstrglimiter.c b/gst/replaygain/gstrglimiter.c index 609db3d7..d474b26e 100644 --- a/gst/replaygain/gstrglimiter.c +++ b/gst/replaygain/gstrglimiter.c @@ -129,8 +129,12 @@ gst_rg_limiter_class_init (GstRgLimiterClass * klass) static void gst_rg_limiter_init (GstRgLimiter * filter, GstRgLimiterClass * gclass) { + GstBaseTransform *base = GST_BASE_TRANSFORM (filter); + + gst_base_transform_set_passthrough (base, FALSE); + gst_base_transform_set_gap_aware (base, TRUE); + filter->enabled = TRUE; - gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), FALSE); } static void @@ -182,6 +186,9 @@ gst_rg_limiter_transform_ip (GstBaseTransform * base, GstBuffer * buf) if (!filter->enabled) return GST_FLOW_OK; + if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)) + return GST_FLOW_OK; + input = (gfloat *) GST_BUFFER_DATA (buf); count = GST_BUFFER_SIZE (buf) / sizeof (gfloat); |