mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
audio: Move fill_silence into audio_format_info
With the function named gst_audio_format_fill_silence it would get associated to the GstAudioFormat type in .gir which is incorrect and confusing. See [1] for the discussion sparking this change. https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/630#note_694795 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/940>
This commit is contained in:
parent
c1f91ba004
commit
3ec795f613
11 changed files with 38 additions and 14 deletions
|
@ -478,7 +478,7 @@ do_unpack (AudioChain * chain, gpointer user_data)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < chain->blocks; i++) {
|
for (i = 0; i < chain->blocks; i++) {
|
||||||
gst_audio_format_fill_silence (chain->finfo, tmp[i],
|
gst_audio_format_info_fill_silence (chain->finfo, tmp[i],
|
||||||
num_samples * chain->inc);
|
num_samples * chain->inc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1102,7 +1102,7 @@ converter_passthrough (GstAudioConverter * convert,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < chain->blocks; i++)
|
for (i = 0; i < chain->blocks; i++)
|
||||||
gst_audio_format_fill_silence (convert->in.finfo, out[i], samples);
|
gst_audio_format_info_fill_silence (convert->in.finfo, out[i], samples);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1248,7 @@ converter_endian (GstAudioConverter * convert,
|
||||||
convert->swap_endian (out[i], in[i], samples);
|
convert->swap_endian (out[i], in[i], samples);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < chain->blocks; i++)
|
for (i = 0; i < chain->blocks; i++)
|
||||||
gst_audio_format_fill_silence (convert->in.finfo, out[i], samples);
|
gst_audio_format_info_fill_silence (convert->in.finfo, out[i], samples);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,10 +459,30 @@ gst_audio_format_get_info (GstAudioFormat format)
|
||||||
* @length: the length to fill
|
* @length: the length to fill
|
||||||
*
|
*
|
||||||
* Fill @length bytes in @dest with silence samples for @info.
|
* Fill @length bytes in @dest with silence samples for @info.
|
||||||
|
*
|
||||||
|
* Deprecated: 1.20: Use gst_audio_format_info_fill_silence() instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_audio_format_fill_silence (const GstAudioFormatInfo * info,
|
gst_audio_format_fill_silence (const GstAudioFormatInfo * info,
|
||||||
gpointer dest, gsize length)
|
gpointer dest, gsize length)
|
||||||
|
{
|
||||||
|
gst_audio_format_info_fill_silence (info, dest, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_audio_format_info_fill_silence:
|
||||||
|
* @info: a #GstAudioFormatInfo
|
||||||
|
* @dest: (array length=length) (element-type guint8): a destination
|
||||||
|
* to fill
|
||||||
|
* @length: the length to fill
|
||||||
|
*
|
||||||
|
* Fill @length bytes in @dest with silence samples for @info.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_audio_format_info_fill_silence (const GstAudioFormatInfo * info,
|
||||||
|
gpointer dest, gsize length)
|
||||||
{
|
{
|
||||||
guint8 *dptr = dest;
|
guint8 *dptr = dest;
|
||||||
|
|
||||||
|
|
|
@ -286,8 +286,11 @@ const GstAudioFormatInfo *
|
||||||
gst_audio_format_get_info (GstAudioFormat format) G_GNUC_CONST;
|
gst_audio_format_get_info (GstAudioFormat format) G_GNUC_CONST;
|
||||||
|
|
||||||
GST_AUDIO_API
|
GST_AUDIO_API
|
||||||
void gst_audio_format_fill_silence (const GstAudioFormatInfo *info,
|
void gst_audio_format_info_fill_silence (const GstAudioFormatInfo *info,
|
||||||
gpointer dest, gsize length);
|
gpointer dest, gsize length);
|
||||||
|
GST_AUDIO_API G_DEPRECATED_FOR(gst_audio_format_info_fill_silence)
|
||||||
|
void gst_audio_format_fill_silence (const GstAudioFormatInfo *info,
|
||||||
|
gpointer dest, gsize length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_AUDIO_RATE_RANGE:
|
* GST_AUDIO_RATE_RANGE:
|
||||||
|
|
|
@ -1870,7 +1870,8 @@ gst_audio_aggregator_create_output_buffer (GstAudioAggregator * aagg,
|
||||||
gst_object_unref (allocator);
|
gst_object_unref (allocator);
|
||||||
|
|
||||||
gst_buffer_map (outbuf, &outmap, GST_MAP_WRITE);
|
gst_buffer_map (outbuf, &outmap, GST_MAP_WRITE);
|
||||||
gst_audio_format_fill_silence (srcpad->info.finfo, outmap.data, outmap.size);
|
gst_audio_format_info_fill_silence (srcpad->info.finfo, outmap.data,
|
||||||
|
outmap.size);
|
||||||
gst_buffer_unmap (outbuf, &outmap);
|
gst_buffer_unmap (outbuf, &outmap);
|
||||||
|
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
|
@ -656,7 +656,7 @@ gst_audio_ring_buffer_acquire (GstAudioRingBuffer * buf,
|
||||||
buf->empty_seg = g_malloc (segsize);
|
buf->empty_seg = g_malloc (segsize);
|
||||||
|
|
||||||
if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) {
|
if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) {
|
||||||
gst_audio_format_fill_silence (buf->spec.info.finfo, buf->empty_seg,
|
gst_audio_format_info_fill_silence (buf->spec.info.finfo, buf->empty_seg,
|
||||||
segsize);
|
segsize);
|
||||||
} else {
|
} else {
|
||||||
/* FIXME, non-raw formats get 0 as the empty sample */
|
/* FIXME, non-raw formats get 0 as the empty sample */
|
||||||
|
|
|
@ -414,7 +414,7 @@ gst_audio_sink_ring_buffer_acquire (GstAudioRingBuffer * buf,
|
||||||
buf->memory = g_malloc (buf->size);
|
buf->memory = g_malloc (buf->size);
|
||||||
|
|
||||||
if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) {
|
if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) {
|
||||||
gst_audio_format_fill_silence (buf->spec.info.finfo, buf->memory,
|
gst_audio_format_info_fill_silence (buf->spec.info.finfo, buf->memory,
|
||||||
buf->size);
|
buf->size);
|
||||||
} else {
|
} else {
|
||||||
/* FIXME, non-raw formats get 0 as the empty sample */
|
/* FIXME, non-raw formats get 0 as the empty sample */
|
||||||
|
|
|
@ -384,7 +384,7 @@ gst_audio_src_ring_buffer_acquire (GstAudioRingBuffer * buf,
|
||||||
buf->size = spec->segtotal * spec->segsize;
|
buf->size = spec->segtotal * spec->segsize;
|
||||||
buf->memory = g_malloc (buf->size);
|
buf->memory = g_malloc (buf->size);
|
||||||
if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) {
|
if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) {
|
||||||
gst_audio_format_fill_silence (buf->spec.info.finfo, buf->memory,
|
gst_audio_format_info_fill_silence (buf->spec.info.finfo, buf->memory,
|
||||||
buf->size);
|
buf->size);
|
||||||
} else {
|
} else {
|
||||||
/* FIXME, non-raw formats get 0 as the empty sample */
|
/* FIXME, non-raw formats get 0 as the empty sample */
|
||||||
|
|
|
@ -1424,7 +1424,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
/* Means we had all pads muted, create some silence */
|
/* Means we had all pads muted, create some silence */
|
||||||
outbuf = gst_buffer_new_allocate (NULL, outsize, NULL);
|
outbuf = gst_buffer_new_allocate (NULL, outsize, NULL);
|
||||||
gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
|
gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
|
||||||
gst_audio_format_fill_silence (adder->info.finfo, map.data, outsize);
|
gst_audio_format_info_fill_silence (adder->info.finfo, map.data, outsize);
|
||||||
gst_buffer_unmap (outbuf, &map);
|
gst_buffer_unmap (outbuf, &map);
|
||||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -849,8 +849,8 @@ gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
||||||
/* Create silence buffer */
|
/* Create silence buffer */
|
||||||
gint i;
|
gint i;
|
||||||
for (i = 0; i < dstabuf.n_planes; i++) {
|
for (i = 0; i < dstabuf.n_planes; i++) {
|
||||||
gst_audio_format_fill_silence (this->out_info.finfo, dstabuf.planes[i],
|
gst_audio_format_info_fill_silence (this->out_info.finfo,
|
||||||
GST_AUDIO_BUFFER_PLANE_SIZE (&dstabuf));
|
dstabuf.planes[i], GST_AUDIO_BUFFER_PLANE_SIZE (&dstabuf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
|
|
|
@ -559,7 +559,7 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
fill = gst_buffer_new_and_alloc (fillsize);
|
fill = gst_buffer_new_and_alloc (fillsize);
|
||||||
|
|
||||||
gst_buffer_map (fill, &fillmap, GST_MAP_WRITE);
|
gst_buffer_map (fill, &fillmap, GST_MAP_WRITE);
|
||||||
gst_audio_format_fill_silence (audiorate->info.finfo, fillmap.data,
|
gst_audio_format_info_fill_silence (audiorate->info.finfo, fillmap.data,
|
||||||
fillmap.size);
|
fillmap.size);
|
||||||
gst_buffer_unmap (fill, &fillmap);
|
gst_buffer_unmap (fill, &fillmap);
|
||||||
|
|
||||||
|
|
|
@ -926,7 +926,7 @@ GST_START_TEST (test_fill_silence)
|
||||||
for (f = GST_AUDIO_FORMAT_S8; f < GST_AUDIO_FORMAT_F64; f++) {
|
for (f = GST_AUDIO_FORMAT_S8; f < GST_AUDIO_FORMAT_F64; f++) {
|
||||||
gst_audio_info_set_format (&info, f, 48000, 1, NULL);
|
gst_audio_info_set_format (&info, f, 48000, 1, NULL);
|
||||||
|
|
||||||
gst_audio_format_fill_silence (info.finfo, test_silence,
|
gst_audio_format_info_fill_silence (info.finfo, test_silence,
|
||||||
GST_AUDIO_INFO_BPF (&info) * 4);
|
GST_AUDIO_INFO_BPF (&info) * 4);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
|
Loading…
Reference in a new issue