baseaudiosink: Use g_str_equal() instead of strncmp()

The strncmp is unnecessary anyway since one of the strings is a const
string.
This commit is contained in:
Arun Raghavan 2011-05-14 17:27:30 +05:30
parent 824e643ec9
commit 623e8781ab

View file

@ -327,7 +327,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
/* we have to differentiate between int and float formats */ /* we have to differentiate between int and float formats */
mimetype = gst_structure_get_name (structure); mimetype = gst_structure_get_name (structure);
if (!strncmp (mimetype, "audio/x-raw-int", 15)) { if (g_str_equal (mimetype, "audio/x-raw-int")) {
gint endianness; gint endianness;
const FormatDef *def; const FormatDef *def;
gint j, bytes; gint j, bytes;
@ -367,7 +367,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
spec->silence_sample[i * bytes + j] = def->silence[j]; spec->silence_sample[i * bytes + j] = def->silence[j];
} }
} }
} else if (!strncmp (mimetype, "audio/x-raw-float", 17)) { } else if (g_str_equal (mimetype, "audio/x-raw-float")) {
spec->type = GST_BUFTYPE_FLOAT; spec->type = GST_BUFTYPE_FLOAT;
@ -392,7 +392,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
} }
/* float silence is all zeros.. */ /* float silence is all zeros.. */
memset (spec->silence_sample, 0, 32); memset (spec->silence_sample, 0, 32);
} else if (!strncmp (mimetype, "audio/x-alaw", 12)) { } else if (g_str_equal (mimetype, "audio/x-alaw")) {
/* extract the needed information from the cap */ /* extract the needed information from the cap */
if (!(gst_structure_get_int (structure, "rate", &spec->rate) && if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
gst_structure_get_int (structure, "channels", &spec->channels))) gst_structure_get_int (structure, "channels", &spec->channels)))
@ -404,7 +404,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
spec->depth = 8; spec->depth = 8;
for (i = 0; i < spec->channels; i++) for (i = 0; i < spec->channels; i++)
spec->silence_sample[i] = 0xd5; spec->silence_sample[i] = 0xd5;
} else if (!strncmp (mimetype, "audio/x-mulaw", 13)) { } else if (g_str_equal (mimetype, "audio/x-mulaw")) {
/* extract the needed information from the cap */ /* extract the needed information from the cap */
if (!(gst_structure_get_int (structure, "rate", &spec->rate) && if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
gst_structure_get_int (structure, "channels", &spec->channels))) gst_structure_get_int (structure, "channels", &spec->channels)))
@ -416,7 +416,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
spec->depth = 8; spec->depth = 8;
for (i = 0; i < spec->channels; i++) for (i = 0; i < spec->channels; i++)
spec->silence_sample[i] = 0xff; spec->silence_sample[i] = 0xff;
} else if (!strncmp (mimetype, "audio/x-iec958", 14)) { } else if (g_str_equal (mimetype, "audio/x-iec958")) {
/* extract the needed information from the cap */ /* extract the needed information from the cap */
if (!(gst_structure_get_int (structure, "rate", &spec->rate))) if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
goto parse_error; goto parse_error;
@ -426,7 +426,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
spec->width = 16; spec->width = 16;
spec->depth = 16; spec->depth = 16;
spec->channels = 2; spec->channels = 2;
} else if (!strncmp (mimetype, "audio/x-ac3", 11)) { } else if (g_str_equal (mimetype, "audio/x-ac3")) {
/* extract the needed information from the cap */ /* extract the needed information from the cap */
if (!(gst_structure_get_int (structure, "rate", &spec->rate))) if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
goto parse_error; goto parse_error;
@ -436,7 +436,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
spec->width = 16; spec->width = 16;
spec->depth = 16; spec->depth = 16;
spec->channels = 2; spec->channels = 2;
} else if (!strncmp (mimetype, "audio/x-eac3", 12)) { } else if (g_str_equal (mimetype, "audio/x-eac3")) {
/* extract the needed information from the cap */ /* extract the needed information from the cap */
if (!(gst_structure_get_int (structure, "rate", &spec->rate))) if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
goto parse_error; goto parse_error;
@ -446,7 +446,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
spec->width = 64; spec->width = 64;
spec->depth = 64; spec->depth = 64;
spec->channels = 2; spec->channels = 2;
} else if (!strncmp (mimetype, "audio/x-dts", 11)) { } else if (g_str_equal (mimetype, "audio/x-dts")) {
/* extract the needed information from the cap */ /* extract the needed information from the cap */
if (!(gst_structure_get_int (structure, "rate", &spec->rate))) if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
goto parse_error; goto parse_error;
@ -456,7 +456,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
spec->width = 16; spec->width = 16;
spec->depth = 16; spec->depth = 16;
spec->channels = 2; spec->channels = 2;
} else if (!strncmp (mimetype, "audio/mpeg", 10) && } else if (g_str_equal (mimetype, "audio/mpeg") &&
gst_structure_get_int (structure, "mpegaudioversion", &i) && gst_structure_get_int (structure, "mpegaudioversion", &i) &&
(i == 1 || i == 2)) { (i == 1 || i == 2)) {
/* Now we know this is MPEG-1 or MPEG-2 (non AAC) */ /* Now we know this is MPEG-1 or MPEG-2 (non AAC) */