mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 17:52:29 +00:00
audioencoder: Remove private copy of gst_audio_info_is_equal()
And improve the public one a bit based on it.
This commit is contained in:
parent
63961242df
commit
c06377b385
2 changed files with 7 additions and 22 deletions
|
@ -477,6 +477,10 @@ done:
|
||||||
gboolean
|
gboolean
|
||||||
gst_audio_info_is_equal (const GstAudioInfo * info, const GstAudioInfo * other)
|
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))
|
if (GST_AUDIO_INFO_FORMAT (info) != GST_AUDIO_INFO_FORMAT (other))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (GST_AUDIO_INFO_FLAGS (info) != GST_AUDIO_INFO_FLAGS (other))
|
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;
|
return FALSE;
|
||||||
if (GST_AUDIO_INFO_CHANNELS (info) != GST_AUDIO_INFO_CHANNELS (other))
|
if (GST_AUDIO_INFO_CHANNELS (info) != GST_AUDIO_INFO_CHANNELS (other))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (GST_AUDIO_INFO_BPF (info) != GST_AUDIO_INFO_BPF (other))
|
if (GST_AUDIO_INFO_CHANNELS (info) > 64)
|
||||||
return FALSE;
|
return TRUE;
|
||||||
if (memcmp (info->position, other->position,
|
if (memcmp (info->position, other->position,
|
||||||
GST_AUDIO_INFO_CHANNELS (info) * sizeof (GstAudioChannelPosition)) !=
|
GST_AUDIO_INFO_CHANNELS (info) * sizeof (GstAudioChannelPosition)) !=
|
||||||
0)
|
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
|
static gboolean
|
||||||
gst_audio_encoder_sink_setcaps (GstAudioEncoder * enc, GstCaps * caps)
|
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))
|
if (!gst_audio_info_from_caps (&state, caps))
|
||||||
goto refuse_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;
|
goto same_caps;
|
||||||
|
|
||||||
/* adjust ts tracking to new sample rate */
|
/* adjust ts tracking to new sample rate */
|
||||||
|
|
Loading…
Reference in a new issue