From 623e8781ab124ccaed9bc84f498a11511740f665 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sat, 14 May 2011 17:27:30 +0530 Subject: [PATCH] baseaudiosink: Use g_str_equal() instead of strncmp() The strncmp is unnecessary anyway since one of the strings is a const string. --- gst-libs/gst/audio/gstringbuffer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c index 2a56bab15a..87df45b1c1 100644 --- a/gst-libs/gst/audio/gstringbuffer.c +++ b/gst-libs/gst/audio/gstringbuffer.c @@ -327,7 +327,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) /* we have to differentiate between int and float formats */ 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; const FormatDef *def; 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]; } } - } else if (!strncmp (mimetype, "audio/x-raw-float", 17)) { + } else if (g_str_equal (mimetype, "audio/x-raw-float")) { spec->type = GST_BUFTYPE_FLOAT; @@ -392,7 +392,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) } /* float silence is all zeros.. */ 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 */ if (!(gst_structure_get_int (structure, "rate", &spec->rate) && gst_structure_get_int (structure, "channels", &spec->channels))) @@ -404,7 +404,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) spec->depth = 8; for (i = 0; i < spec->channels; i++) 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 */ if (!(gst_structure_get_int (structure, "rate", &spec->rate) && gst_structure_get_int (structure, "channels", &spec->channels))) @@ -416,7 +416,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) spec->depth = 8; for (i = 0; i < spec->channels; i++) 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 */ if (!(gst_structure_get_int (structure, "rate", &spec->rate))) goto parse_error; @@ -426,7 +426,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) spec->width = 16; spec->depth = 16; 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 */ if (!(gst_structure_get_int (structure, "rate", &spec->rate))) goto parse_error; @@ -436,7 +436,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) spec->width = 16; spec->depth = 16; 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 */ if (!(gst_structure_get_int (structure, "rate", &spec->rate))) goto parse_error; @@ -446,7 +446,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) spec->width = 64; spec->depth = 64; 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 */ if (!(gst_structure_get_int (structure, "rate", &spec->rate))) goto parse_error; @@ -456,7 +456,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) spec->width = 16; spec->depth = 16; 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) && (i == 1 || i == 2)) { /* Now we know this is MPEG-1 or MPEG-2 (non AAC) */