mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-11 02:24:13 +00:00
sys/oss/gstosssrc.c: Set bytes_per_sample correctly (is not always 4, but depends on width and number of channels).
Original commit message from CVS: * sys/oss/gstosssrc.c: (gst_oss_src_prepare): Set bytes_per_sample correctly (is not always 4, but depends on width and number of channels).
This commit is contained in:
parent
2042e06dd4
commit
0e01f91dc1
2 changed files with 18 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2005-10-24 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* sys/oss/gstosssrc.c: (gst_oss_src_prepare):
|
||||
Set bytes_per_sample correctly (is not always 4, but
|
||||
depends on width and number of channels).
|
||||
|
||||
2005-10-24 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* ext/flac/gstflacenc.c: (gst_flacenc_base_init),
|
||||
|
|
|
@ -389,8 +389,12 @@ gst_oss_src_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
|||
|
||||
spec->segsize = info.fragsize;
|
||||
spec->segtotal = info.fragstotal;
|
||||
spec->bytes_per_sample = 4;
|
||||
oss->bytes_per_sample = 4;
|
||||
|
||||
if (spec->width != 16 && spec->width != 8)
|
||||
goto dodgy_width;
|
||||
|
||||
spec->bytes_per_sample = (spec->width / 8) * spec->channels;
|
||||
oss->bytes_per_sample = (spec->width / 8) * spec->channels;
|
||||
memset (spec->silence_sample, 0, spec->bytes_per_sample);
|
||||
|
||||
GST_DEBUG ("got segsize: %d, segtotal: %d, value: %08x", spec->segsize,
|
||||
|
@ -411,6 +415,12 @@ wrong_format:
|
|||
("Unable to get format %d", spec->format), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
dodgy_width:
|
||||
{
|
||||
GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
|
||||
("Unexpected width %d", spec->width), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue