Commit c06377b3 authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

audioencoder: Remove private copy of gst_audio_info_is_equal()

And improve the public one a bit based on it.
parent 63961242
......@@ -477,6 +477,10 @@ done:
gboolean
gst_audio_info_is_equal (const GstAudioInfo * info, const GstAudioInfo * other)
{
if (info == other)
return TRUE;
if (info->finfo == NULL || other->finfo == NULL)
return FALSE;
if (GST_AUDIO_INFO_FORMAT (info) != GST_AUDIO_INFO_FORMAT (other))
return FALSE;
if (GST_AUDIO_INFO_FLAGS (info) != GST_AUDIO_INFO_FLAGS (other))
......@@ -487,8 +491,8 @@ gst_audio_info_is_equal (const GstAudioInfo * info, const GstAudioInfo * other)
return FALSE;
if (GST_AUDIO_INFO_CHANNELS (info) != GST_AUDIO_INFO_CHANNELS (other))
return FALSE;
if (GST_AUDIO_INFO_BPF (info) != GST_AUDIO_INFO_BPF (other))
return FALSE;
if (GST_AUDIO_INFO_CHANNELS (info) > 64)
return TRUE;
if (memcmp (info->position, other->position,
GST_AUDIO_INFO_CHANNELS (info) * sizeof (GstAudioChannelPosition)) !=
0)
......
......@@ -1217,25 +1217,6 @@ wrong_buffer:
}
}
static gboolean
audio_info_is_equal (GstAudioInfo * from, GstAudioInfo * to)
{
if (from == to)
return TRUE;
if (from->finfo == NULL || to->finfo == NULL)
return FALSE;
if (GST_AUDIO_INFO_FORMAT (from) != GST_AUDIO_INFO_FORMAT (to))
return FALSE;
if (GST_AUDIO_INFO_RATE (from) != GST_AUDIO_INFO_RATE (to))
return FALSE;
if (GST_AUDIO_INFO_CHANNELS (from) != GST_AUDIO_INFO_CHANNELS (to))
return FALSE;
if (GST_AUDIO_INFO_CHANNELS (from) > 64)
return TRUE;
return (memcmp (from->position, to->position,
GST_AUDIO_INFO_CHANNELS (from) * sizeof (to->position[0])) == 0);
}
static gboolean
gst_audio_encoder_sink_setcaps (GstAudioEncoder * enc, GstCaps * caps)
{
......@@ -1268,7 +1249,7 @@ gst_audio_encoder_sink_setcaps (GstAudioEncoder * enc, GstCaps * caps)
if (!gst_audio_info_from_caps (&state, caps))
goto refuse_caps;
if (enc->priv->ctx.input_caps && audio_info_is_equal (&state, &ctx->info))
if (enc->priv->ctx.input_caps && gst_audio_info_is_equal (&state, &ctx->info))
goto same_caps;
/* adjust ts tracking to new sample rate */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment