gst/audioconvert/audioconvert.c: Also make valgrind happy and avoid copying data in some cases.

Original commit message from CVS:
* gst/audioconvert/audioconvert.c: (float), (double), (float_hq),
(double_hq), (audio_convert_get_func_index), (check_default),
(audio_convert_prepare_context), (audio_convert_convert):
Also make valgrind happy and avoid copying data in some cases.
This commit is contained in:
Stefan Kost 2007-02-28 12:08:27 +00:00
parent e1566885fa
commit 14cd6e6ae1
2 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2007-02-28 Stefan Kost <ensonic@users.sf.net>
* gst/audioconvert/audioconvert.c: (float), (double), (float_hq),
(double_hq), (audio_convert_get_func_index), (check_default),
(audio_convert_prepare_context), (audio_convert_convert):
Also make valgrind happy and avoid copying data in some cases.
2007-02-28 Stefan Kost <ensonic@users.sf.net>
* gst/audioconvert/audioconvert.c: (float), (double), (float_hq),

View file

@ -252,10 +252,14 @@ audio_convert_get_func_index (AudioConvertFmt * fmt)
}
static gboolean
check_default (AudioConvertFmt * fmt)
check_default (AudioConvertCtx * ctx, AudioConvertFmt * fmt)
{
return (fmt->width == 32 && fmt->depth == 32 &&
fmt->endianness == G_BYTE_ORDER && fmt->sign == TRUE);
if (ctx->in.is_int || ctx->out.is_int) {
return (fmt->width == 32 && fmt->depth == 32 &&
fmt->endianness == G_BYTE_ORDER && fmt->sign == TRUE);
} else {
return (fmt->width == 64);
}
}
gboolean
@ -312,11 +316,11 @@ audio_convert_prepare_context (AudioConvertCtx * ctx, AudioConvertFmt * in,
GST_INFO ("unitsizes: %d -> %d", in->unit_size, out->unit_size);
/* check if input is in default format */
ctx->in_default = check_default (in);
ctx->in_default = check_default (ctx, in);
/* check if channel mixer is passthrough */
ctx->mix_passthrough = gst_channel_mix_passthrough (ctx);
/* check if output is in default format */
ctx->out_default = check_default (out);
ctx->out_default = check_default (ctx, out);
GST_INFO ("in default %d, mix passthrough %d, out default %d",
ctx->in_default, ctx->mix_passthrough, ctx->out_default);