audio: Add gst_audio_info_is_equal()

This commit is contained in:
Sebastian Dröge 2013-05-30 14:45:31 +02:00
parent 0693b78e86
commit 5065e76b1c
4 changed files with 40 additions and 0 deletions

View file

@ -115,6 +115,7 @@ gst_audio_info_copy
gst_audio_info_free
gst_audio_info_new
gst_audio_info_set_format
gst_audio_info_is_equal
gst_audio_format_build_integer
gst_audio_format_fill_silence

View file

@ -461,3 +461,38 @@ done:
return res;
}
/**
* gst_audio_info_is_equal:
* @info: a #GstAudioInfo
* @other: a #GstAudioInfo
*
* Compares two #GstAudioInfo and returns whether they are equal or not
*
* Returns: %TRUE if @info and @other are equal, else %FALSE.
*
* Since: 1.2
*
*/
gboolean
gst_audio_info_is_equal (const GstAudioInfo * info, const GstAudioInfo * other)
{
if (GST_AUDIO_INFO_FORMAT (info) != GST_AUDIO_INFO_FORMAT (other))
return FALSE;
if (GST_AUDIO_INFO_FLAGS (info) != GST_AUDIO_INFO_FLAGS (other))
return FALSE;
if (GST_AUDIO_INFO_LAYOUT (info) != GST_AUDIO_INFO_LAYOUT (other))
return FALSE;
if (GST_AUDIO_INFO_RATE (info) != GST_AUDIO_INFO_RATE (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 (memcmp (info->position, other->position,
GST_AUDIO_INFO_CHANNELS (info) * sizeof (GstAudioChannelPosition)) !=
0)
return FALSE;
return TRUE;
}

View file

@ -128,6 +128,9 @@ gboolean gst_audio_info_convert (const GstAudioInfo * info,
GstFormat src_fmt, gint64 src_val,
GstFormat dest_fmt, gint64 * dest_val);
gboolean gst_audio_info_is_equal (const GstAudioInfo *info,
const GstAudioInfo *other);
G_END_DECLS
#endif /* __GST_AUDIO_INFO_H__ */

View file

@ -118,6 +118,7 @@ EXPORTS
gst_audio_info_from_caps
gst_audio_info_get_type
gst_audio_info_init
gst_audio_info_is_equal
gst_audio_info_new
gst_audio_info_set_format
gst_audio_info_to_caps