[MPlayer-dev-eng] [PATCH] Remove use of strings.h header, use avutil/avstring.h instead.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jan 21 21:46:45 EET 2021


The functions in strings.h are locale-dependent which
we do not want them to be.
In addition the header is only part of POSIX and not
the C standard so it is annoying for porting.
The main reason to look into it was testing the option
of compiling with MSVC to allow a Windows-on-Arm port.
However for that a compatibility wrapper would work
as well.
---
 asxparser.c                    | 28 ++++++-------
 bstr.c                         |  6 +--
 command.c                      |  3 +-
 gui/dialog/fileselect.c        |  4 +-
 gui/dialog/menu.c              |  3 +-
 gui/dialog/preferences.c       | 12 +++---
 gui/win32/skinload.c           |  4 +-
 input/input.c                  |  7 ++--
 libaf/format.c                 |  4 +-
 libao2/ao_oss.c                |  4 +-
 libass/ass.c                   | 42 +++++++++----------
 libass/ass_font.c              |  4 +-
 libass/ass_fontconfig.c        |  8 ++--
 libass/ass_utils.c             | 24 +++++------
 libmenu/menu.c                 | 12 +++---
 libmenu/menu_filesel.c         |  3 +-
 libmenu/menu_param.c           |  9 ++--
 libmpcodecs/ad_libvorbis.c     |  4 +-
 libmpcodecs/ae_toolame.c       |  8 ++--
 libmpcodecs/ae_twolame.c       |  8 ++--
 libmpcodecs/vd_ffmpeg.c        | 14 +++----
 libmpcodecs/vd_zrmjpeg.c       |  4 +-
 libmpcodecs/ve_lavc.c          | 60 +++++++++++++--------------
 libmpcodecs/ve_x264.c          | 14 +++----
 libmpcodecs/ve_xvid4.c         | 16 ++++----
 libmpcodecs/vf_palette.c       | 18 ++++----
 libmpcodecs/vf_zrmjpeg.c       | 28 ++++++-------
 libmpdemux/demux_audio.c       | 15 ++++---
 libmpdemux/demux_mf.c          |  4 +-
 libmpdemux/demux_ogg.c         | 10 ++---
 libmpdemux/demux_viv.c         |  6 +--
 libmpdemux/demuxer.c           |  5 +--
 libmpdemux/extension.c         |  4 +-
 libmpdemux/muxer_mpeg.c        | 16 ++++----
 libvo/vo_aa.c                  | 12 +++---
 libvo/vo_dfbmga.c              | 18 ++++----
 libvo/vo_dxr2.c                |  4 +-
 libvo/vo_dxr3.c                | 14 +++----
 libvo/vo_matrixview.c          | 11 ++---
 libvo/vo_vdpau.c               | 18 ++++----
 libvo/vo_xvr100.c              |  1 -
 libvo/vo_zr.c                  | 48 +++++++++++-----------
 libvo/vosub_vidix.c            | 18 ++++----
 libvo/x11_common.c             | 42 +++++++++----------
 loader/dshow/DS_VideoDecoder.c | 34 +++++++--------
 loader/ext.c                   |  4 +-
 loader/win32.c                 | 35 ++++++++--------
 loader/wine/winestring.h       |  3 +-
 m_config.c                     |  6 +--
 m_option.c                     | 75 +++++++++++++++++-----------------
 m_struct.c                     |  4 +-
 mencoder.c                     | 10 ++---
 mp_msg.c                       |  8 ++--
 mplayer.c                      |  3 +-
 osdep/priority.c               |  4 +-
 parser-mpcmd.c                 | 13 +++---
 playtree.c                     |  4 +-
 playtreeparser.c               | 42 +++++++++----------
 stream/asf_streaming.c         | 42 +++++++++----------
 stream/http.c                  | 18 ++++----
 stream/librtsp/rtsp.c          | 12 +++---
 stream/network.c               | 10 ++---
 stream/stream.c                |  4 +-
 stream/stream_bd.c             |  3 +-
 stream/stream_dvd.c            |  6 +--
 stream/stream_pvr.c            |  7 ++--
 stream/tv.c                    | 25 ++++++------
 stream/tvi_dshow.c             |  4 +-
 stream/tvi_v4l.c               |  8 ++--
 stream/tvi_v4l2.c              |  4 +-
 stream/url.c                   |  8 ++--
 sub/font_load.c                |  4 +-
 sub/font_load_ft.c             |  4 +-
 sub/spudec.c                   |  4 +-
 sub/subassconvert.c            |  4 +-
 sub/subreader.c                | 19 ++++-----
 sub/vobsub.c                   |  4 +-
 subopt-helper.c                |  6 +--
 udp_sync.c                     |  1 -
 79 files changed, 513 insertions(+), 526 deletions(-)

diff --git a/asxparser.c b/asxparser.c
index a4ee2c3fd..c53381c7f 100644
--- a/asxparser.c
+++ b/asxparser.c
@@ -22,9 +22,9 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>

+#include "libavutil/avstring.h"
 #include "playtree.h"
 #include "playtreeparser.h"
 #include "stream/stream.h"
@@ -56,7 +56,7 @@ asx_get_attrib(const char* attrib,char** attribs) {

   if(attrib == NULL || attribs == NULL) return NULL;
   for(ptr = attribs; ptr[0] != NULL; ptr += 2){
-    if(strcasecmp(ptr[0],attrib) == 0)
+    if(av_strcasecmp(ptr[0],attrib) == 0)
       return strdup(ptr[1]);
   }
   return NULL;
@@ -69,7 +69,7 @@ asx_attrib_to_enum(const char* val,char** valid_vals) {

   if(valid_vals == NULL || val == NULL) return -2;
   for(ptr = valid_vals ; ptr[0] != NULL ; ptr++) {
-    if(strcasecmp(val,ptr[0]) == 0) return r;
+    if(av_strcasecmp(val,ptr[0]) == 0) return r;
     r++;
   }

@@ -323,11 +323,11 @@ asx_get_element(ASX_Parser_t* parser,char** _buffer,
         free(attribs);
         return -1;
       }
-      if(ptr4[1] != '/' && strncasecmp(element,ptr4+1,strlen(element)) == 0) {
+      if(ptr4[1] != '/' && av_strncasecmp(element,ptr4+1,strlen(element)) == 0) {
         in++;
         ptr4+=2;
         continue;
-      } else if(strncasecmp(element,ptr4+2,strlen(element)) == 0) { // Extract body
+      } else if(av_strncasecmp(element,ptr4+2,strlen(element)) == 0) { // Extract body
         if(in > 0) {
           in--;
           ptr4 += 2+strlen(element);
@@ -498,7 +498,7 @@ asx_parse_entry(ASX_Parser_t* parser,char* buffer,char** _attribs) {
     } else if (r == 0) { // No more element
       break;
     }
-    if(strcasecmp(element,"REF") == 0) {
+    if(av_strcasecmp(element,"REF") == 0) {
       asx_parse_ref(parser,attribs,ref);
       mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding element %s to entry\n",element);
       nref++;
@@ -547,28 +547,28 @@ asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) {
     } else if (r == 0) { // No more element
       break;
     }
-    if(strcasecmp(element,"ENTRY") == 0) {
+    if(av_strcasecmp(element,"ENTRY") == 0) {
        entry = asx_parse_entry(parser,body,attribs);
        if(entry) {
          if(!list) list =  entry;
          else play_tree_append_entry(list,entry);
          mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding element %s to repeat\n",element);
        }
-    } else if(strcasecmp(element,"ENTRYREF") == 0) {
+    } else if(av_strcasecmp(element,"ENTRYREF") == 0) {
        entry = asx_parse_entryref(parser,body,attribs);
        if(entry) {
          if(!list) list =  entry;
          else play_tree_append_entry(list,entry);
          mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding element %s to repeat\n",element);
        }
-     } else if(strcasecmp(element,"REPEAT") == 0) {
+     } else if(av_strcasecmp(element,"REPEAT") == 0) {
        entry = asx_parse_repeat(parser,body,attribs);
        if(entry) {
          if(!list) list =  entry;
          else play_tree_append_entry(list,entry);
          mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding element %s to repeat\n",element);
        }
-     } else if(strcasecmp(element,"PARAM") == 0) {
+     } else if(av_strcasecmp(element,"PARAM") == 0) {
        asx_parse_param(parser,attribs,repeat);
      } else
        mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Ignoring element %s\n",element);
@@ -610,7 +610,7 @@ asx_parser_build_tree(char* buffer,int deep) {
     return NULL;
   }

-  if(strcasecmp(element,"ASX") != 0) {
+  if(av_strcasecmp(element,"ASX") != 0) {
     mp_msg(MSGT_PLAYTREE,MSGL_ERR,"first element isn't ASX, it's %s\n",element);
     free(element);
     free(asx_body);
@@ -645,21 +645,21 @@ asx_parser_build_tree(char* buffer,int deep) {
      } else if (r == 0) { // No more element
        break;
      }
-     if(strcasecmp(element,"ENTRY") == 0) {
+     if(av_strcasecmp(element,"ENTRY") == 0) {
        entry = asx_parse_entry(parser,body,attribs);
        if(entry) {
          if(!list) list =  entry;
          else play_tree_append_entry(list,entry);
          mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding element %s to asx\n",element);
        }
-     } else if(strcasecmp(element,"ENTRYREF") == 0) {
+     } else if(av_strcasecmp(element,"ENTRYREF") == 0) {
        entry = asx_parse_entryref(parser,body,attribs);
        if(entry) {
          if(!list) list =  entry;
          else play_tree_append_entry(list,entry);
          mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding element %s to asx\n",element);
        }
-     } else if(strcasecmp(element,"REPEAT") == 0) {
+     } else if(av_strcasecmp(element,"REPEAT") == 0) {
        entry = asx_parse_repeat(parser,body,attribs);
        if(entry) {
          if(!list) list =  entry;
diff --git a/bstr.c b/bstr.c
index c0f623939..18bf6bfca 100644
--- a/bstr.c
+++ b/bstr.c
@@ -17,8 +17,8 @@
  */

 #include <string.h>
-#include <strings.h>
 #include <libavutil/avutil.h>
+#include "libavutil/avstring.h"
 #include <libavutil/common.h>

 #include "bstr.h"
@@ -38,9 +38,9 @@ int bstrcmp(struct bstr str1, struct bstr str2)
     return ret;
 }

-int bstrcasecmp(struct bstr str1, struct bstr str2)
+int bav_strcasecmp(struct bstr str1, struct bstr str2)
 {
-    int ret = strncasecmp(str1.start, str2.start, FFMIN(str1.len, str2.len));
+    int ret = av_strncasecmp(str1.start, str2.start, FFMIN(str1.len, str2.len));

     if (!ret) {
         if (str1.len == str2.len)
diff --git a/command.c b/command.c
index 4424eadd8..3432fe5df 100644
--- a/command.c
+++ b/command.c
@@ -22,7 +22,6 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>

 #include "config.h"
 #include "command.h"
@@ -3424,7 +3423,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)

                 for (i = 0; mp_dvdnav_bindings[i].name; i++)
                   if (cmd->args[0].v.s &&
-                      !strcasecmp (cmd->args[0].v.s,
+                      !av_strcasecmp (cmd->args[0].v.s,
                                    mp_dvdnav_bindings[i].name))
                     command = mp_dvdnav_bindings[i].cmd;

diff --git a/gui/dialog/fileselect.c b/gui/dialog/fileselect.c
index df2cc45dd..690c59272 100644
--- a/gui/dialog/fileselect.c
+++ b/gui/dialog/fileselect.c
@@ -19,7 +19,6 @@
 #include <glob.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <sys/stat.h>

@@ -54,6 +53,7 @@
 #include "mpcommon.h"
 #include "mplayer.h"
 #include "libavutil/common.h"
+#include "libavutil/avstring.h"
 #include "stream/stream.h"

 #ifdef __linux__
@@ -413,7 +413,7 @@ static void CheckDir(GtkWidget *list)

             if (ext || !fext[0]) {
                 for (j = 0; j < fn; j++) {
-                    if (fext[j] == NULL || strcasecmp(fext[j], ext) == 0) {
+                    if (fext[j] == NULL || av_strcasecmp(fext[j], ext) == 0) {
                         fs_get_pixmap(ext, &fpixmap, &fmask);
                         clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask);
                         break;
diff --git a/gui/dialog/menu.c b/gui/dialog/menu.c
index 73100b13d..8891989c4 100644
--- a/gui/dialog/menu.c
+++ b/gui/dialog/menu.c
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>

 #include "config.h"
 #include "help_mp.h"
@@ -396,7 +395,7 @@ static const char * GetLanguage( void *language, int type )
     else if ( p[3] != 0) return language;
   }
  for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ )
-  if ( type == GET_LANG_INT ? Languages[i].id == l : strncasecmp(Languages[i].id2, p, sizeof(Languages[i].id2)) == 0 ) return Languages[i].name;
+  if ( type == GET_LANG_INT ? Languages[i].id == l : av_strncasecmp(Languages[i].id2, p, sizeof(Languages[i].id2)) == 0 ) return Languages[i].name;
  return MSGTR_GUI_Unknown;
 }
 #undef lng
diff --git a/gui/dialog/preferences.c b/gui/dialog/preferences.c
index b0148d668..c7d7ee912 100644
--- a/gui/dialog/preferences.c
+++ b/gui/dialog/preferences.c
@@ -21,12 +21,12 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>

 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "help_mp.h"
 #include "mixer.h"
 #include "mpcommon.h"
@@ -856,7 +856,7 @@ static GtkWidget * CreatePreferences( void )
      CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment );

      if ( !listed )
-      if ( strcasecmp ( lEncoding[i].name, sub_cp ) == 0 ) listed=True;
+      if ( av_strcasecmp ( lEncoding[i].name, sub_cp ) == 0 ) listed=True;
     }
    }
    if ( !listed ) CBSubEncoding_items=g_list_insert( CBSubEncoding_items,sub_cp,1 );
@@ -945,7 +945,7 @@ static GtkWidget * CreatePreferences( void )
    int i, append, listed=(subtitle_font_encoding == NULL);
    for ( i=0;lEncoding[i].name;i++ )
    {
-    append=(strcasecmp( lEncoding[i].name,ENC_UNICODE ) == 0);
+    append=(av_strcasecmp( lEncoding[i].name,ENC_UNICODE ) == 0);
 #ifdef CONFIG_ICONV
     cd=iconv_open( "ucs-4",lEncoding[i].name );

@@ -960,7 +960,7 @@ static GtkWidget * CreatePreferences( void )
      CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment );

      if ( !listed )
-      if ( strcasecmp ( lEncoding[i].name, subtitle_font_encoding ) == 0 ) listed=True;
+      if ( av_strcasecmp ( lEncoding[i].name, subtitle_font_encoding ) == 0 ) listed=True;
     }
    }
    if ( !listed ) CBFontEncoding_items=g_list_insert( CBFontEncoding_items,subtitle_font_encoding,1 );
@@ -1326,7 +1326,7 @@ void ShowPreferences( void )
   {
    int i;
    for ( i=0;lEncoding[i].name;i++ )
-    if ( !strcasecmp( sub_cp,lEncoding[i].name ) ) break;
+    if ( !av_strcasecmp( sub_cp,lEncoding[i].name ) ) break;
    if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lEncoding[i].comment );
    else gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),sub_cp );
    gtk_widget_set_sensitive( CBSubUtf8,FALSE );
@@ -1347,7 +1347,7 @@ void ShowPreferences( void )
   int i;
   const char *s = (subtitle_font_encoding ? subtitle_font_encoding : ENC_UNICODE);
   for ( i=0;lEncoding[i].name;i++ )
-   if ( !strcasecmp( s,lEncoding[i].name ) ) break;
+   if ( !av_strcasecmp( s,lEncoding[i].name ) ) break;
   if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lEncoding[i].comment );
   else gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),s );
  }
diff --git a/gui/win32/skinload.c b/gui/win32/skinload.c
index 71dc54778..40fed386a 100644
--- a/gui/win32/skinload.c
+++ b/gui/win32/skinload.c
@@ -21,7 +21,6 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */

-#include <strings.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
@@ -32,6 +31,7 @@
 #include "help_mp.h"
 #include "cpudetect.h"
 #include "libswscale/swscale.h"
+#include "libavutil/avstring.h"
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
@@ -147,7 +147,7 @@ static image *pngRead(skin_t *skin, const char *fname)
     char *filename = NULL;
     FILE *fp;

-    if(!strcasecmp(fname, "NULL")) return 0;
+    if(!av_strcasecmp(fname, "NULL")) return 0;

     /* find filename in order file file.png */
     if(!(fp = fopen(fname, "rb")))
diff --git a/input/input.c b/input/input.c
index 206c820bb..e27bbefd7 100644
--- a/input/input.c
+++ b/input/input.c
@@ -20,7 +20,6 @@

 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
@@ -820,7 +819,7 @@ mp_input_parse_cmd(char* str) {
     return NULL;

   for(i=0; mp_cmds[i].name[0]; i++) {
-    if(strncasecmp(mp_cmds[i].name,str,l) == 0)
+    if(av_strncasecmp(mp_cmds[i].name,str,l) == 0)
       break;
   }

@@ -1488,11 +1487,11 @@ mp_input_get_key_from_name(const char *name) {
   if(len == 1) { // Direct key code
     ret = (unsigned char)name[0];
     return ret;
-  } else if(len > 2 && strncasecmp("0x",name,2) == 0)
+  } else if(len > 2 && av_strncasecmp("0x",name,2) == 0)
     return strtol(name,NULL,16);

   for(i = 0; key_names[i].name[0]; i++) {
-    if(strcasecmp(key_names[i].name,name) == 0)
+    if(av_strcasecmp(key_names[i].name,name) == 0)
       return key_names[i].key;
   }

diff --git a/libaf/format.c b/libaf/format.c
index a05f540f2..a57d471a5 100644
--- a/libaf/format.c
+++ b/libaf/format.c
@@ -21,11 +21,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <inttypes.h>
 #include <limits.h>

 #include "af.h"
+#include "libavutil/avstring.h"
 #include "help_mp.h"

 // Convert from string to format
@@ -215,7 +215,7 @@ int af_str2fmt_short(const char* str)
     int i;

     for (i = 0; af_fmtstr_table[i].name; i++)
-	if (!strcasecmp(str, af_fmtstr_table[i].name))
+	if (!av_strcasecmp(str, af_fmtstr_table[i].name))
 	    return af_fmtstr_table[i].format;

     return -1;
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c
index b1f53a693..4caec70a7 100644
--- a/libao2/ao_oss.c
+++ b/libao2/ao_oss.c
@@ -29,9 +29,9 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <string.h>
-#include <strings.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "mixer.h"
 #include "help_mp.h"
@@ -259,7 +259,7 @@ static int init(int rate,int channels,int format,int flags){
       close(fd);

       for (i=0; i<SOUND_MIXER_NRDEVICES; i++){
-        if(!strcasecmp(mixer_channels[i], mchan)){
+        if(!av_strcasecmp(mixer_channels[i], mchan)){
           if(!(devs & (1 << i))){
             mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,mchan);
             i = SOUND_MIXER_NRDEVICES+1;
diff --git a/libass/ass.c b/libass/ass.c
index 576f04b59..383c1d7a3 100644
--- a/libass/ass.c
+++ b/libass/ass.c
@@ -21,7 +21,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <assert.h>
 #include <errno.h>
 #include <sys/types.h>
@@ -34,6 +33,7 @@
 #include <iconv.h>
 #endif

+#include "libavutil/avstring.h"
 #include "ass.h"
 #include "ass_utils.h"
 #include "ass_library.h"
@@ -230,35 +230,35 @@ static int numpad2align(int val)
 	if (!token) break;

 #define ANYVAL(name,func) \
-	} else if (strcasecmp(tname, #name) == 0) { \
+	} else if (av_strcasecmp(tname, #name) == 0) { \
 		target->name = func(token); \
 		ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);

 #define STRVAL(name) \
-	} else if (strcasecmp(tname, #name) == 0) { \
+	} else if (av_strcasecmp(tname, #name) == 0) { \
 		if (target->name != NULL) free(target->name); \
 		target->name = strdup(token); \
 		ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);

 #define COLORVAL(name) \
-	} else if (strcasecmp(tname, #name) == 0) { \
+	} else if (av_strcasecmp(tname, #name) == 0) { \
 		target->name = string2color(track->library, token); \
 		ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);

 #define INTVAL(name) ANYVAL(name,atoi)
 #define FPVAL(name) ANYVAL(name,ass_atof)
 #define TIMEVAL(name) \
-	} else if (strcasecmp(tname, #name) == 0) { \
+	} else if (av_strcasecmp(tname, #name) == 0) { \
 		target->name = string2timecode(track->library, token); \
 		ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);

 #define STYLEVAL(name) \
-	} else if (strcasecmp(tname, #name) == 0) { \
+	} else if (av_strcasecmp(tname, #name) == 0) { \
 		target->name = lookup_style(track, token); \
 		ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);

 #define ALIAS(alias,name) \
-	if (strcasecmp(tname, #alias) == 0) {tname = #name;}
+	if (av_strcasecmp(tname, #alias) == 0) {tname = #name;}

 static char *next_token(char **str)
 {
@@ -321,7 +321,7 @@ static int process_event_tail(ASS_Track *track, ASS_Event *event,

     while (1) {
         NEXT(q, tname);
-        if (strcasecmp(tname, "Text") == 0) {
+        if (av_strcasecmp(tname, "Text") == 0) {
             char *last;
             event->Text = strdup(p);
             if (*event->Text != 0) {
@@ -375,19 +375,19 @@ void ass_process_force_style(ASS_Track *track)
         *eq = '\0';
         token = eq + 1;

-        if (!strcasecmp(*fs, "PlayResX"))
+        if (!av_strcasecmp(*fs, "PlayResX"))
             track->PlayResX = atoi(token);
-        else if (!strcasecmp(*fs, "PlayResY"))
+        else if (!av_strcasecmp(*fs, "PlayResY"))
             track->PlayResY = atoi(token);
-        else if (!strcasecmp(*fs, "Timer"))
+        else if (!av_strcasecmp(*fs, "Timer"))
             track->Timer = ass_atof(token);
-        else if (!strcasecmp(*fs, "WrapStyle"))
+        else if (!av_strcasecmp(*fs, "WrapStyle"))
             track->WrapStyle = atoi(token);
-        else if (!strcasecmp(*fs, "ScaledBorderAndShadow"))
+        else if (!av_strcasecmp(*fs, "ScaledBorderAndShadow"))
             track->ScaledBorderAndShadow = parse_bool(token);
-        else if (!strcasecmp(*fs, "Kerning"))
+        else if (!av_strcasecmp(*fs, "Kerning"))
             track->Kerning = parse_bool(token);
-        else if (!strcasecmp(*fs, "YCbCr Matrix"))
+        else if (!av_strcasecmp(*fs, "YCbCr Matrix"))
             track->YCbCrMatrix = parse_ycbcr_matrix(token);

         dt = strrchr(*fs, '.');
@@ -401,7 +401,7 @@ void ass_process_force_style(ASS_Track *track)
         }
         for (sid = 0; sid < track->n_styles; ++sid) {
             if (style == NULL
-                || strcasecmp(track->styles[sid].Name, style) == 0) {
+                || av_strcasecmp(track->styles[sid].Name, style) == 0) {
                 target = track->styles + sid;
                 if (0) {
                     STRVAL(FontName)
@@ -748,17 +748,17 @@ static int process_fonts_line(ASS_Track *track, char *str)
 */
 static int process_line(ASS_Track *track, char *str)
 {
-    if (!strncasecmp(str, "[Script Info]", 13)) {
+    if (!av_strncasecmp(str, "[Script Info]", 13)) {
         track->parser_priv->state = PST_INFO;
-    } else if (!strncasecmp(str, "[V4 Styles]", 11)) {
+    } else if (!av_strncasecmp(str, "[V4 Styles]", 11)) {
         track->parser_priv->state = PST_STYLES;
         track->track_type = TRACK_TYPE_SSA;
-    } else if (!strncasecmp(str, "[V4+ Styles]", 12)) {
+    } else if (!av_strncasecmp(str, "[V4+ Styles]", 12)) {
         track->parser_priv->state = PST_STYLES;
         track->track_type = TRACK_TYPE_ASS;
-    } else if (!strncasecmp(str, "[Events]", 8)) {
+    } else if (!av_strncasecmp(str, "[Events]", 8)) {
         track->parser_priv->state = PST_EVENTS;
-    } else if (!strncasecmp(str, "[Fonts]", 7)) {
+    } else if (!av_strncasecmp(str, "[Fonts]", 7)) {
         track->parser_priv->state = PST_FONTS;
     } else {
         switch (track->parser_priv->state) {
diff --git a/libass/ass_font.c b/libass/ass_font.c
index 6840e2fd1..f8aba594d 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -25,8 +25,8 @@
 #include FT_GLYPH_H
 #include FT_TRUETYPE_TABLES_H
 #include FT_OUTLINE_H
-#include <strings.h>

+#include "libavutil/avstring.h"
 #include "ass.h"
 #include "ass_library.h"
 #include "ass_font.h"
@@ -83,7 +83,7 @@ static int find_font(ASS_Library *library, char *name)
 {
     int i;
     for (i = 0; i < library->num_fontdata; ++i)
-        if (strcasecmp(name, library->fontdata[i].name) == 0)
+        if (av_strcasecmp(name, library->fontdata[i].name) == 0)
             return i;
     return -1;
 }
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index d3dddea72..3d7c4e64c 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -22,13 +22,13 @@
 #include <stdio.h>
 #include <assert.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <inttypes.h>
 #include <ft2build.h>
 #include FT_FREETYPE_H

+#include "libavutil/avstring.h"
 #include "ass_utils.h"
 #include "ass.h"
 #include "ass_library.h"
@@ -94,7 +94,7 @@ match_fullname(ASS_Library *lib, FCInstance *priv, const char *family,
                 if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &at) != FcResultMatch
                     || at < bold)
                     continue;
-                if (strcasecmp(fullname, family) == 0) {
+                if (av_strcasecmp(fullname, family) == 0) {
                     FcFontSetAdd(result, FcPatternDuplicate(pat));
                     break;
                 }
@@ -256,8 +256,8 @@ static char *select_font(ASS_Library *library, FCInstance *priv,
         r_fullname = NULL;

     if (!treat_family_as_pattern &&
-        !(r_family && strcasecmp((const char *) r_family, family) == 0) &&
-        !(r_fullname && strcasecmp((const char *) r_fullname, family) == 0))
+        !(r_family && av_strcasecmp((const char *) r_family, family) == 0) &&
+        !(r_fullname && av_strcasecmp((const char *) r_fullname, family) == 0))
         ass_msg(library, MSGL_WARN,
                "fontconfig: Selected font is not the requested one: "
                "'%s' != '%s'",
diff --git a/libass/ass_utils.c b/libass/ass_utils.c
index 7b5466455..a9d8499b4 100644
--- a/libass/ass_utils.c
+++ b/libass/ass_utils.c
@@ -23,8 +23,8 @@
 #include <inttypes.h>
 #include <ft2build.h>
 #include FT_GLYPH_H
-#include <strings.h>

+#include "libavutil/avstring.h"
 #include "ass_library.h"
 #include "ass.h"
 #include "ass_utils.h"
@@ -115,7 +115,7 @@ char parse_bool(char *str)
 {
     while (*str == ' ' || *str == '\t')
         str++;
-    if (!strncasecmp(str, "yes", 3))
+    if (!av_strncasecmp(str, "yes", 3))
         return 1;
     else if (strtol(str, NULL, 10) > 0)
         return 1;
@@ -141,23 +141,23 @@ int parse_ycbcr_matrix(char *str)
     strncpy(buffer, str, n);
     buffer[n] = '\0';

-    if (!strcasecmp(buffer, "none"))
+    if (!av_strcasecmp(buffer, "none"))
         return YCBCR_NONE;
-    if (!strcasecmp(buffer, "tv.601"))
+    if (!av_strcasecmp(buffer, "tv.601"))
         return YCBCR_BT601_TV;
-    if (!strcasecmp(buffer, "pc.601"))
+    if (!av_strcasecmp(buffer, "pc.601"))
         return YCBCR_BT601_PC;
-    if (!strcasecmp(buffer, "tv.709"))
+    if (!av_strcasecmp(buffer, "tv.709"))
         return YCBCR_BT709_TV;
-    if (!strcasecmp(buffer, "pc.709"))
+    if (!av_strcasecmp(buffer, "pc.709"))
         return YCBCR_BT709_PC;
-    if (!strcasecmp(buffer, "tv.240m"))
+    if (!av_strcasecmp(buffer, "tv.240m"))
         return YCBCR_SMPTE240M_TV;
-    if (!strcasecmp(buffer, "pc.240m"))
+    if (!av_strcasecmp(buffer, "pc.240m"))
         return YCBCR_SMPTE240M_PC;
-    if (!strcasecmp(buffer, "tv.fcc"))
+    if (!av_strcasecmp(buffer, "tv.fcc"))
         return YCBCR_FCC_TV;
-    if (!strcasecmp(buffer, "pc.fcc"))
+    if (!av_strcasecmp(buffer, "pc.fcc"))
         return YCBCR_FCC_PC;
     return YCBCR_UNKNOWN;
 }
@@ -245,7 +245,7 @@ void *ass_guess_buffer_cp(ASS_Library *library, unsigned char *buffer,
     for (i = 0; i < langcnt; i++) {
         const char *tmp;

-        if (strcasecmp(languages[i], preferred_language) != 0)
+        if (av_strcasecmp(languages[i], preferred_language) != 0)
             continue;
         analyser = enca_analyser_alloc(languages[i]);
         encoding = enca_analyse_const(analyser, buffer, buflen);
diff --git a/libmenu/menu.c b/libmenu/menu.c
index f94e94bac..77be2187b 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <strings.h>
 #include <fcntl.h>
 #include <unistd.h>

@@ -37,6 +36,7 @@

 #include "libmpcodecs/img_format.h"
 #include "libmpcodecs/mp_image.h"
+#include "libavutil/avstring.h"
 #include "libavutil/mem.h"
 #include "m_option.h"
 #include "m_struct.h"
@@ -100,7 +100,7 @@ static menu_cmd_bindings_t *get_cmd_bindings(const char *name)
 {
   int i;
   for (i = 0; i < cmd_bindings_num; ++i)
-    if (!strcasecmp(cmd_bindings[i].name, name))
+    if (!av_strcasecmp(cmd_bindings[i].name, name))
       return &cmd_bindings[i];
   return NULL;
 }
@@ -131,7 +131,7 @@ static int menu_parse_config(char* buffer) {
       continue;
     }

-    if (!strcasecmp(element, "keybindings")) {
+    if (!av_strcasecmp(element, "keybindings")) {
       menu_cmd_bindings_t *bindings = cmd_bindings;
       char *parent_bindings;
       cmd_bindings = realloc(cmd_bindings,
@@ -164,7 +164,7 @@ static int menu_parse_config(char* buffer) {
           }
           if(r == 0)
             break;
-          if (!strcasecmp(element, "binding")) {
+          if (!av_strcasecmp(element, "binding")) {
             key = asx_get_attrib("key",attribs);
             cmd = asx_get_attrib("cmd",attribs);
             if (key && (keycode = mp_input_get_key_from_name(key)) >= 0) {
@@ -193,7 +193,7 @@ static int menu_parse_config(char* buffer) {
     }
     // Try to find this menu type in our list
     for(i = 0, minfo = NULL ; menu_info_list[i] ; i++) {
-      if(strcasecmp(element,menu_info_list[i]->name) == 0) {
+      if(av_strcasecmp(element,menu_info_list[i]->name) == 0) {
 	minfo = menu_info_list[i];
 	break;
       }
@@ -207,7 +207,7 @@ static int menu_parse_config(char* buffer) {
       menu_list[menu_count].args = body;
       // Setup the attribs
       for(i = 0 ; attribs[2*i] ; i++) {
-	if(strcasecmp(attribs[2*i],"name") == 0) continue;
+	if(av_strcasecmp(attribs[2*i],"name") == 0) continue;
 	if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1]))
 	  mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1],
 		 name,parser->line);
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c
index 5d1d4114d..45795ec79 100644
--- a/libmenu/menu_filesel.c
+++ b/libmenu/menu_filesel.c
@@ -21,7 +21,6 @@
 #include <dirent.h>
 #include <errno.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -283,7 +282,7 @@ static int open_dir(menu_t* menu,char* args) {
       ext++;
       elem = extensions;
       do {
-        if (!strcasecmp(ext, *elem))
+        if (!av_strcasecmp(ext, *elem))
           break;
       } while (*++elem);
       if (*elem == NULL)
diff --git a/libmenu/menu_param.c b/libmenu/menu_param.c
index b9c7078f5..86d3e6602 100644
--- a/libmenu/menu_param.c
+++ b/libmenu/menu_param.c
@@ -23,11 +23,12 @@
 #include <dirent.h>
 #include <errno.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <ctype.h>

+#include "libavutil/avstring.h"
+
 #include "mp_msg.h"
 #include "help_mp.h"

@@ -168,9 +169,9 @@ static int parse_args(menu_t* menu,char* args) {
     auto_update = asx_get_attrib("auto-update", attribs);
     if (auto_update) {
       if (!strcmp(auto_update, "1") ||
-          !strcasecmp(auto_update, "on") ||
-          !strcasecmp(auto_update, "yes") ||
-          !strcasecmp(auto_update, "true"))
+          !av_strcasecmp(auto_update, "on") ||
+          !av_strcasecmp(auto_update, "yes") ||
+          !av_strcasecmp(auto_update, "true"))
         m->auto_update = 1;
       free(auto_update);
     }
diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c
index c89a2c8a3..1dd942862 100644
--- a/libmpcodecs/ad_libvorbis.c
+++ b/libmpcodecs/ad_libvorbis.c
@@ -18,12 +18,12 @@

 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>
 #include <unistd.h>
 #include <stdarg.h>
 #include <math.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "ad_internal.h"
 #include "libaf/reorder_ch.h"
@@ -68,7 +68,7 @@ static int read_vorbis_comment( char* ptr, const char* comment, const char* form

   va_start( va, format );
   clen = strlen( comment );
-  ret = strncasecmp( ptr, comment, clen) == 0 ? vsscanf( ptr+clen, format, va ) : 0;
+  ret = av_strncasecmp( ptr, comment, clen) == 0 ? vsscanf( ptr+clen, format, va ) : 0;
   va_end( va );

   return ret;
diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c
index 782aaaf84..44792d7b2 100644
--- a/libmpcodecs/ae_toolame.c
+++ b/libmpcodecs/ae_toolame.c
@@ -21,10 +21,10 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
 #include <toolame.h>

+#include "libavutil/avstring.h"
 #include "m_option.h"
 #include "mp_msg.h"
 #include "libmpdemux/aviheader.h"
@@ -161,11 +161,11 @@ int mpae_init_toolame(audio_encoder_t *encoder)
 	}
 	else if(encoder->params.channels == 2)
 	{
-		if(! strcasecmp(param_mode, "dual"))
+		if(! av_strcasecmp(param_mode, "dual"))
 			mode = MPG_MD_DUAL_CHANNEL;
-		else if(! strcasecmp(param_mode, "jstereo"))
+		else if(! av_strcasecmp(param_mode, "jstereo"))
 			mode = MPG_MD_JOINT_STEREO;
-		else if(! strcasecmp(param_mode, "stereo"))
+		else if(! av_strcasecmp(param_mode, "stereo"))
 			mode = MPG_MD_STEREO;
 		else
 		{
diff --git a/libmpcodecs/ae_twolame.c b/libmpcodecs/ae_twolame.c
index 5ff751b58..85e0dea2c 100644
--- a/libmpcodecs/ae_twolame.c
+++ b/libmpcodecs/ae_twolame.c
@@ -21,10 +21,10 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
 #include <twolame.h>

+#include "libavutil/avstring.h"
 #include "m_option.h"
 #include "mp_msg.h"
 #include "libmpdemux/aviheader.h"
@@ -154,11 +154,11 @@ int mpae_init_twolame(audio_encoder_t *encoder)
 	}
 	else if(encoder->params.channels == 2)
 	{
-		if(! strcasecmp(param_mode, "dual"))
+		if(! av_strcasecmp(param_mode, "dual"))
 			mode = TWOLAME_DUAL_CHANNEL;
-		else if(! strcasecmp(param_mode, "jstereo"))
+		else if(! av_strcasecmp(param_mode, "jstereo"))
 			mode = TWOLAME_JOINT_STEREO;
-		else if(! strcasecmp(param_mode, "stereo"))
+		else if(! av_strcasecmp(param_mode, "stereo"))
 			mode = TWOLAME_STEREO;
 		else
 		{
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 1691f734c..a19ec2ffe 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -18,7 +18,6 @@

 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>
 #include <assert.h>
 #include <time.h>

@@ -29,6 +28,7 @@
 #include "av_helpers.h"

 #include "libavutil/common.h"
+#include "libavutil/avstring.h"
 #include "libavutil/dict.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
@@ -163,12 +163,12 @@ const m_option_t lavc_decode_opts_conf[]={

 static enum AVDiscard str2AVDiscard(char *str) {
     if (!str)                               return AVDISCARD_DEFAULT;
-    if (strcasecmp(str, "none"   ) == 0)    return AVDISCARD_NONE;
-    if (strcasecmp(str, "default") == 0)    return AVDISCARD_DEFAULT;
-    if (strcasecmp(str, "nonref" ) == 0)    return AVDISCARD_NONREF;
-    if (strcasecmp(str, "bidir"  ) == 0)    return AVDISCARD_BIDIR;
-    if (strcasecmp(str, "nonkey" ) == 0)    return AVDISCARD_NONKEY;
-    if (strcasecmp(str, "all"    ) == 0)    return AVDISCARD_ALL;
+    if (av_strcasecmp(str, "none"   ) == 0)    return AVDISCARD_NONE;
+    if (av_strcasecmp(str, "default") == 0)    return AVDISCARD_DEFAULT;
+    if (av_strcasecmp(str, "nonref" ) == 0)    return AVDISCARD_NONREF;
+    if (av_strcasecmp(str, "bidir"  ) == 0)    return AVDISCARD_BIDIR;
+    if (av_strcasecmp(str, "nonkey" ) == 0)    return AVDISCARD_NONKEY;
+    if (av_strcasecmp(str, "all"    ) == 0)    return AVDISCARD_ALL;
     mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Unknown discard value %s\n", str);
     return AVDISCARD_DEFAULT;
 }
diff --git a/libmpcodecs/vd_zrmjpeg.c b/libmpcodecs/vd_zrmjpeg.c
index 0d6b3303b..82b74b561 100644
--- a/libmpcodecs/vd_zrmjpeg.c
+++ b/libmpcodecs/vd_zrmjpeg.c
@@ -23,9 +23,9 @@

 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "vfcap.h"

@@ -209,7 +209,7 @@ static unsigned int guess_mjpeg_type(unsigned char *data, unsigned int size,


 	if (app0 && get_int2(data + app0 + 2) >= 5 &&
-			strncasecmp((char*)(data + app0 + 4), "AVI1", 4) == 0) {
+			av_strncasecmp((char*)(data + app0 + 4), "AVI1", 4) == 0) {
 		if (data[app0+8] == 1) {
 			VERBOSE("data is interlaced, APP0: top-first (1)\n");
 			return IMGFMT_ZRMJPEGIT;
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c
index 8b12b8bf3..297d8f648 100644
--- a/libmpcodecs/ve_lavc.c
+++ b/libmpcodecs/ve_lavc.c
@@ -21,7 +21,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <math.h>
 #include <limits.h>
 #include <time.h>
@@ -32,6 +31,7 @@
 #endif

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mencoder.h"
 #include "mp_msg.h"
 #include "help_mp.h"
@@ -865,29 +865,29 @@ static int vf_open(vf_instance_t *vf, char* args){
     /* XXX: hack: some of the MJPEG decoder DLL's needs exported huffman
        table, so we define a zero-table, also lavc mjpeg encoder is putting
        huffman tables into the stream, so no problem */
-    if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "mjpeg"))
+    if (lavc_param_vcodec && !av_strcasecmp(lavc_param_vcodec, "mjpeg"))
     {
 	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+28);
 	mux_v->bih->biSize=sizeof(*mux_v->bih)+28;
     }
-    else if (lavc_param_vcodec && (!strcasecmp(lavc_param_vcodec, "huffyuv")
-                                || !strcasecmp(lavc_param_vcodec, "ffvhuff")))
+    else if (lavc_param_vcodec && (!av_strcasecmp(lavc_param_vcodec, "huffyuv")
+                                || !av_strcasecmp(lavc_param_vcodec, "ffvhuff")))
     {
     /* XXX: hack: huffyuv needs to store huffman tables (allthough we dunno the size yet ...) */
 	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+1000);
 	mux_v->bih->biSize=sizeof(*mux_v->bih)+1000;
     }
-    else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv1"))
+    else if (lavc_param_vcodec && !av_strcasecmp(lavc_param_vcodec, "asv1"))
     {
 	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+8);
 	mux_v->bih->biSize=sizeof(*mux_v->bih)+8;
     }
-    else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv2"))
+    else if (lavc_param_vcodec && !av_strcasecmp(lavc_param_vcodec, "asv2"))
     {
 	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+8);
 	mux_v->bih->biSize=sizeof(*mux_v->bih)+8;
     }
-    else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "wmv2"))
+    else if (lavc_param_vcodec && !av_strcasecmp(lavc_param_vcodec, "wmv2"))
     {
 	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+4);
 	mux_v->bih->biSize=sizeof(*mux_v->bih)+4;
@@ -907,51 +907,51 @@ static int vf_open(vf_instance_t *vf, char* args){
 	return 0;
     }

-    if (!strcasecmp(lavc_param_vcodec, "mpeg1") || !strcasecmp(lavc_param_vcodec, "mpeg1video"))
+    if (!av_strcasecmp(lavc_param_vcodec, "mpeg1") || !av_strcasecmp(lavc_param_vcodec, "mpeg1video"))
 	mux_v->bih->biCompression = mmioFOURCC('m', 'p', 'g', '1');
-    else if (!strcasecmp(lavc_param_vcodec, "mpeg2") || !strcasecmp(lavc_param_vcodec, "mpeg2video"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "mpeg2") || !av_strcasecmp(lavc_param_vcodec, "mpeg2video"))
 	mux_v->bih->biCompression = mmioFOURCC('m', 'p', 'g', '2');
-    else if (!strcasecmp(lavc_param_vcodec, "h263") || !strcasecmp(lavc_param_vcodec, "h263p"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "h263") || !av_strcasecmp(lavc_param_vcodec, "h263p"))
 	mux_v->bih->biCompression = mmioFOURCC('h', '2', '6', '3');
-    else if (!strcasecmp(lavc_param_vcodec, "rv10"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "rv10"))
 	mux_v->bih->biCompression = mmioFOURCC('R', 'V', '1', '0');
-    else if (!strcasecmp(lavc_param_vcodec, "mjpeg"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "mjpeg"))
 	mux_v->bih->biCompression = mmioFOURCC('M', 'J', 'P', 'G');
-    else if (!strcasecmp(lavc_param_vcodec, "ljpeg"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "ljpeg"))
 	mux_v->bih->biCompression = mmioFOURCC('L', 'J', 'P', 'G');
-    else if (!strcasecmp(lavc_param_vcodec, "mpeg4"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "mpeg4"))
 	mux_v->bih->biCompression = mmioFOURCC('F', 'M', 'P', '4');
-    else if (!strcasecmp(lavc_param_vcodec, "msmpeg4"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "msmpeg4"))
 	mux_v->bih->biCompression = mmioFOURCC('d', 'i', 'v', '3');
-    else if (!strcasecmp(lavc_param_vcodec, "msmpeg4v2"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "msmpeg4v2"))
 	mux_v->bih->biCompression = mmioFOURCC('M', 'P', '4', '2');
-    else if (!strcasecmp(lavc_param_vcodec, "wmv1"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "wmv1"))
 	mux_v->bih->biCompression = mmioFOURCC('W', 'M', 'V', '1');
-    else if (!strcasecmp(lavc_param_vcodec, "wmv2"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "wmv2"))
 	mux_v->bih->biCompression = mmioFOURCC('W', 'M', 'V', '2');
-    else if (!strcasecmp(lavc_param_vcodec, "huffyuv"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "huffyuv"))
 	mux_v->bih->biCompression = mmioFOURCC('H', 'F', 'Y', 'U');
-    else if (!strcasecmp(lavc_param_vcodec, "ffvhuff"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "ffvhuff"))
 	mux_v->bih->biCompression = mmioFOURCC('F', 'F', 'V', 'H');
-    else if (!strcasecmp(lavc_param_vcodec, "asv1"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "asv1"))
 	mux_v->bih->biCompression = mmioFOURCC('A', 'S', 'V', '1');
-    else if (!strcasecmp(lavc_param_vcodec, "asv2"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "asv2"))
 	mux_v->bih->biCompression = mmioFOURCC('A', 'S', 'V', '2');
-    else if (!strcasecmp(lavc_param_vcodec, "ffv1"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "ffv1"))
 	mux_v->bih->biCompression = mmioFOURCC('F', 'F', 'V', '1');
-    else if (!strcasecmp(lavc_param_vcodec, "snow"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "snow"))
 	mux_v->bih->biCompression = mmioFOURCC('S', 'N', 'O', 'W');
-    else if (!strcasecmp(lavc_param_vcodec, "flv"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "flv"))
 	mux_v->bih->biCompression = mmioFOURCC('F', 'L', 'V', '1');
-    else if (!strcasecmp(lavc_param_vcodec, "dvvideo"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "dvvideo"))
 	mux_v->bih->biCompression = mmioFOURCC('d', 'v', 's', 'd');
-    else if (!strcasecmp(lavc_param_vcodec, "libx264"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "libx264"))
 	mux_v->bih->biCompression = mmioFOURCC('h', '2', '6', '4');
-    else if (!strcasecmp(lavc_param_vcodec, "libschroedinger"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "libschroedinger"))
 	mux_v->bih->biCompression = mmioFOURCC('d', 'r', 'a', 'c');
-    else if (!strcasecmp(lavc_param_vcodec, "libdirac"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "libdirac"))
 	mux_v->bih->biCompression = mmioFOURCC('d', 'r', 'a', 'c');
-    else if (!strcasecmp(lavc_param_vcodec, "libvpx"))
+    else if (!av_strcasecmp(lavc_param_vcodec, "libvpx"))
 	mux_v->bih->biCompression = mmioFOURCC('V', 'P', '8', '0');
     else
 	mux_v->bih->biCompression = mmioFOURCC(lavc_param_vcodec[0],
diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c
index 37de5f21a..7e2a4eda6 100644
--- a/libmpcodecs/ve_x264.c
+++ b/libmpcodecs/ve_x264.c
@@ -30,10 +30,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <errno.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "mencoder.h"
 #include "m_option.h"
@@ -91,9 +91,9 @@ void x264enc_set_param(const m_option_t* opt, char* arg)
         if (!value)
             continue;
         *value++ = 0;
-        if (!strcasecmp(name, "preset"))
+        if (!av_strcasecmp(name, "preset"))
             preset = value;
-        else if (!strcasecmp(name, "tune"))
+        else if (!av_strcasecmp(name, "tune"))
             tune = value;
     }
     if (x264_param_default_preset(&param, preset, tune) < 0) {
@@ -109,16 +109,16 @@ void x264enc_set_param(const m_option_t* opt, char* arg)

         if (value)
             *value++ = 0;
-        if (!strcasecmp(name, "profile"))
+        if (!av_strcasecmp(name, "profile"))
             profile = value;
-        else if (!strcasecmp(name, "turbo")) {
+        else if (!av_strcasecmp(name, "turbo")) {
             mp_msg(MSGT_CFGPARSER, MSGL_WARN, "Option x264encopts: turbo option is deprecated; "
                                               "use slow_firstpass to disable turbo\n");
             if (value && *value == '0')
                 slow_firstpass = 1;
-        } else if (!strcasecmp(name, "slow_firstpass"))
+        } else if (!av_strcasecmp(name, "slow_firstpass"))
             slow_firstpass = 1;
-        else if (strcasecmp(name, "preset") && strcasecmp(name, "tune")) {
+        else if (av_strcasecmp(name, "preset") && av_strcasecmp(name, "tune")) {
             ret = x264_param_parse(&param, name, value);
             if (ret == X264_PARAM_BAD_NAME)
                 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option x264encopts: Unknown suboption %s\n", name);
diff --git a/libmpcodecs/ve_xvid4.c b/libmpcodecs/ve_xvid4.c
index ec6430865..d9577fa39 100644
--- a/libmpcodecs/ve_xvid4.c
+++ b/libmpcodecs/ve_xvid4.c
@@ -28,13 +28,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <errno.h>
 #include <math.h>
 #include <limits.h>
 #include <time.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "mencoder.h"
 #include "codec-cfg.h"
@@ -150,7 +150,7 @@ static const profile_t profiles[] =
 static const profile_t *profileFromName(const char *str)
 {
 	profile_t *cur = profiles;
-	while (cur->name && strcasecmp(cur->name, str)) cur++;
+	while (cur->name && av_strcasecmp(cur->name, str)) cur++;
 	if(!cur->name) return NULL;
 	return cur;
 }
@@ -851,7 +851,7 @@ static int dispatch_settings(xvid_mplayer_module_t *mod)
 	// MPEG quantisation is only supported in ASP and unrestricted profiles
 	if((selected_profile->flags & PROFILE_MPEGQUANT) &&
 		(xvidenc_quant_method != NULL) &&
-		!strcasecmp(xvidenc_quant_method, "mpeg"))
+		!av_strcasecmp(xvidenc_quant_method, "mpeg"))
 	{
 		frame->vol_flags |= XVID_VOL_MPEGQUANT;
 	if(xvidenc_intra_matrix_file != NULL) {
@@ -965,15 +965,15 @@ static int dispatch_settings(xvid_mplayer_module_t *mod)
 		}

 	} else if(xvidenc_par != NULL) {
-		if(strcasecmp(xvidenc_par, "pal43") == 0)
+		if(av_strcasecmp(xvidenc_par, "pal43") == 0)
 			frame->par = XVID_PAR_43_PAL;
-		else if(strcasecmp(xvidenc_par, "pal169") == 0)
+		else if(av_strcasecmp(xvidenc_par, "pal169") == 0)
 			frame->par = XVID_PAR_169_PAL;
-		else if(strcasecmp(xvidenc_par, "ntsc43") == 0)
+		else if(av_strcasecmp(xvidenc_par, "ntsc43") == 0)
 			frame->par = XVID_PAR_43_NTSC;
-		else if(strcasecmp(xvidenc_par, "ntsc169") == 0)
+		else if(av_strcasecmp(xvidenc_par, "ntsc169") == 0)
 			frame->par = XVID_PAR_169_NTSC;
-		else if(strcasecmp(xvidenc_par, "ext") == 0)
+		else if(av_strcasecmp(xvidenc_par, "ext") == 0)
 			frame->par = XVID_PAR_EXT;

 	if(frame->par == XVID_PAR_EXT) {
diff --git a/libmpcodecs/vf_palette.c b/libmpcodecs/vf_palette.c
index eafac4d02..dc8b5f041 100644
--- a/libmpcodecs/vf_palette.c
+++ b/libmpcodecs/vf_palette.c
@@ -19,10 +19,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <inttypes.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"

@@ -197,14 +197,14 @@ static int vf_open(vf_instance_t *vf, char *args){
     for(i=0;i<256;i++) gray_pal[i]=0x01010101*i;
     if (args)
     {
-        if (!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else
-        if (!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else
-        if (!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else
-        if (!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else
-        if (!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
-        if (!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else
-        if (!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else
-        if (!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else
+        if (!av_strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else
+        if (!av_strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else
+        if (!av_strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else
+        if (!av_strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else
+        if (!av_strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
+        if (!av_strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else
+        if (!av_strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else
+        if (!av_strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else
         {
             mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args);
             return 0;
diff --git a/libmpcodecs/vf_zrmjpeg.c b/libmpcodecs/vf_zrmjpeg.c
index ef5d5f00a..40da0a4e5 100644
--- a/libmpcodecs/vf_zrmjpeg.c
+++ b/libmpcodecs/vf_zrmjpeg.c
@@ -36,10 +36,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <inttypes.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "av_helpers.h"
 #include "mp_msg.h"
 #include "img_format.h"
@@ -54,7 +54,7 @@

 #undef malloc
 #undef free
-#undef strcasecmp
+#undef av_strcasecmp

 /* some convenient #define's, is this portable enough? */
 /// Printout  with vf_zrmjpeg: prefix at VERBOSE level
@@ -993,35 +993,35 @@ static int vf_open(vf_instance_t *vf, char *args){
 					VERBOSE(
 			"setting vertical decimation to %d\n", priv->maxwidth);
 				}
-			} else if (!strcasecmp("dc10+-PAL", ptr) ||
-					!strcasecmp("dc10-PAL", ptr)) {
+			} else if (!av_strcasecmp("dc10+-PAL", ptr) ||
+					!av_strcasecmp("dc10-PAL", ptr)) {
 				priv->maxwidth = 768;
 				priv->maxheight = 576;
 				VERBOSE("setting DC10(+) PAL profile\n");
-			} else if (!strcasecmp("fd", ptr)) {
+			} else if (!av_strcasecmp("fd", ptr)) {
 				priv->fd = 1;
 				VERBOSE("forcing decimation\n");
-			} else if (!strcasecmp("nofd", ptr)) {
+			} else if (!av_strcasecmp("nofd", ptr)) {
 				priv->fd = 0;
 				VERBOSE("decimate only if beautiful\n");
-			} else if (!strcasecmp("bw", ptr)) {
+			} else if (!av_strcasecmp("bw", ptr)) {
 				priv->bw = 1;
 				VERBOSE("setting black and white encoding\n");
-			} else if (!strcasecmp("color", ptr)) {
+			} else if (!av_strcasecmp("color", ptr)) {
 				priv->bw = 0;
 				VERBOSE("setting color encoding\n");
-			} else if (!strcasecmp("dc10+-NTSC", ptr) ||
-					!strcasecmp("dc10-NTSC", ptr)) {
+			} else if (!av_strcasecmp("dc10+-NTSC", ptr) ||
+					!av_strcasecmp("dc10-NTSC", ptr)) {
 				priv->maxwidth = 640;
 				priv->maxheight = 480;
 				VERBOSE("setting DC10(+) NTSC profile\n");
-			} else if (!strcasecmp("buz-PAL", ptr) ||
-					!strcasecmp("lml33-PAL", ptr)) {
+			} else if (!av_strcasecmp("buz-PAL", ptr) ||
+					!av_strcasecmp("lml33-PAL", ptr)) {
 				priv->maxwidth = 720;
 				priv->maxheight = 576;
 				VERBOSE("setting buz/lml33 PAL profile\n");
-			} else if (!strcasecmp("buz-NTSC", ptr) ||
-					!strcasecmp("lml33-NTSC", ptr)) {
+			} else if (!av_strcasecmp("buz-NTSC", ptr) ||
+					!av_strcasecmp("lml33-NTSC", ptr)) {
 				priv->maxwidth = 720;
 				priv->maxheight = 480;
 				VERBOSE("setting buz/lml33 NTSC profile\n");
diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c
index b3429823d..00b1ebc8d 100644
--- a/libmpdemux/demux_audio.c
+++ b/libmpdemux/demux_audio.c
@@ -33,7 +33,6 @@
 #include "libavutil/intreadwrite.h"

 #include <string.h>
-#include <strings.h>

 #define MP3 1
 #define WAV 2
@@ -220,19 +219,19 @@ get_flac_metadata (demuxer_t* demuxer)
           c = comment[length];
           comment[length] = 0;

-          if (!strncasecmp ("TITLE=", comment, 6) && (length - 6 > 0))
+          if (!av_strncasecmp ("TITLE=", comment, 6) && (length - 6 > 0))
             demux_info_add (demuxer, "Title", comment + 6);
-          else if (!strncasecmp ("ARTIST=", comment, 7) && (length - 7 > 0))
+          else if (!av_strncasecmp ("ARTIST=", comment, 7) && (length - 7 > 0))
             demux_info_add (demuxer, "Artist", comment + 7);
-          else if (!strncasecmp ("ALBUM=", comment, 6) && (length - 6 > 0))
+          else if (!av_strncasecmp ("ALBUM=", comment, 6) && (length - 6 > 0))
             demux_info_add (demuxer, "Album", comment + 6);
-          else if (!strncasecmp ("DATE=", comment, 5) && (length - 5 > 0))
+          else if (!av_strncasecmp ("DATE=", comment, 5) && (length - 5 > 0))
             demux_info_add (demuxer, "Year", comment + 5);
-          else if (!strncasecmp ("GENRE=", comment, 6) && (length - 6 > 0))
+          else if (!av_strncasecmp ("GENRE=", comment, 6) && (length - 6 > 0))
             demux_info_add (demuxer, "Genre", comment + 6);
-          else if (!strncasecmp ("Comment=", comment, 8) && (length - 8 > 0))
+          else if (!av_strncasecmp ("Comment=", comment, 8) && (length - 8 > 0))
             demux_info_add (demuxer, "Comment", comment + 8);
-          else if (!strncasecmp ("TRACKNUMBER=", comment, 12)
+          else if (!av_strncasecmp ("TRACKNUMBER=", comment, 12)
                    && (length - 12 > 0))
           {
             char buf[31];
diff --git a/libmpdemux/demux_mf.c b/libmpdemux/demux_mf.c
index 4bb06ecb4..1f322cd41 100644
--- a/libmpdemux/demux_mf.c
+++ b/libmpdemux/demux_mf.c
@@ -19,13 +19,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"

@@ -151,7 +151,7 @@ static demuxer_t* demux_open_mf(demuxer_t* demuxer){
   demuxer->video->sh = sh_video;

   for (i = 0; type2format[i].type; i++)
-    if (strcasecmp(mf_type, type2format[i].type) == 0)
+    if (av_strcasecmp(mf_type, type2format[i].type) == 0)
       break;
   if (!type2format[i].type) {
     mp_msg(MSGT_DEMUX, MSGL_INFO, "[demux_mf] unknown input file type.\n" );
diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c
index f6bf2bc22..e15794c91 100644
--- a/libmpdemux/demux_ogg.c
+++ b/libmpdemux/demux_ogg.c
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <strings.h>
 #include <assert.h>
 #include <math.h>
 #include <inttypes.h>
@@ -32,6 +31,7 @@
 #include "stream/stream.h"
 #include "demuxer.h"
 #include "stheader.h"
+#include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "aviprint.h"
 #include "demux_mov.h"
@@ -355,11 +355,11 @@ static int demux_ogg_check_lang(const char *clang, const char *langlist)
     if (!langlist || !*langlist)
         return 0;
     while ((c = strchr(langlist, ','))) {
-        if (!strncasecmp(clang, langlist, c - langlist))
+        if (!av_strncasecmp(clang, langlist, c - langlist))
             return 1;
         langlist = &c[1];
     }
-    if (!strncasecmp(clang, langlist, strlen(langlist)))
+    if (!av_strncasecmp(clang, langlist, strlen(langlist)))
         return 1;
     return 0;
 }
@@ -420,7 +420,7 @@ static void demux_ogg_check_comments(demuxer_t *d, ogg_stream_t *os,

     while (*cmt) {
         hdr = NULL;
-        if (!strncasecmp(*cmt, "LANGUAGE=", 9)) {
+        if (!av_strncasecmp(*cmt, "LANGUAGE=", 9)) {
             val = *cmt + 9;
             if (ogg_d->subs[id].text)
                 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n",
@@ -459,7 +459,7 @@ static void demux_ogg_check_comments(demuxer_t *d, ogg_stream_t *os,
         }
         else {
             for (i = 0; table[i].ogg; i++) {
-                if (!strncasecmp(*cmt, table[i].ogg, strlen(table[i].ogg)) &&
+                if (!av_strncasecmp(*cmt, table[i].ogg, strlen(table[i].ogg)) &&
                         (*cmt)[strlen(table[i].ogg)] == '=') {
                     hdr = table[i].mp;
                     val = *cmt + strlen(table[i].ogg) + 1;
diff --git a/libmpdemux/demux_viv.c b/libmpdemux/demux_viv.c
index 428ec0a8a..7414b4315 100644
--- a/libmpdemux/demux_viv.c
+++ b/libmpdemux/demux_viv.c
@@ -24,9 +24,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h> /* strtok */
-#include <strings.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"

@@ -672,9 +672,9 @@ if (demuxer->audio->id >= -1){
 		}
 		if (vivo_param_acodec != NULL)
 		{
-		    if (!strcasecmp(vivo_param_acodec, "g723"))
+		    if (!av_strcasecmp(vivo_param_acodec, "g723"))
 			priv->audio_codec = VIVO_AUDIO_G723;
-		    if (!strcasecmp(vivo_param_acodec, "siren"))
+		    if (!av_strcasecmp(vivo_param_acodec, "siren"))
 			priv->audio_codec = VIVO_AUDIO_SIREN;
 		}

diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index ffc8c97ed..beb41f2db 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -21,7 +21,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>

 #include <sys/types.h>
@@ -1437,7 +1436,7 @@ int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param)


     for (n = 0; info && info[2 * n] != NULL; n++) {
-        if (!strcasecmp(opt, info[2 * n])) {
+        if (!av_strcasecmp(opt, info[2 * n])) {
             if (!strcmp(param, info[2 * n + 1])) {
                 mp_msg(MSGT_DEMUX, MSGL_V, "Demuxer info %s set to unchanged value %s\n", opt, param);
                 return 0;
@@ -1486,7 +1485,7 @@ char *demux_info_get(demuxer_t *demuxer, const char *opt)
     char **info = demuxer->info;

     for (i = 0; info && info[2 * i] != NULL; i++) {
-        if (!strcasecmp(opt, info[2 * i]))
+        if (!av_strcasecmp(opt, info[2 * i]))
             return info[2 * i + 1];
     }

diff --git a/libmpdemux/extension.c b/libmpdemux/extension.c
index a5e8e0310..f17ff7cb0 100644
--- a/libmpdemux/extension.c
+++ b/libmpdemux/extension.c
@@ -19,9 +19,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "stream/stream.h"
 #include "demuxer.h"
@@ -101,7 +101,7 @@ int demuxer_type_by_filename(char* filename){
 //    mp_msg(MSGT_CPLAYER,MSGL_DBG2,"Extension: %s\n", extension );
     // Look for the extension in the extensions table
     for( i=0 ; i<(sizeof(extensions_table)/sizeof(extensions_table[0])) ; i++ ) {
-      if( !strcasecmp(extension, extensions_table[i].extension) ) {
+      if( !av_strcasecmp(extension, extensions_table[i].extension) ) {
         mp_msg(MSGT_OPEN, MSGL_V, "Trying demuxer %d based on filename extension\n",extensions_table[i].demuxer_type);
         return extensions_table[i].demuxer_type;
       }
diff --git a/libmpdemux/muxer_mpeg.c b/libmpdemux/muxer_mpeg.c
index f489622f5..8c22942f3 100644
--- a/libmpdemux/muxer_mpeg.c
+++ b/libmpdemux/muxer_mpeg.c
@@ -20,13 +20,13 @@
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>

 #include "config.h"
 #include "mp_msg.h"
 #include "help_mp.h"

+#include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "aviheader.h"
 #include "ms_hdr.h"
@@ -2502,21 +2502,21 @@ int muxer_init_muxer_mpeg(muxer_t *muxer)

 	if(conf_mux != NULL)
 	{
-		if(! strcasecmp(conf_mux, "mpeg1"))
+		if(! av_strcasecmp(conf_mux, "mpeg1"))
 		{
 			priv->mux = MUX_MPEG1;
 			priv->packet_size = 2048;
 			priv->is_genmpeg1 = 1;
 			priv->muxrate = 1800 * 125;	//Constrained parameters
 		}
-		else if(! strcasecmp(conf_mux, "dvd"))
+		else if(! av_strcasecmp(conf_mux, "dvd"))
 		{
 			priv->mux = MUX_MPEG2;
 			priv->is_dvd = 1;
 			priv->packet_size = 2048;
 			priv->muxrate = 10080 * 125;
 		}
-		else if(! strcasecmp(conf_mux, "xsvcd"))
+		else if(! av_strcasecmp(conf_mux, "xsvcd"))
 		{
 			priv->mux = MUX_MPEG2;
 			priv->is_xsvcd = 1;
@@ -2524,7 +2524,7 @@ int muxer_init_muxer_mpeg(muxer_t *muxer)
 			priv->muxrate = 150*2324;
 			priv->ts_allframes = 1;
 		}
-		else if(! strcasecmp(conf_mux, "xvcd"))
+		else if(! av_strcasecmp(conf_mux, "xvcd"))
 		{
 			priv->mux = MUX_MPEG1;
 			priv->is_xvcd = 1;
@@ -2532,7 +2532,7 @@ int muxer_init_muxer_mpeg(muxer_t *muxer)
 			priv->muxrate = 75*2352;
 			priv->ts_allframes = 1;
 		}
-		else if(! strcasecmp(conf_mux, "pes1"))
+		else if(! av_strcasecmp(conf_mux, "pes1"))
 		{
 			priv->mux = MUX_MPEG1;
 			priv->rawpes = 1;
@@ -2540,7 +2540,7 @@ int muxer_init_muxer_mpeg(muxer_t *muxer)
 			priv->muxrate = 10080 * 125;
 			priv->ts_allframes = 1;
 		}
-		else if(! strcasecmp(conf_mux, "pes2"))
+		else if(! av_strcasecmp(conf_mux, "pes2"))
 		{
 			priv->mux = MUX_MPEG2;
 			priv->rawpes = 1;
@@ -2550,7 +2550,7 @@ int muxer_init_muxer_mpeg(muxer_t *muxer)
 		}
 		else
 		{
-			if(strcasecmp(conf_mux, "mpeg2"))
+			if(av_strcasecmp(conf_mux, "mpeg2"))
 				mp_msg(MSGT_MUXER, MSGL_ERR, "Unknown format %s, default to mpeg2\n", conf_mux);
 			priv->mux = MUX_MPEG2;
 			priv->is_genmpeg2 = 1;
diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c
index bd1b9665e..dc805be5b 100644
--- a/libvo/vo_aa.c
+++ b/libvo/vo_aa.c
@@ -31,10 +31,10 @@
 #include <stdarg.h>
 #include <time.h>
 #include <string.h>
-#include <strings.h>
 #include <errno.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "video_out.h"
 #include "video_out_internal.h"
 #include "libmpcodecs/vf.h"
@@ -572,11 +572,11 @@ getcolor(char * s){
     if  (s==NULL) return -1;
     i=strtol(s, &rest, 10);
     if ((rest==NULL || strlen(rest)==0) && i>=0 && i<=5) return i;
-    if (!strcasecmp(s, "normal")) return AA_NORMAL;
-    else if (!strcasecmp(s, "dim")) return AA_DIM;
-    else if (!strcasecmp(s, "bold")) return AA_BOLD;
-    else if (!strcasecmp(s, "boldfont")) return AA_BOLDFONT;
-    else if (!strcasecmp(s, "special")) return AA_SPECIAL;
+    if (!av_strcasecmp(s, "normal")) return AA_NORMAL;
+    else if (!av_strcasecmp(s, "dim")) return AA_DIM;
+    else if (!av_strcasecmp(s, "bold")) return AA_BOLD;
+    else if (!av_strcasecmp(s, "boldfont")) return AA_BOLDFONT;
+    else if (!av_strcasecmp(s, "special")) return AA_SPECIAL;
     else return -1;
 }

diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c
index 2ce182159..f5c9fb2db 100644
--- a/libvo/vo_dfbmga.c
+++ b/libvo/vo_dfbmga.c
@@ -26,9 +26,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "video_out.h"
 #define NO_DRAW_FRAME
 #include "video_out_internal.h"
@@ -1339,19 +1339,19 @@ set_equalizer( const char *data, int value )

      ca.flags = DCAF_NONE;

-     if (!strcasecmp( data, "brightness" )) {
+     if (!av_strcasecmp( data, "brightness" )) {
           ca.flags      |= DCAF_BRIGHTNESS;
           ca.brightness  = value * factor + 0x8000;
      }
-     if (!strcasecmp( data, "contrast" )) {
+     if (!av_strcasecmp( data, "contrast" )) {
           ca.flags    |= DCAF_CONTRAST;
           ca.contrast  = value * factor + 0x8000;
      }
-     if (!strcasecmp( data, "hue" )) {
+     if (!av_strcasecmp( data, "hue" )) {
           ca.flags |= DCAF_HUE;
           ca.hue    = value * factor + 0x8000;
      }
-     if (!strcasecmp( data, "saturation" )) {
+     if (!av_strcasecmp( data, "saturation" )) {
           ca.flags      |= DCAF_SATURATION;
           ca.saturation  = value * factor + 0x8000;
      }
@@ -1388,16 +1388,16 @@ get_equalizer( const char *data, int *value )
      if (res != DFB_OK)
           return VO_FALSE;

-     if (!strcasecmp( data, "brightness" ) &&
+     if (!av_strcasecmp( data, "brightness" ) &&
          (ca.flags & DCAF_BRIGHTNESS))
           *value = (ca.brightness - 0x8000) * factor;
-     if (!strcasecmp( data, "contrast" ) &&
+     if (!av_strcasecmp( data, "contrast" ) &&
          (ca.flags & DCAF_CONTRAST))
           *value = (ca.contrast - 0x8000) * factor;
-     if (!strcasecmp( data, "hue" ) &&
+     if (!av_strcasecmp( data, "hue" ) &&
          (ca.flags & DCAF_HUE))
           *value = (ca.hue - 0x8000) * factor;
-     if (!strcasecmp( data, "saturation" ) &&
+     if (!av_strcasecmp( data, "saturation" ) &&
          (ca.flags & DCAF_SATURATION))
           *value = (ca.saturation - 0x8000) * factor;

diff --git a/libvo/vo_dxr2.c b/libvo/vo_dxr2.c
index 1632d5db4..a9371e162 100644
--- a/libvo/vo_dxr2.c
+++ b/libvo/vo_dxr2.c
@@ -20,7 +20,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
@@ -31,6 +30,7 @@
 #include <errno.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "aspect.h"
 #include "video_out.h"
 #define NO_DRAW_SLICE
@@ -824,7 +824,7 @@ static int preinit(const char *arg) {
 	const vo_info_t* vi = video_out_drivers[n]->info;
 	if(!vi)
 	  continue;
-	if(strcasecmp(arg,vi->short_name) == 0)
+	if(av_strcasecmp(arg,vi->short_name) == 0)
 	  break;
       }
       sub_vo = video_out_drivers[n];
diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c
index 58a4ecd08..748acbba1 100644
--- a/libvo/vo_dxr3.c
+++ b/libvo/vo_dxr3.c
@@ -29,13 +29,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <time.h>
 #include <math.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"
 #include "fastmemcpy.h"
@@ -256,11 +256,11 @@ static int control(uint32_t request, void *data)

 		if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0)
 		    return VO_FALSE;
-		if (!strcasecmp(eq->item, "brightness"))
+		if (!av_strcasecmp(eq->item, "brightness"))
 		    bcs.brightness = (eq->value+100)*5;
-		else if (!strcasecmp(eq->item, "contrast"))
+		else if (!av_strcasecmp(eq->item, "contrast"))
 		    bcs.contrast = (eq->value+100)*5;
-		else if (!strcasecmp(eq->item, "saturation"))
+		else if (!av_strcasecmp(eq->item, "saturation"))
 		    bcs.saturation = (eq->value+100)*5;
 		else return VO_FALSE;

@@ -276,11 +276,11 @@ static int control(uint32_t request, void *data)
 		if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0)
 		    return VO_FALSE;

-		if (!strcasecmp(eq->item, "brightness"))
+		if (!av_strcasecmp(eq->item, "brightness"))
 		    eq->value = (bcs.brightness/5)-100;
-		else if (!strcasecmp(eq->item, "contrast"))
+		else if (!av_strcasecmp(eq->item, "contrast"))
 		    eq->value = (bcs.contrast/5)-100;
-		else if (!strcasecmp(eq->item, "saturation"))
+		else if (!av_strcasecmp(eq->item, "saturation"))
 		    eq->value = (bcs.saturation/5)-100;
 		else return VO_FALSE;

diff --git a/libvo/vo_matrixview.c b/libvo/vo_matrixview.c
index fb2abf619..ee2735b1c 100644
--- a/libvo/vo_matrixview.c
+++ b/libvo/vo_matrixview.c
@@ -25,7 +25,8 @@
 #include "config.h"

 #include <stdint.h>
-#include <strings.h>
+
+#include "libavutil/avstring.h"

 #include "mp_msg.h"
 #include "subopt-helper.h"
@@ -266,9 +267,9 @@ static int control(uint32_t request, void *data)
         {
             vf_equalizer_t *eq=data;

-            if (strcasecmp(eq->item, "contrast") == 0) {
+            if (av_strcasecmp(eq->item, "contrast") == 0) {
                 eq->value = eq_contrast;
-            } else if (strcasecmp(eq->item, "brightness") == 0) {
+            } else if (av_strcasecmp(eq->item, "brightness") == 0) {
                 eq->value = eq_brightness;
             }
         }
@@ -276,9 +277,9 @@ static int control(uint32_t request, void *data)
     case VOCTRL_SET_EQUALIZER:
         {
             vf_equalizer_t *eq=data;
-            if (strcasecmp(eq->item, "contrast") == 0) {
+            if (av_strcasecmp(eq->item, "contrast") == 0) {
                 contrast_set(eq->value);
-            } else if (strcasecmp(eq->item, "brightness") == 0) {
+            } else if (av_strcasecmp(eq->item, "brightness") == 0) {
                 brightness_set(eq->value);
             }
         }
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index 21b6ed20a..b24173889 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -33,7 +33,6 @@
  */

 #include <stdio.h>
-#include <strings.h>
 #include <vdpau/vdpau_x11.h>

 #include "config.h"
@@ -54,6 +53,7 @@
 #include "libavcodec/vdpau.h"

 #include "libavutil/common.h"
+#include "libavutil/avstring.h"
 #include "libavutil/mathematics.h"


@@ -1386,13 +1386,13 @@ static int preinit(const char *arg)

 static int get_equalizer(const char *name, int *value)
 {
-    if (!strcasecmp(name, "brightness"))
+    if (!av_strcasecmp(name, "brightness"))
         *value = procamp.brightness * 100;
-    else if (!strcasecmp(name, "contrast"))
+    else if (!av_strcasecmp(name, "contrast"))
         *value = (procamp.contrast-1.0) * 100;
-    else if (!strcasecmp(name, "saturation"))
+    else if (!av_strcasecmp(name, "saturation"))
         *value = (procamp.saturation-1.0) * 100;
-    else if (!strcasecmp(name, "hue"))
+    else if (!av_strcasecmp(name, "hue"))
         *value = procamp.hue * 100 / M_PI;
     else
         return VO_NOTIMPL;
@@ -1401,13 +1401,13 @@ static int get_equalizer(const char *name, int *value)

 static int set_equalizer(const char *name, int value)
 {
-    if (!strcasecmp(name, "brightness"))
+    if (!av_strcasecmp(name, "brightness"))
         procamp.brightness = value / 100.0;
-    else if (!strcasecmp(name, "contrast"))
+    else if (!av_strcasecmp(name, "contrast"))
         procamp.contrast = value / 100.0 + 1.0;
-    else if (!strcasecmp(name, "saturation"))
+    else if (!av_strcasecmp(name, "saturation"))
         procamp.saturation = value / 100.0 + 1.0;
-    else if (!strcasecmp(name, "hue"))
+    else if (!av_strcasecmp(name, "hue"))
         procamp.hue = value / 100.0 * M_PI;
     else
         return VO_NOTIMPL;
diff --git a/libvo/vo_xvr100.c b/libvo/vo_xvr100.c
index 5ac475258..9ac4aa07e 100644
--- a/libvo/vo_xvr100.c
+++ b/libvo/vo_xvr100.c
@@ -39,7 +39,6 @@
 #include <fcntl.h>
 #include <sys/fbio.h>
 #include <sys/visual_io.h>
-#include <strings.h>
 #include <sys/mman.h>

 #include "config.h"
diff --git a/libvo/vo_zr.c b/libvo/vo_zr.c
index 2953dbbf5..8676f2315 100644
--- a/libvo/vo_zr.c
+++ b/libvo/vo_zr.c
@@ -24,7 +24,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -36,6 +35,7 @@
 #include <linux/types.h>
 #include <linux/videodev.h>
 #include "config.h"
+#include "libavutil/avstring.h"
 #include "videodev_mjpeg.h"
 #include "video_out.h"
 #include "video_out_internal.h"
@@ -671,7 +671,7 @@ vo_zr_parseoption(const m_option_t* conf, const char *opt, const char *param){
     zr_info_t *zr = &zr_info[zr_parsing];
     int i;
     /* do WE need it ?, always */
-    if (!strcasecmp(opt, "zrdev")) {
+    if (!av_strcasecmp(opt, "zrdev")) {
 	if (param == NULL) return ERR_MISSING_PARAM;
 	//if ((i=getcolor(param))==-1) return ERR_OUT_OF_RANGE;
 	//aaopt_osdcolor=i;
@@ -680,19 +680,19 @@ vo_zr_parseoption(const m_option_t* conf, const char *opt, const char *param){
 	strcpy(zr->device, param);
 	mp_msg(MSGT_VO, MSGL_V, "zr: using device %s\n", zr->device);
 	return 1;
-    } else if (!strcasecmp(opt, "zrbw")) {
+    } else if (!av_strcasecmp(opt, "zrbw")) {
 	    if (param != NULL) {
 		    return ERR_OUT_OF_RANGE;
 	    }
 	    zr->bw = 1;
 	    return 1;
-    } else if (!strcasecmp(opt, "zrfd")) {
+    } else if (!av_strcasecmp(opt, "zrfd")) {
 	    if (param != NULL) {
 		    return ERR_OUT_OF_RANGE;
 	    }
 	    zr->fd = 1;
 	    return 1;
-    } else if (!strcasecmp(opt, "zrcrop")){
+    } else if (!av_strcasecmp(opt, "zrcrop")){
         geo_t *g = &zr->g;
 	if (g->set == 1) {
 		zr_parsing++;
@@ -716,43 +716,43 @@ vo_zr_parseoption(const m_option_t* conf, const char *opt, const char *param){
 	g->set = 1;
 	mp_msg(MSGT_VO, MSGL_V, "zr: cropping %s\n", param);
 	return 1;
-    }else if (!strcasecmp(opt, "zrhdec")) {
+    }else if (!av_strcasecmp(opt, "zrhdec")) {
         i = atoi(param);
 	if (i != 1 && i != 2 && i != 4) return ERR_OUT_OF_RANGE;
 	zr->hdec = i;
 	return 1;
-    }else if (!strcasecmp(opt, "zrvdec")) {
+    }else if (!av_strcasecmp(opt, "zrvdec")) {
         i = atoi(param);
 	if (i != 1 && i != 2 && i != 4) return ERR_OUT_OF_RANGE;
 	zr->vdec = i;
 	return 1;
-    }else if (!strcasecmp(opt, "zrxdoff")) {
+    }else if (!av_strcasecmp(opt, "zrxdoff")) {
         i = atoi(param);
 	zr->xdoff = i;
 	return 1;
-    }else if (!strcasecmp(opt, "zrydoff")) {
+    }else if (!av_strcasecmp(opt, "zrydoff")) {
         i = atoi(param);
 	zr->ydoff = i;
 	return 1;
-    }else if (!strcasecmp(opt, "zrquality")) {
+    }else if (!av_strcasecmp(opt, "zrquality")) {
         i = atoi(param);
 	if (i < 1 || i > 20) return ERR_OUT_OF_RANGE;
 	zr->quality = i;
 	return 1;
-    }else if (!strcasecmp(opt, "zrnorm")) {
+    }else if (!av_strcasecmp(opt, "zrnorm")) {
 	if (param == NULL) return ERR_MISSING_PARAM;
-	if (!strcasecmp(param, "NTSC")) {
+	if (!av_strcasecmp(param, "NTSC")) {
             mp_msg(MSGT_VO, MSGL_V, "zr: Norm set to NTSC\n");
             zr->norm = VIDEO_MODE_NTSC;
 	    return 1;
-	} else if (!strcasecmp(param, "PAL")) {
+	} else if (!av_strcasecmp(param, "PAL")) {
 	    mp_msg(MSGT_VO, MSGL_V, "zr: Norm set to PAL\n");
             zr->norm = VIDEO_MODE_PAL;
 	    return 1;
 	} else {
            return ERR_OUT_OF_RANGE;
         }
-    }else if (!strcasecmp(opt, "zrhelp")){
+    }else if (!av_strcasecmp(opt, "zrhelp")){
 	printf("Help for -vo zr: Zoran ZR360[56]7/ZR36060 based MJPEG capture/playback cards\n");
 	printf("\n");
 	printf("Here are the zr options:\n");
@@ -798,26 +798,26 @@ void vo_zr_revertoption(const m_option_t* opt,const char* param) {
   zr_count = 1;
   zr_parsing = 0;

-  if (!strcasecmp(param, "zrdev")) {
+  if (!av_strcasecmp(param, "zrdev")) {
     free(zr->device);
     zr->device=NULL;
-  } else if (!strcasecmp(param, "zrbw"))
+  } else if (!av_strcasecmp(param, "zrbw"))
     zr->bw=0;
-  else if (!strcasecmp(param, "zrfd"))
+  else if (!av_strcasecmp(param, "zrfd"))
     zr->fd=0;
-  else if (!strcasecmp(param, "zrcrop"))
+  else if (!av_strcasecmp(param, "zrcrop"))
     zr->g.set = zr->g.xoff = zr->g.yoff = 0;
-  else if (!strcasecmp(param, "zrhdec"))
+  else if (!av_strcasecmp(param, "zrhdec"))
     zr->hdec = 1;
-  else if (!strcasecmp(param, "zrvdec"))
+  else if (!av_strcasecmp(param, "zrvdec"))
     zr->vdec = 1;
-  else if (!strcasecmp(param, "zrxdoff"))
+  else if (!av_strcasecmp(param, "zrxdoff"))
     zr->xdoff = -1;
-  else if (!strcasecmp(param, "zrydoff"))
+  else if (!av_strcasecmp(param, "zrydoff"))
     zr->ydoff = -1;
-  else if (!strcasecmp(param, "zrquality"))
+  else if (!av_strcasecmp(param, "zrquality"))
     zr->quality = 2;
-  else if (!strcasecmp(param, "zrnorm"))
+  else if (!av_strcasecmp(param, "zrnorm"))
     zr->norm = VIDEO_MODE_AUTO;

 }
diff --git a/libvo/vosub_vidix.c b/libvo/vosub_vidix.c
index 201a920b8..17c34ec5a 100644
--- a/libvo/vosub_vidix.c
+++ b/libvo/vosub_vidix.c
@@ -32,10 +32,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <errno.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"

@@ -599,22 +599,22 @@ uint32_t vidix_control(uint32_t request, void *data)
 //    printf("vidix seteq %s -> %d  \n",eq->item,eq->value);

     /* vidix eq ranges are -1000..1000 */
-    if (!strcasecmp(eq->item, "brightness"))
+    if (!av_strcasecmp(eq->item, "brightness"))
     {
 	info.brightness = eq->value*10;
 	info.cap = VEQ_CAP_BRIGHTNESS;
     }
-    else if (!strcasecmp(eq->item, "contrast"))
+    else if (!av_strcasecmp(eq->item, "contrast"))
     {
 	info.contrast = eq->value*10;
 	info.cap = VEQ_CAP_CONTRAST;
     }
-    else if (!strcasecmp(eq->item, "saturation"))
+    else if (!av_strcasecmp(eq->item, "saturation"))
     {
 	info.saturation = eq->value*10;
 	info.cap = VEQ_CAP_SATURATION;
     }
-    else if (!strcasecmp(eq->item, "hue"))
+    else if (!av_strcasecmp(eq->item, "hue"))
     {
 	info.hue = eq->value*10;
 	info.cap = VEQ_CAP_HUE;
@@ -634,22 +634,22 @@ uint32_t vidix_control(uint32_t request, void *data)
 	return VO_FALSE;

     /* vidix eq ranges are -1000..1000 */
-    if (!strcasecmp(eq->item, "brightness"))
+    if (!av_strcasecmp(eq->item, "brightness"))
     {
 	if (info.cap & VEQ_CAP_BRIGHTNESS)
 	    eq->value = info.brightness/10;
     }
-    else if (!strcasecmp(eq->item, "contrast"))
+    else if (!av_strcasecmp(eq->item, "contrast"))
     {
 	if (info.cap & VEQ_CAP_CONTRAST)
 	    eq->value = info.contrast/10;
     }
-    else if (!strcasecmp(eq->item, "saturation"))
+    else if (!av_strcasecmp(eq->item, "saturation"))
     {
 	if (info.cap & VEQ_CAP_SATURATION)
 	    eq->value = info.saturation/10;
     }
-    else if (!strcasecmp(eq->item, "hue"))
+    else if (!av_strcasecmp(eq->item, "hue"))
     {
 	if (info.cap & VEQ_CAP_HUE)
 	    eq->value = info.hue/10;
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 415d99f97..e9bace2fd 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -27,10 +27,10 @@
 #include "mp_msg.h"
 #include "mp_fifo.h"
 #include "libavutil/common.h"
+#include "libavutil/avstring.h"
 #include "x11_common.h"

 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <assert.h>

@@ -1903,11 +1903,11 @@ uint32_t vo_x11_set_equalizer(const char *name, int value)
     if (cmap == None)
         return VO_NOTAVAIL;

-    if (!strcasecmp(name, "brightness"))
+    if (!av_strcasecmp(name, "brightness"))
         vo_brightness = value;
-    else if (!strcasecmp(name, "contrast"))
+    else if (!av_strcasecmp(name, "contrast"))
         vo_contrast = value;
-    else if (!strcasecmp(name, "gamma"))
+    else if (!av_strcasecmp(name, "gamma"))
         vo_gamma = value;
     else
         return VO_NOTIMPL;
@@ -1938,11 +1938,11 @@ uint32_t vo_x11_get_equalizer(const char *name, int *value)
 {
     if (cmap == None)
         return VO_NOTAVAIL;
-    if (!strcasecmp(name, "brightness"))
+    if (!av_strcasecmp(name, "brightness"))
         *value = vo_brightness;
-    else if (!strcasecmp(name, "contrast"))
+    else if (!av_strcasecmp(name, "contrast"))
         *value = vo_contrast;
-    else if (!strcasecmp(name, "gamma"))
+    else if (!av_strcasecmp(name, "gamma"))
         *value = vo_gamma;
     else
         return VO_NOTIMPL;
@@ -1970,29 +1970,29 @@ int vo_xv_set_eq(uint32_t xv_port, const char *name, int value)
                 int hue = 0, port_value, port_min, port_max;

                 if (!strcmp(attributes[i].name, "XV_BRIGHTNESS") &&
-                    (!strcasecmp(name, "brightness")))
+                    (!av_strcasecmp(name, "brightness")))
                     port_value = value;
                 else if (!strcmp(attributes[i].name, "XV_CONTRAST") &&
-                         (!strcasecmp(name, "contrast")))
+                         (!av_strcasecmp(name, "contrast")))
                     port_value = value;
                 else if (!strcmp(attributes[i].name, "XV_SATURATION") &&
-                         (!strcasecmp(name, "saturation")))
+                         (!av_strcasecmp(name, "saturation")))
                     port_value = value;
                 else if (!strcmp(attributes[i].name, "XV_HUE") &&
-                         (!strcasecmp(name, "hue")))
+                         (!av_strcasecmp(name, "hue")))
                 {
                     port_value = value;
                     hue = 1;
                 } else
                     /* Note: since 22.01.2002 GATOS supports these attrs for radeons (NK) */
                 if (!strcmp(attributes[i].name, "XV_RED_INTENSITY") &&
-                        (!strcasecmp(name, "red_intensity")))
+                        (!av_strcasecmp(name, "red_intensity")))
                     port_value = value;
                 else if (!strcmp(attributes[i].name, "XV_GREEN_INTENSITY")
-                         && (!strcasecmp(name, "green_intensity")))
+                         && (!av_strcasecmp(name, "green_intensity")))
                     port_value = value;
                 else if (!strcmp(attributes[i].name, "XV_BLUE_INTENSITY")
-                         && (!strcasecmp(name, "blue_intensity")))
+                         && (!av_strcasecmp(name, "blue_intensity")))
                     port_value = value;
                 else
                     continue;
@@ -2048,16 +2048,16 @@ int vo_xv_get_eq(uint32_t xv_port, const char *name, int *value)
                     100;

                 if (!strcmp(attributes[i].name, "XV_BRIGHTNESS") &&
-                    (!strcasecmp(name, "brightness")))
+                    (!av_strcasecmp(name, "brightness")))
                     *value = val;
                 else if (!strcmp(attributes[i].name, "XV_CONTRAST") &&
-                         (!strcasecmp(name, "contrast")))
+                         (!av_strcasecmp(name, "contrast")))
                     *value = val;
                 else if (!strcmp(attributes[i].name, "XV_SATURATION") &&
-                         (!strcasecmp(name, "saturation")))
+                         (!av_strcasecmp(name, "saturation")))
                     *value = val;
                 else if (!strcmp(attributes[i].name, "XV_HUE") &&
-                         (!strcasecmp(name, "hue")))
+                         (!av_strcasecmp(name, "hue")))
                 {
                     /* nasty nvidia detect */
                     if (port_min == 0 && port_max == 360)
@@ -2067,13 +2067,13 @@ int vo_xv_get_eq(uint32_t xv_port, const char *name, int *value)
                 } else
                     /* Note: since 22.01.2002 GATOS supports these attrs for radeons (NK) */
                 if (!strcmp(attributes[i].name, "XV_RED_INTENSITY") &&
-                        (!strcasecmp(name, "red_intensity")))
+                        (!av_strcasecmp(name, "red_intensity")))
                     *value = val;
                 else if (!strcmp(attributes[i].name, "XV_GREEN_INTENSITY")
-                         && (!strcasecmp(name, "green_intensity")))
+                         && (!av_strcasecmp(name, "green_intensity")))
                     *value = val;
                 else if (!strcmp(attributes[i].name, "XV_BLUE_INTENSITY")
-                         && (!strcasecmp(name, "blue_intensity")))
+                         && (!av_strcasecmp(name, "blue_intensity")))
                     *value = val;
                 else
                     continue;
diff --git a/loader/dshow/DS_VideoDecoder.c b/loader/dshow/DS_VideoDecoder.c
index f98fd21ec..dd0396f4f 100644
--- a/loader/dshow/DS_VideoDecoder.c
+++ b/loader/dshow/DS_VideoDecoder.c
@@ -5,6 +5,7 @@

 *********************************************************/
 #include "config.h"
+#include "libavutil/avstring.h"
 #include "guids.h"
 #include "interfaces.h"
 #include "loader/registry.h"
@@ -44,7 +45,6 @@ static SampleProcUserData sampleProcData;
 #endif
 #include <stdio.h>
 #include <stdlib.h>  // labs
-#include <strings.h>

 // strcmp((const char*)info.dll,...)  is used instead of  (... == ...)
 // so Arpi could use char* pointer in his simplified DS_VideoDecoder class
@@ -762,15 +762,15 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)
 	    printf("No such interface\n");
 	    return -1;
 	}
-	if (strcasecmp(name, "Postprocessing") == 0)
+	if (av_strcasecmp(name, "Postprocessing") == 0)
 	    pIDivx->vt->put_PPLevel(pIDivx, value * 10);
-	else if (strcasecmp(name, "Brightness") == 0)
+	else if (av_strcasecmp(name, "Brightness") == 0)
 	    pIDivx->vt->put_Brightness(pIDivx, value);
-	else if (strcasecmp(name, "Contrast") == 0)
+	else if (av_strcasecmp(name, "Contrast") == 0)
 	    pIDivx->vt->put_Contrast(pIDivx, value);
-	else if (strcasecmp(name, "Saturation") == 0)
+	else if (av_strcasecmp(name, "Saturation") == 0)
 	    pIDivx->vt->put_Saturation(pIDivx, value);
-	else if (strcasecmp(name, "MaxAuto") == 0)
+	else if (av_strcasecmp(name, "MaxAuto") == 0)
             this->m_iMaxAuto = value;
 	pIDivx->vt->Release((IUnknown*)pIDivx);
 	//printf("Set %s  %d\n", name, value);
@@ -796,20 +796,20 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)
 	// get6=set5 23
     	hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
 	//printf("DS_SetValue for DIVX, name=%s  value=%d\n",name,value);
-	if (strcasecmp(name, "Quality") == 0)
+	if (av_strcasecmp(name, "Quality") == 0)
 	{
             this->m_iLastQuality = value;
 	    return hidden->vt->SetSmth(hidden, value, 0);
 	}
-	if (strcasecmp(name, "Brightness") == 0)
+	if (av_strcasecmp(name, "Brightness") == 0)
 	    return hidden->vt->SetSmth2(hidden, value, 0);
-	if (strcasecmp(name, "Contrast") == 0)
+	if (av_strcasecmp(name, "Contrast") == 0)
 	    return hidden->vt->SetSmth3(hidden, value, 0);
-	if (strcasecmp(name, "Saturation") == 0)
+	if (av_strcasecmp(name, "Saturation") == 0)
 	    return hidden->vt->SetSmth4(hidden, value, 0);
-	if (strcasecmp(name, "Hue") == 0)
+	if (av_strcasecmp(name, "Hue") == 0)
 	    return hidden->vt->SetSmth5(hidden, value, 0);
-	if (strcasecmp(name, "MaxAuto") == 0)
+	if (av_strcasecmp(name, "MaxAuto") == 0)
 	{
             this->m_iMaxAuto = value;
 	}
@@ -863,7 +863,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)

 int DS_SetAttr_DivX(char* attribute, int value){
     int result, status, newkey;
-        if(strcasecmp(attribute, "Quality")==0){
+        if(av_strcasecmp(attribute, "Quality")==0){
 	    char* keyname="SOFTWARE\\Microsoft\\Scrunch";
     	    result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0,	   		&newkey, &status);
             if(result!=0)
@@ -889,10 +889,10 @@ int DS_SetAttr_DivX(char* attribute, int value){
 	}

         if(
-	(strcasecmp(attribute, "Saturation")==0) ||
-	(strcasecmp(attribute, "Hue")==0) ||
-	(strcasecmp(attribute, "Contrast")==0) ||
-	(strcasecmp(attribute, "Brightness")==0)
+	(av_strcasecmp(attribute, "Saturation")==0) ||
+	(av_strcasecmp(attribute, "Hue")==0) ||
+	(av_strcasecmp(attribute, "Contrast")==0) ||
+	(av_strcasecmp(attribute, "Brightness")==0)
 	)
         {
 	    char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video";
diff --git a/loader/ext.c b/loader/ext.c
index b2768f51b..5483a0b7e 100644
--- a/loader/ext.c
+++ b/loader/ext.c
@@ -23,10 +23,10 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
-#include <strings.h>
 #include <stdarg.h>
 #include <ctype.h>

+#include "libavutil/avstring.h"
 #include "osdep/mmap_anon.h"
 #include "wine/windef.h"
 #include "wine/winbase.h"
@@ -120,7 +120,7 @@ WIN_BOOL WINAPI ReadFile(HANDLE handle, LPVOID mem, DWORD size, LPDWORD result,
 }
 INT WINAPI lstrcmpiA(LPCSTR c1, LPCSTR c2)
 {
-    return strcasecmp(c1,c2);
+    return av_strcasecmp(c1,c2);
 }
 LPSTR WINAPI lstrcpynA(LPSTR dest, LPCSTR src, INT num)
 {
diff --git a/loader/win32.c b/loader/win32.c
index 4e7db1572..6d559a7e7 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -55,7 +55,6 @@ for DLL to know too much about its environment.
 #include "path.h"

 #include <stdlib.h>
-#include <strings.h>
 #include <assert.h>
 #include <stdarg.h>
 #include <ctype.h>
@@ -587,10 +586,10 @@ static HMODULE WINAPI expGetModuleHandleA(const char* name)
     }
     if(!result)
     {
-	if(name && (strcasecmp(name, "kernel32")==0 || !strcasecmp(name, "kernel32.dll")))
+	if(name && (av_strcasecmp(name, "kernel32")==0 || !av_strcasecmp(name, "kernel32.dll")))
 	    result=MODULE_HANDLE_kernel32;
 #ifdef CONFIG_QTX_CODECS
-	if(name && strcasecmp(name, "user32")==0)
+	if(name && av_strcasecmp(name, "user32")==0)
 	    result=MODULE_HANDLE_user32;
 #endif
     }
@@ -2147,7 +2146,7 @@ static double linux_cpuinfo_freq(void)
 	    if ((s=strchr(value,'\n')))
 		*s='\0';

-	    if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz"))
+	    if (!av_strncasecmp(line, "cpu MHz",strlen("cpu MHz"))
 		&& sscanf(value, "%lf", &freq) == 1) {
 		freq*=1000;
 		break;
@@ -2532,33 +2531,33 @@ static int WINAPI expLoadLibraryA(char* name)
     dbgprintf("Entering LoadLibraryA(%s)\n", name);

     // PIMJ and VIVO audio are loading  kernel32.dll
-    if (strcasecmp(name, "kernel32.dll") == 0 || strcasecmp(name, "kernel32") == 0)
+    if (av_strcasecmp(name, "kernel32.dll") == 0 || av_strcasecmp(name, "kernel32") == 0)
 	return MODULE_HANDLE_kernel32;
 //	return ERROR_SUCCESS; /* yeah, we have also the kernel32 calls */
 			      /* exported -> do not return failed! */

-    if (strcasecmp(name, "user32.dll") == 0 || strcasecmp(name, "user32") == 0)
+    if (av_strcasecmp(name, "user32.dll") == 0 || av_strcasecmp(name, "user32") == 0)
 //	return MODULE_HANDLE_kernel32;
 	return MODULE_HANDLE_user32;

 #ifdef CONFIG_QTX_CODECS
-    if (strcasecmp(name, "wininet.dll") == 0 || strcasecmp(name, "wininet") == 0)
+    if (av_strcasecmp(name, "wininet.dll") == 0 || av_strcasecmp(name, "wininet") == 0)
 	return MODULE_HANDLE_wininet;
-    if (strcasecmp(name, "ddraw.dll") == 0 || strcasecmp(name, "ddraw") == 0)
+    if (av_strcasecmp(name, "ddraw.dll") == 0 || av_strcasecmp(name, "ddraw") == 0)
 	return MODULE_HANDLE_ddraw;
-    if (strcasecmp(name, "advapi32.dll") == 0 || strcasecmp(name, "advapi32") == 0)
+    if (av_strcasecmp(name, "advapi32.dll") == 0 || av_strcasecmp(name, "advapi32") == 0)
 	return MODULE_HANDLE_advapi32;
 #endif

-    if (strcasecmp(name, "comdlg32.dll") == 0 || strcasecmp(name, "comdlg32") == 0)
+    if (av_strcasecmp(name, "comdlg32.dll") == 0 || av_strcasecmp(name, "comdlg32") == 0)
 	return MODULE_HANDLE_comdlg32;
-    if (strcasecmp(name, "msvcrt.dll") == 0 || strcasecmp(name, "msvcrt") == 0)
+    if (av_strcasecmp(name, "msvcrt.dll") == 0 || av_strcasecmp(name, "msvcrt") == 0)
 	return MODULE_HANDLE_msvcrt;
-    if (strcasecmp(name, "ole32.dll") == 0 || strcasecmp(name, "ole32") == 0)
+    if (av_strcasecmp(name, "ole32.dll") == 0 || av_strcasecmp(name, "ole32") == 0)
 	return MODULE_HANDLE_ole32;
-    if (strcasecmp(name, "winmm.dll") == 0 || strcasecmp(name, "winmm") == 0)
+    if (av_strcasecmp(name, "winmm.dll") == 0 || av_strcasecmp(name, "winmm") == 0)
 	return MODULE_HANDLE_winmm;
-    if (strcasecmp(name, "psapi.dll") == 0 || strcasecmp(name, "psapi") == 0)
+    if (av_strcasecmp(name, "psapi.dll") == 0 || av_strcasecmp(name, "psapi") == 0)
 	return MODULE_HANDLE_psapi;

     result=LoadLibraryA(name);
@@ -3955,7 +3954,7 @@ static int WINAPI expMulDiv(int nNumber, int nNumerator, int nDenominator)

 static LONG WINAPI explstrcmpiA(const char* str1, const char* str2)
 {
-    LONG result=strcasecmp(str1, str2);
+    LONG result=av_strcasecmp(str1, str2);
     dbgprintf("strcmpi(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result);
     return result;
 }
@@ -4615,7 +4614,7 @@ static char *exp_mbsupr(char *str)

 static int exp_stricmp(const char* s1, const char* s2)
 {
-    return strcasecmp(s1, s2);
+    return av_strcasecmp(s1, s2);
 }

 static uint64_t exp_time64(void)
@@ -5748,7 +5747,7 @@ void* LookupExternal(const char* library, int ordinal)

     for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
     {
-	if(strcasecmp(library, libraries[i].name))
+	if(av_strcasecmp(library, libraries[i].name))
 	    continue;
 	for(j=0; j<libraries[i].length; j++)
 	{
@@ -5815,7 +5814,7 @@ void* LookupExternalByName(const char* library, const char* name)
     dbgprintf("External func %s:%s\n", library, name);
     for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
     {
-	if(strcasecmp(library, libraries[i].name))
+	if(av_strcasecmp(library, libraries[i].name))
 	    continue;
 	for(j=0; j<libraries[i].length; j++)
 	{
diff --git a/loader/wine/winestring.h b/loader/wine/winestring.h
index a11614490..7afee092f 100644
--- a/loader/wine/winestring.h
+++ b/loader/wine/winestring.h
@@ -1,7 +1,6 @@
 #ifndef MPLAYER_WINESTRING_H
 #define MPLAYER_WINESTRING_H

-#include <strings.h>

 #include "windef.h"

@@ -10,6 +9,6 @@ LPSTR       WINAPI lstrcpyWtoA(LPSTR,LPCWSTR);
 LPWSTR      WINAPI lstrcpynAtoW(LPWSTR,LPCSTR,INT);
 LPSTR       WINAPI lstrcpynWtoA(LPSTR,LPCWSTR,INT);

-#define lstrncmpiA strncasecmp
+#define lstrncmpiA av_strncasecmp

 #endif /* MPLAYER_WINESTRING_H */
diff --git a/m_config.c b/m_config.c
index e290f7228..ccdab1272 100644
--- a/m_config.c
+++ b/m_config.c
@@ -25,11 +25,11 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-#include <strings.h>
 #ifdef MP_DEBUG
 #include <assert.h>
 #endif

+#include "libavutil/avstring.h"
 #include "m_config.h"
 #include "m_option.h"
 #include "mp_msg.h"
@@ -390,9 +390,9 @@ m_config_get_co(const m_config_t *config, char *arg) {
     int l = strlen(co->name) - 1;
     if((co->opt->type->flags & M_OPT_TYPE_ALLOW_WILDCARD) &&
        (co->name[l] == '*')) {
-      if(strncasecmp(co->name,arg,l) == 0)
+      if(av_strncasecmp(co->name,arg,l) == 0)
 	return co;
-    } else if(strcasecmp(co->name,arg) == 0)
+    } else if(av_strcasecmp(co->name,arg) == 0)
       return co;
   }
   return NULL;
diff --git a/m_option.c b/m_option.c
index 7cc1a744f..268055a78 100644
--- a/m_option.c
+++ b/m_option.c
@@ -23,7 +23,6 @@

 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -50,9 +49,9 @@ const m_option_t* m_option_list_find(const m_option_t* list,const char* name) {
     int l = strlen(list[i].name) - 1;
     if((list[i].type->flags & M_OPT_TYPE_ALLOW_WILDCARD) &&
        (l > 0) && (list[i].name[l] == '*')) {
-      if(strncasecmp(list[i].name,name,l) == 0)
+      if(av_strncasecmp(list[i].name,name,l) == 0)
 	return &list[i];
-    } else if(strcasecmp(list[i].name,name) == 0)
+    } else if(av_strcasecmp(list[i].name,name) == 0)
       return &list[i];
   }
   return NULL;
@@ -99,28 +98,28 @@ static char* dup_printf(const char *fmt, ...) {
 static int parse_flag(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
   if (src == M_CONFIG_FILE) {
     if(!param) return M_OPT_MISSING_PARAM;
-    if (!strcasecmp(param, "yes") ||	/* any other language? */
-	!strcasecmp(param, "on") ||
-	!strcasecmp(param, "ja") ||
-	!strcasecmp(param, "si") ||
-	!strcasecmp(param, "igen") ||
-	!strcasecmp(param, "y") ||
-	!strcasecmp(param, "j") ||
-	!strcasecmp(param, "i") ||
-	!strcasecmp(param, "tak") ||
-	!strcasecmp(param, "ja") ||
-	!strcasecmp(param, "true") ||
+    if (!av_strcasecmp(param, "yes") ||	/* any other language? */
+	!av_strcasecmp(param, "on") ||
+	!av_strcasecmp(param, "ja") ||
+	!av_strcasecmp(param, "si") ||
+	!av_strcasecmp(param, "igen") ||
+	!av_strcasecmp(param, "y") ||
+	!av_strcasecmp(param, "j") ||
+	!av_strcasecmp(param, "i") ||
+	!av_strcasecmp(param, "tak") ||
+	!av_strcasecmp(param, "ja") ||
+	!av_strcasecmp(param, "true") ||
 	!strcmp(param, "1")) {
       if(dst) VAL(dst) = opt->max;
-    } else if (!strcasecmp(param, "no") ||
-	       !strcasecmp(param, "off") ||
-	       !strcasecmp(param, "nein") ||
-	       !strcasecmp(param, "nicht") ||
-	       !strcasecmp(param, "nem") ||
-	       !strcasecmp(param, "n") ||
-	       !strcasecmp(param, "nie") ||
-	       !strcasecmp(param, "nej") ||
-	       !strcasecmp(param, "false") ||
+    } else if (!av_strcasecmp(param, "no") ||
+	       !av_strcasecmp(param, "off") ||
+	       !av_strcasecmp(param, "nein") ||
+	       !av_strcasecmp(param, "nicht") ||
+	       !av_strcasecmp(param, "nem") ||
+	       !av_strcasecmp(param, "n") ||
+	       !av_strcasecmp(param, "nie") ||
+	       !av_strcasecmp(param, "nej") ||
+	       !av_strcasecmp(param, "false") ||
 	       !strcmp(param, "0")) {
       if(dst) VAL(dst) = opt->min;
     } else {
@@ -569,13 +568,13 @@ static int parse_str_list(const m_option_t* opt,const char *name, const char *pa

   if(opt->name[len-1] == '*' && ((int)strlen(name) > len - 1)) {
     const char* n = &name[len-1];
-    if(strcasecmp(n,"-add") == 0)
+    if(av_strcasecmp(n,"-add") == 0)
       op = OP_ADD;
-    else if(strcasecmp(n,"-pre") == 0)
+    else if(av_strcasecmp(n,"-pre") == 0)
       op = OP_PRE;
-    else if(strcasecmp(n,"-del") == 0)
+    else if(av_strcasecmp(n,"-del") == 0)
       op = OP_DEL;
-    else if(strcasecmp(n,"-clr") == 0)
+    else if(av_strcasecmp(n,"-clr") == 0)
       op = OP_CLR;
     else
       return M_OPT_UNKNOWN;
@@ -1196,7 +1195,7 @@ static int parse_imgfmt(const m_option_t* opt,const char *name, const char *para
   if (sscanf(param, "0x%x", &fmt) != 1)
   {
   for(i = 0 ; mp_imgfmt_list[i].name ; i++) {
-    if(!strcasecmp(param,mp_imgfmt_list[i].name)) {
+    if(!av_strcasecmp(param,mp_imgfmt_list[i].name)) {
       fmt=mp_imgfmt_list[i].fmt;
       break;
     }
@@ -1286,7 +1285,7 @@ static int parse_afmt(const m_option_t* opt,const char *name, const char *param,
   if (sscanf(param, "0x%x", &fmt) != 1)
   {
   for(i = 0 ; mp_afmt_list[i].name ; i++) {
-    if(!strcasecmp(param,mp_afmt_list[i].name)) {
+    if(!av_strcasecmp(param,mp_afmt_list[i].name)) {
       fmt=mp_afmt_list[i].fmt;
       break;
     }
@@ -1328,7 +1327,7 @@ int parse_timestring(const char *str, double *time, char endchar)
     *time = 60*a + d;
   else if (sscanf(str, "%lf%n", &d, &len) >= 1)
     *time = d;
-  else if (strncasecmp(str, "nopts", 5) == 0) {
+  else if (av_strncasecmp(str, "nopts", 5) == 0) {
     *time = MP_NOPTS_VALUE;
     len = 5;
   } else
@@ -1385,13 +1384,13 @@ static int parse_time_size(const m_option_t* opt,const char *name, const char *p
   /* End at size parsing */
   if(sscanf(param, "%lf%3s", &end_at, unit) == 2) {
     ts.type = END_AT_SIZE;
-    if(!strcasecmp(unit, "b"))
+    if(!av_strcasecmp(unit, "b"))
       ;
-    else if(!strcasecmp(unit, "kb"))
+    else if(!av_strcasecmp(unit, "kb"))
       end_at *= 1024;
-    else if(!strcasecmp(unit, "mb"))
+    else if(!av_strcasecmp(unit, "mb"))
       end_at *= 1024*1024;
-    else if(!strcasecmp(unit, "gb"))
+    else if(!av_strcasecmp(unit, "gb"))
       end_at *= 1024*1024*1024;
     else
       ts.type = END_AT_NONE;
@@ -1805,13 +1804,13 @@ static int parse_obj_settings_list(const m_option_t* opt,const char *name,

   if(opt->name[len-1] == '*' && ((int)strlen(name) > len - 1)) {
     const char* n = &name[len-1];
-    if(strcasecmp(n,"-add") == 0)
+    if(av_strcasecmp(n,"-add") == 0)
       op = OP_ADD;
-    else if(strcasecmp(n,"-pre") == 0)
+    else if(av_strcasecmp(n,"-pre") == 0)
       op = OP_PRE;
-    else if(strcasecmp(n,"-del") == 0)
+    else if(av_strcasecmp(n,"-del") == 0)
       op = OP_DEL;
-    else if(strcasecmp(n,"-clr") == 0)
+    else if(av_strcasecmp(n,"-clr") == 0)
       op = OP_CLR;
     else {
       char prefix[len];
diff --git a/m_struct.c b/m_struct.c
index fec45b5f7..7899a0cac 100644
--- a/m_struct.c
+++ b/m_struct.c
@@ -23,8 +23,8 @@

 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>

+#include "libavutil/avstring.h"
 #include "m_option.h"
 #include "m_struct.h"
 #include "mp_msg.h"
@@ -34,7 +34,7 @@ m_struct_get_field(const m_struct_t* st,const char* f) {
   int i;

   for(i = 0 ; st->fields[i].name ; i++) {
-    if(strcasecmp(st->fields[i].name,f) == 0)
+    if(av_strcasecmp(st->fields[i].name,f) == 0)
       return &st->fields[i];
   }
   return NULL;
diff --git a/mencoder.c b/mencoder.c
index 9fc3ebe25..791a276b7 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -50,12 +50,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/time.h>
 #if defined(__MINGW32__) || defined(__CYGWIN__)
 #include <windows.h>
 #endif

+#include "libavutil/avstring.h"
 #include "input/input.h"
 #include "libaf/af_format.h"
 #include "libao2/audio_out.h"
@@ -616,14 +616,14 @@ user_correct_pts = 0;
 		switch (out_file_format)
 		{
 			case MUXER_TYPE_AVI:
-			if (strcasecmp(extension,"avi"))
+			if (av_strcasecmp(extension,"avi"))
 				mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatAVI);
 			break;

 			case MUXER_TYPE_MPEG:
-			if (strcasecmp(extension,"mpg") &&
-				strcasecmp(extension,"mpeg") &&
-				strcasecmp(extension,"vob"))
+			if (av_strcasecmp(extension,"mpg") &&
+				av_strcasecmp(extension,"mpeg") &&
+				av_strcasecmp(extension,"vob"))
 				mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatMPG);
 			break;
 		}
diff --git a/mp_msg.c b/mp_msg.c
index c23550312..67bcc067d 100644
--- a/mp_msg.c
+++ b/mp_msg.c
@@ -20,9 +20,9 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#include <strings.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "osdep/getch2.h"

 #ifdef CONFIG_ICONV
@@ -59,8 +59,8 @@ const char* filename_recode(const char* filename)
     size_t filename_len, max_path;
     char* precoded;
     if (!mp_msg_charset ||
-        !strcasecmp(mp_msg_charset, MSG_CHARSET) ||
-        !strcasecmp(mp_msg_charset, "noconv"))
+        !av_strcasecmp(mp_msg_charset, MSG_CHARSET) ||
+        !av_strcasecmp(mp_msg_charset, "noconv"))
         return filename;
     if (inv_msgiconv == (iconv_t)(-1)) {
         inv_msgiconv = iconv_open(MSG_CHARSET, mp_msg_charset);
@@ -216,7 +216,7 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va){
     tmp[MSGSIZE_MAX-1] = 0;

 #if defined(CONFIG_ICONV) && defined(MSG_CHARSET)
-    if (mp_msg_charset && strcasecmp(mp_msg_charset, "noconv")) {
+    if (mp_msg_charset && av_strcasecmp(mp_msg_charset, "noconv")) {
       char tmp2[MSGSIZE_MAX];
       size_t inlen = strlen(tmp), outlen = MSGSIZE_MAX;
       char *in = tmp, *out = tmp2;
diff --git a/mplayer.c b/mplayer.c
index 5b933f7fd..3ab0f2d10 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -25,7 +25,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <time.h>
 #include <unistd.h>
 #include <assert.h>
@@ -429,7 +428,7 @@ static char *get_demuxer_info(char *tag)
         return NULL;

     for (n = 0; info[2 * n] != NULL; n++)
-        if (!strcasecmp(info[2 * n], tag))
+        if (!av_strcasecmp(info[2 * n], tag))
             break;

     return info[2 * n + 1] ? strdup(info[2 * n + 1]) : NULL;
diff --git a/osdep/priority.c b/osdep/priority.c
index b532b0b4f..280cdb629 100644
--- a/osdep/priority.c
+++ b/osdep/priority.c
@@ -26,8 +26,8 @@
 #include <windows.h>
 #endif
 #include <string.h>
-#include <strings.h>

+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"

@@ -58,7 +58,7 @@ void set_priority(void)
         int i;

         for (i = 0; priority_presets_defs[i].name; i++) {
-            if (strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
+            if (av_strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
                 break;
         }
         mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_SettingProcessPriority,
diff --git a/parser-mpcmd.c b/parser-mpcmd.c
index 4d298857b..a97a5b910 100644
--- a/parser-mpcmd.c
+++ b/parser-mpcmd.c
@@ -24,13 +24,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <errno.h>

 #ifdef MP_DEBUG
 #include <assert.h>
 #endif

+#include "libavutil/avstring.h"
+
 #include "mp_msg.h"
 #include "help_mp.h"
 #include "m_option.h"
@@ -56,7 +57,7 @@ static int is_entry_option(char *opt, char *param, play_tree_t** ret) {

   *ret = NULL;

-  if(strcasecmp(opt,"playlist") == 0) { // We handle playlist here
+  if(av_strcasecmp(opt,"playlist") == 0) { // We handle playlist here
     if(!param)
       return M_OPT_MISSING_PARAM;

@@ -159,7 +160,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
 	mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "this_opt = option: %s\n", opt);
 	// We handle here some specific option
 	// Loop option when it apply to a group
-	if(strcasecmp(opt,"loop") == 0 &&
+	if(av_strcasecmp(opt,"loop") == 0 &&
 		  (! last_entry || last_entry->child) ) {
 	  int l;
 	  char* end = NULL;
@@ -173,12 +174,12 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
 	    pt->loop = l;
 	    tmp = 1;
 	  }
-	} else if(strcasecmp(opt,"shuffle") == 0) {
+	} else if(av_strcasecmp(opt,"shuffle") == 0) {
 	  if(last_entry && last_entry->child)
 	    last_entry->flags |= PLAY_TREE_RND;
 	  else
 	    last_parent->flags |= PLAY_TREE_RND;
-	} else if(strcasecmp(opt,"noshuffle") == 0) {
+	} else if(av_strcasecmp(opt,"noshuffle") == 0) {
 	  if(last_entry && last_entry->child)
 	    last_entry->flags &= ~PLAY_TREE_RND;
 	  else
@@ -269,7 +270,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
 	}

 	// Lock stdin if it will be used as input
-	if(strcasecmp(argv[i],"-") == 0)
+	if(av_strcasecmp(argv[i],"-") == 0)
 	  m_config_set_option(config,"noconsolecontrols",NULL);
 	add_entry(&last_parent,&last_entry,entry);
 	UNSET_GLOBAL; // We start entry specific options
diff --git a/playtree.c b/playtree.c
index c7ca457d4..c503e974a 100644
--- a/playtree.c
+++ b/playtree.c
@@ -22,13 +22,13 @@
 #include "config.h"
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
 #ifdef MP_DEBUG
 #include <assert.h>
 #endif
+#include "libavutil/avstring.h"
 #include "m_config.h"
 #include "playtree.h"
 #include "mp_msg.h"
@@ -382,7 +382,7 @@ play_tree_unset_param(play_tree_t* pt, const char* name) {
 #endif

   for(n = 0 ; pt->params[n].name != NULL ; n++) {
-    if(strcasecmp(pt->params[n].name,name) == 0)
+    if(av_strcasecmp(pt->params[n].name,name) == 0)
       ni = n;
   }

diff --git a/playtreeparser.c b/playtreeparser.c
index 143cc7ec5..51dc345c8 100644
--- a/playtreeparser.c
+++ b/playtreeparser.c
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <strings.h>
 #include <assert.h>
 #include <errno.h>
 #include <sys/types.h>
@@ -32,6 +31,7 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <limits.h>
+#include "libavutil/avstring.h"
 #include "asxparser.h"
 #include "m_config.h"
 #include "playtree.h"
@@ -189,7 +189,7 @@ parse_asx(play_tree_parser_t* p) {
 	line += 4;
 	if(line[0] != '\0' && strlen(line) > 0)
 	  get_line = 0;
-      } else if(strncasecmp(line,"<ASX",4) == 0) // We got an asx element
+      } else if(av_strncasecmp(line,"<ASX",4) == 0) // We got an asx element
 	break;
       else // We don't get an asx
 	return NULL;
@@ -295,7 +295,7 @@ parse_pls(play_tree_parser_t* p) {
   }
   if (!line)
     return NULL;
-  if(strcasecmp(line,"[playlist]"))
+  if(av_strcasecmp(line,"[playlist]"))
     return NULL;
   mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected Winamp playlist format\n");
   play_tree_parser_stop_keeping(p);
@@ -303,7 +303,7 @@ parse_pls(play_tree_parser_t* p) {
   if(!line)
     return NULL;
   strstrip(line);
-  if(strncasecmp(line,"NumberOfEntries",15) == 0) {
+  if(av_strncasecmp(line,"NumberOfEntries",15) == 0) {
     v = pls_entry_get_value(line);
     n_entries = atoi(v);
     if(n_entries < 0)
@@ -319,19 +319,19 @@ parse_pls(play_tree_parser_t* p) {
       line = play_tree_parser_get_line(p);
       continue;
     }
-    if(strncasecmp(line,"File",4) == 0) {
+    if(av_strncasecmp(line,"File",4) == 0) {
       num = pls_read_entry(line+4,&entries,&max_entry,&v);
       if(num < 0)
 	mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
       else
 	entries[num-1].file = strdup(v);
-    } else if(strncasecmp(line,"Title",5) == 0) {
+    } else if(av_strncasecmp(line,"Title",5) == 0) {
       num = pls_read_entry(line+5,&entries,&max_entry,&v);
       if(num < 0)
 	mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
       else
 	entries[num-1].title = strdup(v);
-    } else if(strncasecmp(line,"Length",6) == 0) {
+    } else if(av_strncasecmp(line,"Length",6) == 0) {
       num = pls_read_entry(line+6,&entries,&max_entry,&v);
       if(num < 0)
 	mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
@@ -391,7 +391,7 @@ parse_ref_ini(play_tree_parser_t* p) {
   if (!(line = play_tree_parser_get_line(p)))
     return NULL;
   strstrip(line);
-  if(strcasecmp(line,"[Reference]"))
+  if(av_strcasecmp(line,"[Reference]"))
     return NULL;
   mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected reference-ini playlist format\n");
   play_tree_parser_stop_keeping(p);
@@ -400,7 +400,7 @@ parse_ref_ini(play_tree_parser_t* p) {
     return NULL;
   while(line) {
     strstrip(line);
-    if(strncasecmp(line,"Ref",3) == 0) {
+    if(av_strncasecmp(line,"Ref",3) == 0) {
       v = pls_entry_get_value(line+3);
       if(!v)
 	mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
@@ -434,7 +434,7 @@ parse_m3u(play_tree_parser_t* p) {
   if (!(line = play_tree_parser_get_line(p)))
     return NULL;
   strstrip(line);
-  if(strcasecmp(line,"#EXTM3U"))
+  if(av_strcasecmp(line,"#EXTM3U"))
     return NULL;
   mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected extended m3u playlist format\n");
   play_tree_parser_stop_keeping(p);
@@ -451,7 +451,7 @@ parse_m3u(play_tree_parser_t* p) {
      */
     if(line[0] == '#') {
 #if 0 /* code functional */
-      if(strncasecmp(line,"#EXTINF:",8) == 0) {
+      if(av_strncasecmp(line,"#EXTINF:",8) == 0) {
         mp_msg(MSGT_PLAYTREE,MSGL_INFO,"[M3U] Duration: %dsec  Title: %s\n",
           strtol(line+8,&line,10), line+2);
       }
@@ -488,12 +488,12 @@ parse_smil(play_tree_parser_t* p) {
     strstrip(line);
     if(line[0] == '\0') // Ignore empties
       continue;
-    if (strncasecmp(line,"<?xml",5)==0) // smil in xml
+    if (av_strncasecmp(line,"<?xml",5)==0) // smil in xml
       continue;
-    if (strncasecmp(line,"<!DOCTYPE smil",13)==0) // smil in xml
+    if (av_strncasecmp(line,"<!DOCTYPE smil",13)==0) // smil in xml
       continue;
-    if (strncasecmp(line,"<smil",5)==0 || strncasecmp(line,"<?wpl",5)==0 ||
-      strncasecmp(line,"(smil-document",14)==0)
+    if (av_strncasecmp(line,"<smil",5)==0 || av_strncasecmp(line,"<?wpl",5)==0 ||
+      av_strncasecmp(line,"(smil-document",14)==0)
       break; // smil header found
     else
       return NULL; //line not smil exit
@@ -503,7 +503,7 @@ parse_smil(play_tree_parser_t* p) {
   mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected smil playlist format\n");
   play_tree_parser_stop_keeping(p);

-  if (strncasecmp(line,"(smil-document",14)==0) {
+  if (av_strncasecmp(line,"(smil-document",14)==0) {
     mp_msg(MSGT_PLAYTREE,MSGL_V,"Special smil-over-realrtsp playlist header\n");
     is_rmsmil = 1;
     if (sscanf(line, "(smil-document (ver 1.0)(npkt %u)(ttlpkt %u", &npkt, &ttlpkt) != 2) {
@@ -563,7 +563,7 @@ parse_smil(play_tree_parser_t* p) {
    while (pos) {
     if (!entrymode) { // all entries filled so far
      while ((pos=strchr(pos, '<'))) {
-      if (strncasecmp(pos,"<video",6)==0  || strncasecmp(pos,"<audio",6)==0 || strncasecmp(pos,"<media",6)==0) {
+      if (av_strncasecmp(pos,"<video",6)==0  || av_strncasecmp(pos,"<audio",6)==0 || av_strncasecmp(pos,"<media",6)==0) {
           entrymode=1;
           break; // Got a valid tag, exit '<' search loop
       }
@@ -754,7 +754,7 @@ static play_tree_t *parse_nsc(play_tree_parser_t* p) {
     strstrip(line);
     if(!line[0]) // Ignore empties
       continue;
-    if (strncasecmp(line,"[Address]", 9) == 0)
+    if (av_strncasecmp(line,"[Address]", 9) == 0)
       break; // nsc header found
     else
       return NULL;
@@ -765,19 +765,19 @@ static play_tree_t *parse_nsc(play_tree_parser_t* p) {
     strstrip(line);
     if (!line[0])
       continue;
-    if (strncasecmp(line, "Unicast URL=", 12) == 0) {
+    if (av_strncasecmp(line, "Unicast URL=", 12) == 0) {
       int len = decode_nsc_base64(&line[12], &unicast_url);
       if (len <= 0)
         mp_msg(MSGT_PLAYTREE, MSGL_WARN, "[nsc] Unsupported Unicast URL encoding\n");
       else
         utf16_to_ascii(unicast_url, len);
-    } else if (strncasecmp(line, "IP Address=", 11) == 0) {
+    } else if (av_strncasecmp(line, "IP Address=", 11) == 0) {
       int len = decode_nsc_base64(&line[11], &addr);
       if (len <= 0)
         mp_msg(MSGT_PLAYTREE, MSGL_WARN, "[nsc] Unsupported IP Address encoding\n");
       else
         utf16_to_ascii(addr, len);
-    } else if (strncasecmp(line, "IP Port=", 8) == 0) {
+    } else if (av_strncasecmp(line, "IP Port=", 8) == 0) {
       port = strtol(&line[8], NULL, 0);
     }
   }
diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c
index f87ca258f..28bda8681 100644
--- a/stream/asf_streaming.c
+++ b/stream/asf_streaming.c
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <errno.h>
 #include <limits.h>
@@ -43,6 +42,7 @@
 #include "network.h"
 #include "tcp.h"

+#include "libavutil/avstring.h"
 #include "libavutil/attributes.h"
 #include "libavutil/intreadwrite.h"

@@ -78,7 +78,7 @@ static int asf_streaming_start( stream_t *stream, int *demuxer_type) {
     int port = stream->streaming_ctrl->url->port;

     //Is protocol mms or mmst?
-    if (!strcasecmp(proto, "mmst") || !strcasecmp(proto, "mms"))
+    if (!av_strcasecmp(proto, "mmst") || !av_strcasecmp(proto, "mms"))
     {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/TCP...\n");
 		fd = asf_mmst_streaming_start( stream );
@@ -89,9 +89,9 @@ static int asf_streaming_start( stream_t *stream, int *demuxer_type) {
 	}

     //Is protocol http, http_proxy, or mms?
-    if (!strcasecmp(proto, "http_proxy") || !strcasecmp(proto, "http") ||
-	!strcasecmp(proto, "mms") || !strcasecmp(proto, "mmsh") ||
-	!strcasecmp(proto, "mmshttp"))
+    if (!av_strcasecmp(proto, "http_proxy") || !av_strcasecmp(proto, "http") ||
+	!av_strcasecmp(proto, "mms") || !av_strcasecmp(proto, "mmsh") ||
+	!av_strcasecmp(proto, "mmshttp"))
     {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/HTTP...\n");
 		fd = asf_http_streaming_start( stream, demuxer_type );
@@ -470,11 +470,11 @@ static int asf_header_check( HTTP_header_t *http_hdr ) {

 static int asf_http_streaming_type(char *content_type, char *features, HTTP_header_t *http_hdr ) {
 	if( content_type==NULL ) return ASF_Unknown_e;
-	if( 	!strcasecmp(content_type, "application/octet-stream") ||
-		!strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") ||        // New in Corona, first request
-		!strcasecmp(content_type, "application/x-mms-framed") ||                // New in Corana, second request
-		!strcasecmp(content_type, "video/x-ms-wmv") ||
-		!strcasecmp(content_type, "video/x-ms-asf")) {
+	if( 	!av_strcasecmp(content_type, "application/octet-stream") ||
+		!av_strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") ||        // New in Corona, first request
+		!av_strcasecmp(content_type, "application/x-mms-framed") ||                // New in Corana, second request
+		!av_strcasecmp(content_type, "video/x-ms-wmv") ||
+		!av_strcasecmp(content_type, "video/x-ms-asf")) {

 		if( strstr(features, "broadcast") ) {
 			mp_msg(MSGT_NETWORK,MSGL_V,"=====> ASF Live stream\n");
@@ -492,7 +492,7 @@ static int asf_http_streaming_type(char *content_type, char *features, HTTP_head
 			if( asf_header_check( http_hdr )==0 ) {
 				mp_msg(MSGT_NETWORK,MSGL_V,"=====> ASF Plain text\n");
 				return ASF_PlainText_e;
-			} else if( (!strcasecmp(content_type, "text/html")) ) {
+			} else if( (!av_strcasecmp(content_type, "text/html")) ) {
 				mp_msg(MSGT_NETWORK,MSGL_V,"=====> HTML, MPlayer is not a browser...yet!\n");
 				return ASF_Unknown_e;
 			} else {
@@ -500,15 +500,15 @@ static int asf_http_streaming_type(char *content_type, char *features, HTTP_head
 				return ASF_Redirector_e;
 			}
 		} else {
-			if(	(!strcasecmp(content_type, "audio/x-ms-wax")) ||
-				(!strcasecmp(content_type, "audio/x-ms-wma")) ||
-				(!strcasecmp(content_type, "video/x-ms-asf")) ||
-				(!strcasecmp(content_type, "video/x-ms-afs")) ||
-				(!strcasecmp(content_type, "video/x-ms-wmv")) ||
-				(!strcasecmp(content_type, "video/x-ms-wma")) ) {
+			if(	(!av_strcasecmp(content_type, "audio/x-ms-wax")) ||
+				(!av_strcasecmp(content_type, "audio/x-ms-wma")) ||
+				(!av_strcasecmp(content_type, "video/x-ms-asf")) ||
+				(!av_strcasecmp(content_type, "video/x-ms-afs")) ||
+				(!av_strcasecmp(content_type, "video/x-ms-wmv")) ||
+				(!av_strcasecmp(content_type, "video/x-ms-wma")) ) {
 				mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ASFRedirector);
 				return ASF_Redirector_e;
-			} else if( !strcasecmp(content_type, "text/plain") ) {
+			} else if( !av_strcasecmp(content_type, "text/plain") ) {
 				mp_msg(MSGT_NETWORK,MSGL_V,"=====> ASF Plain text\n");
 				return ASF_PlainText_e;
 			} else {
@@ -545,7 +545,7 @@ static HTTP_header_t *asf_http_request(streaming_ctrl_t *streaming_ctrl) {
 	http_add_basic_authentication( http_hdr, url->username, url->password );

 	// Check if we are using a proxy
-	if( !strcasecmp( url->protocol, "http_proxy" ) ) {
+	if( !av_strcasecmp( url->protocol, "http_proxy" ) ) {
 		server_url = url_new( (url->file)+1 );
 		if( server_url==NULL ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_InvalidProxyURL);
@@ -647,7 +647,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT
 		// The pragma line can get severals attributes
 		// separeted with a comma ','.
 		do {
-			if( !strncasecmp( pragma, "features=", 9) ) {
+			if( !av_strncasecmp( pragma, "features=", 9) ) {
 				pragma += 9;
 				end = strstr( pragma, "," );
 				if( end==NULL ) {
@@ -700,7 +700,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
 		done = 1;
 		if( fd>0 ) closesocket( fd );

-		if( !strcasecmp( url->protocol, "http_proxy" ) ) {
+		if( !av_strcasecmp( url->protocol, "http_proxy" ) ) {
 			if( url->port==0 ) url->port = 8080;
 		} else {
 			if( url->port==0 ) url->port = 80;
diff --git a/stream/http.c b/stream/http.c
index 5081886cb..bdf2e789a 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -25,7 +25,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>

 #if !HAVE_WINSOCK2_H
@@ -43,6 +42,7 @@
 #include "network.h"
 #include "help_mp.h"

+#include "libavutil/avstring.h"
 #include "libavutil/base64.h"

 typedef struct {
@@ -187,7 +187,7 @@ static int scast_streaming_start(stream_t *stream) {
   int metaint;
   scast_data_t *scast_data;
   HTTP_header_t *http_hdr = stream->streaming_ctrl->data;
-  int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
+  int is_ultravox = av_strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
   if (!stream || stream->fd < 0 || !http_hdr)
     return -1;
   if (is_ultravox)
@@ -378,7 +378,7 @@ http_response_parse( HTTP_header_t *http_hdr ) {
 	}
 	strncpy( http_hdr->protocol, http_hdr->buffer, len );
 	http_hdr->protocol[len]='\0';
-	if( !strncasecmp( http_hdr->protocol, "HTTP", 4) ) {
+	if( !av_strncasecmp( http_hdr->protocol, "HTTP", 4) ) {
 		if( sscanf( http_hdr->protocol+5,"1.%d", &(http_hdr->http_minor_version) )!=1 ) {
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"Malformed answer. Unable to get HTTP minor version.\n");
 			return -1;
@@ -435,7 +435,7 @@ http_response_parse( HTTP_header_t *http_hdr ) {
 			hdr_sep_len = 0;
 			break;
 		}
-		if (len > 16 && !strncasecmp(hdr_ptr + 4, "icy-metaint:", 12))
+		if (len > 16 && !av_strncasecmp(hdr_ptr + 4, "icy-metaint:", 12))
 		{
 			mp_msg(MSGT_NETWORK, MSGL_WARN, "Server sent a severely broken icy-metaint HTTP header!\n");
 			hdr_ptr += 4;
@@ -545,7 +545,7 @@ http_get_next_field( HTTP_header_t *http_hdr ) {
 	while( field!=NULL ) {
 		ptr = strstr( field->field_name, ":" );
 		if( ptr==NULL ) return NULL;
-		if( !strncasecmp( field->field_name, http_hdr->field_search, ptr-(field->field_name) ) ) {
+		if( !av_strncasecmp( field->field_name, http_hdr->field_search, ptr-(field->field_name) ) ) {
 			ptr++;	// Skip the column
 			while( ptr[0]==' ' ) ptr++; // Skip the spaces if there is some
 			http_hdr->field_search_pos = field->next;
@@ -756,7 +756,7 @@ static int http_streaming_start(stream_t *stream, int* file_format) {
 		print_icy_metadata(http_hdr);

 		// Check if the response is an ICY status_code reason_phrase
-		if( !strcasecmp(http_hdr->protocol, "ICY") ||
+		if( !av_strcasecmp(http_hdr->protocol, "ICY") ||
 		     http_get_field(http_hdr, "Icy-MetaInt") ) {
 			switch( http_hdr->status_code ) {
 				case 200: { // OK
@@ -807,7 +807,7 @@ static int http_streaming_start(stream_t *stream, int* file_format) {
 					mp_msg(MSGT_NETWORK,MSGL_V,"Content-Type: [%s]\n", content_type );
 					// Check in the mime type table for a demuxer type
 					for (i = 0; mime_type_table[i].mime_type != NULL; i++) {
-						if( !strcasecmp( content_type, mime_type_table[i].mime_type ) ) {
+						if( !av_strcasecmp( content_type, mime_type_table[i].mime_type ) ) {
 							*file_format = mime_type_table[i].demuxer_type;
 							res = seekable;
 							goto out;
@@ -826,7 +826,7 @@ static int http_streaming_start(stream_t *stream, int* file_format) {
 				// TODO: RFC 2616, recommand to detect infinite redirection loops
 				next_url = http_get_field( http_hdr, "Location" );
 				if( next_url!=NULL ) {
-					int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
+					int is_ultravox = av_strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
 					stream->streaming_ctrl->url = url_redirect( &url, next_url );
 					if (url_is_protocol(url, "https") || url_is_protocol(url, "mms")) {
 						res = STREAM_REDIRECTED;
@@ -866,7 +866,7 @@ out:
 static int fixup_open(stream_t *stream,int seekable) {
 	HTTP_header_t *http_hdr = stream->streaming_ctrl->data;
 	int is_icy = http_hdr && http_get_field(http_hdr, "Icy-MetaInt");
-	int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
+	int is_ultravox = av_strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;

 	stream->type = STREAMTYPE_STREAM;
 	if(!is_icy && !is_ultravox && seekable)
diff --git a/stream/librtsp/rtsp.c b/stream/librtsp/rtsp.c
index 84819be77..3399b4f20 100644
--- a/stream/librtsp/rtsp.c
+++ b/stream/librtsp/rtsp.c
@@ -34,7 +34,6 @@
 #include <assert.h>
 #include "config.h"
 #include <string.h>
-#include <strings.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -48,6 +47,7 @@
 #else
 #include <sys/socket.h>
 #endif
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "rtsp.h"
 #include "rtsp_session.h"
@@ -280,7 +280,7 @@ static int rtsp_get_answers(rtsp_t *s) {
     if (!answer)
       return 0;

-    if (!strncasecmp(answer,"CSeq:",5)) {
+    if (!av_strncasecmp(answer,"CSeq:",5)) {
       sscanf(answer,"%*s %u",&answer_seq);
       if (s->cseq != answer_seq) {
 #ifdef LOG
@@ -289,14 +289,14 @@ static int rtsp_get_answers(rtsp_t *s) {
         s->cseq=answer_seq;
       }
     }
-    if (!strncasecmp(answer,"Server:",7)) {
+    if (!av_strncasecmp(answer,"Server:",7)) {
       char *buf = malloc(strlen(answer));
       sscanf(answer,"%*s %s",buf);
       free(s->server);
       s->server=strdup(buf);
       free(buf);
     }
-    if (!strncasecmp(answer,"Session:",8)) {
+    if (!av_strncasecmp(answer,"Session:",8)) {
       char *buf = calloc(1, strlen(answer));
       sscanf(answer,"%*s %s",buf);
       if (s->session) {
@@ -484,7 +484,7 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) {
         rest=rtsp_get(s);
         if (!rest)
           return -1;
-        if (!strncasecmp(rest,"CSeq:",5))
+        if (!av_strncasecmp(rest,"CSeq:",5))
           sscanf(rest,"%*s %u",&seq);
       } while (strlen(rest)!=0);
       free(rest);
@@ -594,7 +594,7 @@ char *rtsp_search_answers(rtsp_t *s, const char *tag) {
   answer=s->answers;

   while (*answer) {
-    if (!strncasecmp(*answer,tag,strlen(tag))) {
+    if (!av_strncasecmp(*answer,tag,strlen(tag))) {
       ptr=strchr(*answer,':');
       if (!ptr) return NULL;
       ptr++;
diff --git a/stream/network.c b/stream/network.c
index 72ef55d84..3aeddb5b2 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -23,13 +23,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>
 #include <errno.h>
 #include <ctype.h>

 #include "config.h"

+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"

@@ -140,12 +140,12 @@ check4proxies( const URL_t *url ) {
 	URL_t *url_out = NULL;
 	if( url==NULL ) return NULL;
 	url_out = url_new( url->url );
-	if( !strcasecmp(url->protocol, "http_proxy") ) {
+	if( !av_strcasecmp(url->protocol, "http_proxy") ) {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Using HTTP proxy: http://%s:%d\n", url->hostname, url->port );
 		return url_out;
 	}
 	// Check if the http_proxy environment variable is set.
-	if( !strcasecmp(url->protocol, "http") ) {
+	if( !av_strcasecmp(url->protocol, "http") ) {
 		char *proxy;
 		proxy = getenv("http_proxy");
 		if( proxy!=NULL ) {
@@ -210,7 +210,7 @@ http_send_request( URL_t *url, int64_t pos ) {

 	http_hdr = http_new_header();

-	if( !strcasecmp(url->protocol, "http_proxy") ) {
+	if( !av_strcasecmp(url->protocol, "http_proxy") ) {
 		proxy = 1;
 		server_url = url_new( (url->file)+1 );
 		if (!server_url) {
@@ -250,7 +250,7 @@ http_send_request( URL_t *url, int64_t pos ) {
 	    }
 	}

-	if( strcasecmp(url->protocol, "noicyx") )
+	if( av_strcasecmp(url->protocol, "noicyx") )
 	    http_set_field(http_hdr, "Icy-MetaData: 1");

 	if(pos>0) {
diff --git a/stream/stream.c b/stream/stream.c
index 0d39df6a7..dd4a22553 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -28,7 +28,6 @@
 #include <sys/wait.h>
 #endif
 #include <fcntl.h>
-#include <strings.h>
 #include <assert.h>

 #include "config.h"
@@ -37,6 +36,7 @@
 #include <winsock2.h>
 #endif

+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"
 #include "osdep/shmem.h"
@@ -227,7 +227,7 @@ stream_t* open_stream_full(const char* filename,int mode, char** options, int* f
       int l = strlen(sinfo->protocols[j]);
       // l == 0 => Don't do protocol matching (ie network and filenames)
       if((l == 0 && !strstr(filename, "://")) ||
-         ((strncasecmp(sinfo->protocols[j],filename,l) == 0) &&
+         ((av_strncasecmp(sinfo->protocols[j],filename,l) == 0) &&
 		      (strncmp("://",filename+l,3) == 0))) {
 	int r;
 	char *redirected_url = NULL;
diff --git a/stream/stream_bd.c b/stream/stream_bd.c
index 46134fc12..3c0e9548f 100644
--- a/stream/stream_bd.c
+++ b/stream/stream_bd.c
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <limits.h>
 #include <ctype.h>
-#include <strings.h>

 #include "libavutil/common.h"
 #include "libavutil/aes.h"
@@ -195,7 +194,7 @@ static int find_vuk(struct bd_priv *bd, const uint8_t discid[20])
         // or         I | I-Key
         // can be followed by ; and comment

-        if (strncasecmp(line, idstr, 40))
+        if (av_strncasecmp(line, idstr, 40))
             continue;
         mp_msg(MSGT_OPEN, MSGL_V, "KeyDB found Entry for DiscID:\n%s\n", line);

diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 742e6088a..f80c46e6a 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -19,10 +19,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <unistd.h>

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "help_mp.h"
 #include "path.h"
@@ -1053,7 +1053,7 @@ static int ifo_stream_open (stream_t *stream, int mode, void *opts, int *file_fo
     struct stream_priv_s *spriv;
     int len = strlen(stream->url);

-    if (len < 4 || strcasecmp (stream->url + len - 4, ".ifo"))
+    if (len < 4 || av_strcasecmp (stream->url + len - 4, ".ifo"))
         return STREAM_UNSUPPORTED;

     mp_msg(MSGT_DVD, MSGL_INFO, ".IFO detected. Redirecting to dvd://\n");
@@ -1062,7 +1062,7 @@ static int ifo_stream_open (stream_t *stream, int mode, void *opts, int *file_fo

     spriv=calloc(1, sizeof(struct stream_priv_s));
     spriv->device = mp_dirname(stream->url);
-    if(!strncasecmp(filename,"vts_",4))
+    if(!av_strncasecmp(filename,"vts_",4))
     {
         if(sscanf(filename+3, "_%02d_", &spriv->title)!=1)
             spriv->title=1;
diff --git a/stream/stream_pvr.c b/stream/stream_pvr.c
index e03e76a73..ceb9ee7fe 100644
--- a/stream/stream_pvr.c
+++ b/stream/stream_pvr.c
@@ -28,7 +28,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>
 #include <ctype.h>
 #include <sys/time.h>
 #include <errno.h>
@@ -301,7 +300,7 @@ set_station (struct pvr_t *pvr, const char *station,
   /* select channel */
   for (i = 0; i < pvr->stationlist.used; i++)
   {
-    if (channel && !strcasecmp (pvr->stationlist.list[i].name, channel))
+    if (channel && !av_strcasecmp (pvr->stationlist.list[i].name, channel))
       break; /* found existing channel entry */

     if (freq > 0 && pvr->stationlist.list[i].freq == freq)
@@ -416,7 +415,7 @@ parse_setup_stationlist (struct pvr_t *pvr)
     /* select channel list */
     for (i = 0; chanlists[i].name != NULL; i++)
     {
-      if (!strcasecmp (chanlists[i].name, stream_tv_defaults.chanlist))
+      if (!av_strcasecmp (chanlists[i].name, stream_tv_defaults.chanlist))
       {
         chantab = i;
         break;
@@ -682,7 +681,7 @@ set_station_by_channelname_or_freq (struct pvr_t *pvr, const char *channel,
     /* select by channel */
     for (i = 0; i < pvr->stationlist.used ; i++)
     {
-      if (!strcasecmp (pvr->stationlist.list[i].name, channel))
+      if (!av_strcasecmp (pvr->stationlist.list[i].name, channel))
       {
         if (!pvr->stationlist.list[i].enabled)
         {
diff --git a/stream/tv.c b/stream/tv.c
index d360c555c..d14ad6986 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -29,7 +29,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>
 #include <ctype.h>
 #include <sys/time.h>

@@ -280,19 +279,19 @@ static int norm_from_string(tvi_handle_t *tvh, char* norm)
         return 0;
     }

-    if (!strcasecmp(norm, "pal"))
+    if (!av_strcasecmp(norm, "pal"))
         return TV_NORM_PAL;
-    else if (!strcasecmp(norm, "ntsc"))
+    else if (!av_strcasecmp(norm, "ntsc"))
         return TV_NORM_NTSC;
-    else if (!strcasecmp(norm, "secam"))
+    else if (!av_strcasecmp(norm, "secam"))
         return TV_NORM_SECAM;
-    else if (!strcasecmp(norm, "palnc"))
+    else if (!av_strcasecmp(norm, "palnc"))
         return TV_NORM_PALNC;
-    else if (!strcasecmp(norm, "palm"))
+    else if (!av_strcasecmp(norm, "palm"))
         return TV_NORM_PALM;
-    else if (!strcasecmp(norm, "paln"))
+    else if (!av_strcasecmp(norm, "paln"))
         return TV_NORM_PALN;
-    else if (!strcasecmp(norm, "ntscjp"))
+    else if (!av_strcasecmp(norm, "ntscjp"))
         return TV_NORM_NTSCJP;
     else {
         mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL");
@@ -337,7 +336,7 @@ static void parse_channels(tvi_handle_t *tvh)
             tv_channel_current->freq = 0;
             for (i = 0; i < chanlists[tvh->chanlist].count; i++) {
                 cl = tvh->chanlist_s[i];
-                if (!strcasecmp(cl.name, tv_channel_current->number)) {
+                if (!av_strcasecmp(cl.name, tv_channel_current->number)) {
                     tv_channel_current->freq=cl.freq;
                     break;
                 }
@@ -544,7 +543,7 @@ static int open_tv(tvi_handle_t *tvh)
     /* select channel list */
     for (i = 0; chanlists[i].name != NULL; i++)
     {
-	if (!strcasecmp(chanlists[i].name, tvh->tv_param->chanlist))
+	if (!av_strcasecmp(chanlists[i].name, tvh->tv_param->chanlist))
 	{
 	    tvh->chanlist = i;
 	    tvh->chanlist_s = chanlists[i].list;
@@ -629,7 +628,7 @@ static int open_tv(tvi_handle_t *tvh)
 	    cl = tvh->chanlist_s[i];
 		    //  printf("count%d: name: %s, freq: %d\n",
 		    //	i, cl.name, cl.freq);
-	    if (!strcasecmp(cl.name, tvh->tv_param->channel))
+	    if (!av_strcasecmp(cl.name, tvh->tv_param->channel))
 	    {
 			strcpy(tv_channel_last_real, cl.name);
 		tvh->channel = i;
@@ -1058,7 +1057,7 @@ int tv_set_channel_real(tvi_handle_t *tvh, char *channel) {
 	    cl = tvh->chanlist_s[i];
 //	    printf("count%d: name: %s, freq: %d\n",
 //		i, cl.name, cl.freq);
-	    if (!strcasecmp(cl.name, channel))
+	    if (!av_strcasecmp(cl.name, channel))
 	    {
 		tvh->channel = i;
 		mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
@@ -1104,7 +1103,7 @@ int tv_last_channel(tvi_handle_t *tvh) {
 		for (i = 0; i < chanlists[tvh->chanlist].count; i++)
 		{
 		    cl = tvh->chanlist_s[i];
-		    if (!strcasecmp(cl.name, tv_channel_last_real))
+		    if (!av_strcasecmp(cl.name, tv_channel_last_real))
 		    {
 			strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
 			tvh->channel = i;
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c
index f38a131cd..aafd278f4 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -75,8 +75,8 @@
 #include "config.h"

 #include <stdio.h>
-#include <strings.h>

+#include "libavutil/avstring.h"
 #include "libmpcodecs/img_format.h"
 #include "libmpcodecs/dec_teletext.h"
 #include "libaf/af_format.h"
@@ -3463,7 +3463,7 @@ static int control(priv_t * priv, int cmd, void *arg)
 	    if (!priv->pTVTuner)
 		return TVI_CONTROL_FALSE;
 	    for (i = 0; i < tv_available_norms_count; i++) {
-		if (!strcasecmp
+		if (!av_strcasecmp
 		    (tv_norms[tv_available_norms[i]].name, (char *) arg)) {
 		    *(int *) arg = i + 1;
 		    return TVI_CONTROL_TRUE;
diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c
index 89c21be9b..67eb555a6 100644
--- a/stream/tvi_v4l.c
+++ b/stream/tvi_v4l.c
@@ -48,12 +48,12 @@
 #include <sys/mman.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <pthread.h>
 #ifdef HAVE_SYS_SYSINFO_H
 #include <sys/sysinfo.h>
 #endif

+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "libaf/af_format.h"
 #include "libmpcodecs/img_format.h"
@@ -541,11 +541,11 @@ static int init(priv_t *priv)
                bparm.HorDcm, bparm.VerDcm, bparm.TmpDcm);

         bparm.input = priv->tv_param->input; /* tv */
-        if (!strcasecmp(priv->tv_param->norm, "pal"))
+        if (!av_strcasecmp(priv->tv_param->norm, "pal"))
             bparm.norm =  0; /* PAL */
-        else if (!strcasecmp(priv->tv_param->norm, "ntsc"))
+        else if (!av_strcasecmp(priv->tv_param->norm, "ntsc"))
             bparm.norm =  1; /* NTSC */
-        else if (!strcasecmp(priv->tv_param->norm, "secam"))
+        else if (!av_strcasecmp(priv->tv_param->norm, "secam"))
             bparm.norm =  2; /* SECAM */
         bparm.quality = priv->tv_param->quality;
         bparm.decimation = priv->tv_param->decimation;
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 98766ec3f..c297ee4ef 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -40,7 +40,6 @@ known issues:
 #include <pthread.h>
 #include <stdio.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/time.h>
@@ -56,6 +55,7 @@ known issues:
 #include <linux/types.h>
 #include <linux/videodev2.h>
 #endif
+#include "libavutil/avstring.h"
 #include "mp_msg.h"
 #include "libmpcodecs/img_format.h"
 #include "libmpcodecs/dec_teletext.h"
@@ -1003,7 +1003,7 @@ static int control(priv_t *priv, int cmd, void *arg)
                 standard.index = i;
                 if (-1 == ioctl(priv->video_fd, VIDIOC_ENUMSTD, &standard))
                     return TVI_CONTROL_FALSE;
-                if (!strcasecmp(standard.name, (char *)arg)) {
+                if (!av_strcasecmp(standard.name, (char *)arg)) {
                     *(int *)arg = i;
                     return TVI_CONTROL_TRUE;
                 }
diff --git a/stream/url.c b/stream/url.c
index 9af3a8daf..83b57eb2a 100644
--- a/stream/url.c
+++ b/stream/url.c
@@ -21,12 +21,12 @@
  */

 #include <string.h>
-#include <strings.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <inttypes.h>

+#include "libavutil/avstring.h"
 #include "url.h"
 #include "mp_msg.h"
 #include "mp_strings.h"
@@ -37,18 +37,18 @@
 #endif

 static int is_proxy(const URL_t *url) {
-  return !strcasecmp(url->protocol, "http_proxy") && url->file && strstr(url->file, "://");
+  return !av_strcasecmp(url->protocol, "http_proxy") && url->file && strstr(url->file, "://");
 }

 int url_is_protocol(const URL_t *url, const char *proto) {
   int proxy = is_proxy(url);
   if (proxy) {
     URL_t *tmp = url_new(url->file + 1);
-    int res = !strcasecmp(tmp->protocol, proto);
+    int res = !av_strcasecmp(tmp->protocol, proto);
     url_free(tmp);
     return res;
   }
-  return !strcasecmp(url->protocol, proto);
+  return !av_strcasecmp(url->protocol, proto);
 }

 void url_set_protocol(URL_t *url, const char *proto) {
diff --git a/sub/font_load.c b/sub/font_load.c
index 0b45a4d31..d08da8c3c 100644
--- a/sub/font_load.c
+++ b/sub/font_load.c
@@ -23,12 +23,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>

 #include "libavutil/intreadwrite.h"
+#include "libavutil/avstring.h"

 #include "font_load.h"
 #include "sub.h"
@@ -120,7 +120,7 @@ for(i=0;i<65536;i++) desc->start[i]=desc->width[i]=desc->font[i]=-1;

 section[0]=0;

-unicode = !subtitle_font_encoding || strcasecmp(subtitle_font_encoding, "unicode") == 0;
+unicode = !subtitle_font_encoding || av_strcasecmp(subtitle_font_encoding, "unicode") == 0;

 while(fgets(sor,1020,f)){
   unsigned char* p[8];
diff --git a/sub/font_load_ft.c b/sub/font_load_ft.c
index b49de3a43..bd3e1c1de 100644
--- a/sub/font_load_ft.c
+++ b/sub/font_load_ft.c
@@ -29,7 +29,6 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
-#include <strings.h>

 #ifdef CONFIG_ICONV
 #include <iconv.h>
@@ -44,6 +43,7 @@
 #endif

 #include "libavutil/common.h"
+#include "libavutil/avstring.h"
 #include "mpbswap.h"
 #include "font_load.h"
 #include "mp_msg.h"
@@ -986,7 +986,7 @@ static font_desc_t* read_font_desc_ft(const char *fname, int face_index, int mov
     if (subtitle_font_ppem > 128) subtitle_font_ppem = 128;
     if (osd_font_ppem > 128) osd_font_ppem = 128;

-    unicode = !subtitle_font_encoding || strcasecmp(subtitle_font_encoding, "unicode") == 0;
+    unicode = !subtitle_font_encoding || av_strcasecmp(subtitle_font_encoding, "unicode") == 0;

     desc = init_font_desc();
     if(!desc) goto err_out;
diff --git a/sub/spudec.c b/sub/spudec.c
index 9b0086080..eefc235d4 100644
--- a/sub/spudec.c
+++ b/sub/spudec.c
@@ -28,6 +28,7 @@
  */

 #include "config.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"

 #include <errno.h>
@@ -36,7 +37,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <strings.h>
 #include <math.h>
 #include "sub.h"
 #include "libvo/video_out.h"
@@ -1292,7 +1292,7 @@ static void spudec_parse_extradata(spudec_handle_t *this,
         pal[i] = vobsub_palette_to_yuv(pal[i]);
       this->auto_palette = 0;
     }
-    if (!strncasecmp(ptr, "forced subs: on", 15))
+    if (!av_strncasecmp(ptr, "forced subs: on", 15))
       this->forced_subs_only = 1;
     if (!strncmp(ptr, "custom colors: ON, tridx: ", 26) &&
         sscanf(ptr + 26, "%x, colors: %x, %x, %x, %x",
diff --git a/sub/subassconvert.c b/sub/subassconvert.c
index b269119cd..9a4fc23ab 100644
--- a/sub/subassconvert.c
+++ b/sub/subassconvert.c
@@ -19,7 +19,6 @@
  */

 #include <string.h>
-#include <strings.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -30,6 +29,7 @@
 #include "bstr.h"
 #include "subassconvert.h"
 #include "libavutil/common.h"
+#include "libavutil/avstring.h"

 struct line {
     char *buf;
@@ -223,7 +223,7 @@ void subassconvert_subrip(const char *orig, char *dest, size_t dest_buffer_size)
                         for (i = 0; i < FF_ARRAY_ELEMS(subrip_web_colors); i++) {
                             const char *color = subrip_web_colors[i].s;
                             const int len = strlen(color);
-                            if (strncasecmp(line, color, len) == 0) {
+                            if (av_strncasecmp(line, color, len) == 0) {
                                 tag->color = SUBRIP_FLAG_COLOR | subrip_web_colors[i].v;
                                 line += len;
                                 break;
diff --git a/sub/subreader.c b/sub/subreader.c
index 748622351..41bb4c16e 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -24,7 +24,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <ctype.h>

 #include <sys/types.h>
@@ -111,7 +110,7 @@ static char *stristr(const char *haystack, const char *needle) {

     len=strlen(needle);
     while (*p != '\0') {
-	if (strncasecmp(p, needle, len) == 0) return (char*)p;
+	if (av_strncasecmp(p, needle, len) == 0) return (char*)p;
 	p++;
     }

@@ -179,13 +178,13 @@ static subtitle *sub_read_line_sami(stream_t* st, subtitle *current, int utf16)
 	    if (p - text >= LINE_LEN)
 	        sami_add_line(current, text, &p);
 	    if (*s == '\0') break;
-	    else if (!strncasecmp (s, "<br>", 4)) {
+	    else if (!av_strncasecmp (s, "<br>", 4)) {
                 sami_add_line(current, text, &p);
 		s += 4;
 	    }
 	    else if ((*s == '{') && !sub_no_text_pp) { state = 5; ++s; continue; }
 	    else if (*s == '<') { state = 4; }
-	    else if (!strncasecmp (s, " ", 6)) { *p++ = ' '; s += 6; }
+	    else if (!av_strncasecmp (s, " ", 6)) { *p++ = ' '; s += 6; }
 	    else if (*s == '\t') { *p++ = ' '; s++; }
 	    else if (*s == '\r' || *s == '\n') { s++; }
 	    else *p++ = *s++;
@@ -1180,7 +1179,7 @@ static int sub_autodetect (stream_t* st, int *uses_time, int utf16) {
 		{*uses_time=1;return SUB_VPLAYER;}
 	if (sscanf (line, "%d:%d:%d ",     &i, &i, &i )==3)
 		{*uses_time=1;return SUB_VPLAYER;}
-	if (!strncasecmp(line, "<window", 7))
+	if (!av_strncasecmp(line, "<window", 7))
 		{*uses_time=1;return SUB_RT;}
 	if (!memcmp(line, "Dialogue: Marked", 16))
 		{*uses_time=1; return SUB_SSA;}
@@ -1441,7 +1440,7 @@ const char* guess_buffer_cp(unsigned char* buffer, int buflen, const char *prefe
     mp_msg(MSGT_SUBREADER, MSGL_V, "\n");

     for (i = 0; i < langcnt; i++) {
-	if (strcasecmp(languages[i], preferred_language) != 0) continue;
+	if (av_strcasecmp(languages[i], preferred_language) != 0) continue;
 	analyser = enca_analyser_alloc(languages[i]);
 	encoding = enca_analyse_const(analyser, buffer, buflen);
 	enca_analyser_free(analyser);
@@ -1535,7 +1534,7 @@ sub_data* sub_read_file (const char *filename, float fps) {
 	    if ((l=strlen(filename))>4){
 		    static const char exts[][8] = {".utf", ".utf8", ".utf-8" };
 		    for (k=3;--k>=0;)
-			if (l >= strlen(exts[k]) && !strcasecmp(filename+(l - strlen(exts[k])), exts[k])){
+			if (l >= strlen(exts[k]) && !av_strcasecmp(filename+(l - strlen(exts[k])), exts[k])){
 			    sub_utf8 = 1;
 			    break;
 			}
@@ -2024,7 +2023,7 @@ static void append_dir_subtitles(struct sub_list *slist, const char *path,

             // If it's a .sub, check if there is a .idx with the same name. If
             // there is one, it's certainly a vobsub so we skip it.
-            if (strcasecmp(tmp_fname_ext, "sub") == 0) {
+            if (av_strcasecmp(tmp_fname_ext, "sub") == 0) {
                 char *idx, *idxname = strdup(de->d_name);

                 strcpy(idxname + strlen(de->d_name) - sizeof("idx") + 1, "idx");
@@ -2042,14 +2041,14 @@ static void append_dir_subtitles(struct sub_list *slist, const char *path,
             found = 0;
 #ifdef CONFIG_ICONV
 #ifdef CONFIG_ENCA
-            for (i = ((sub_cp && strncasecmp(sub_cp, "enca", 4) != 0) ? 3 : 0); sub_exts[i]; i++) {
+            for (i = ((sub_cp && av_strncasecmp(sub_cp, "enca", 4) != 0) ? 3 : 0); sub_exts[i]; i++) {
 #else
             for (i = (sub_cp ? 3 : 0); sub_exts[i]; i++) {
 #endif
 #else
             for (i = 0; sub_exts[i]; i++) {
 #endif
-                if (strcasecmp(sub_exts[i], tmp_fname_ext) == 0) {
+                if (av_strcasecmp(sub_exts[i], tmp_fname_ext) == 0) {
                     found = 1;
                     break;
                 }
diff --git a/sub/vobsub.c b/sub/vobsub.c
index 8277eb920..895ff8ddb 100644
--- a/sub/vobsub.c
+++ b/sub/vobsub.c
@@ -27,7 +27,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/stat.h>
@@ -41,6 +40,7 @@
 #include "path.h"
 #include "unrar_exec.h"
 #include "libavutil/common.h"
+#include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "osdep/osdep.h"

@@ -116,7 +116,7 @@ static rar_stream_t *rar_open(const char *const filename,
                     int demanded_ext_len = strlen (demanded_ext);
                     for (i = 0, lp = list; i < num_files; i++, lp = lp->next) {
                         name_len = strlen (lp->item.Name);
-                        if (name_len >= demanded_ext_len && !strcasecmp (lp->item.Name + name_len - demanded_ext_len, demanded_ext)) {
+                        if (name_len >= demanded_ext_len && !av_strcasecmp (lp->item.Name + name_len - demanded_ext_len, demanded_ext)) {
                             rc = unrar_exec_get(&stream->data, &stream->size,
                                                 lp->item.Name, rar_filename);
                             if (rc)
diff --git a/subopt-helper.c b/subopt-helper.c
index 2ee1060c0..731128a3c 100644
--- a/subopt-helper.c
+++ b/subopt-helper.c
@@ -36,11 +36,11 @@
  */

 #include "subopt-helper.h"
+#include "libavutil/avstring.h"
 #include "mp_msg.h"

 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <limits.h>
 #include <assert.h>

@@ -337,9 +337,9 @@ int strargcmp(strarg_t *arg, const char *str) {
   return res;
 }

-/** \brief compare the stings just as strcasecmp does */
+/** \brief compare the stings just as av_strcasecmp does */
 int strargcasecmp(strarg_t *arg, char *str) {
-  int res = strncasecmp(arg->str, str, arg->len);
+  int res = av_strncasecmp(arg->str, str, arg->len);
   if (!res && arg->len != strlen(str))
     res = arg->len - strlen(str);
   return res;
diff --git a/udp_sync.c b/udp_sync.c
index 1b338ba7b..dfa77ce85 100644
--- a/udp_sync.c
+++ b/udp_sync.c
@@ -33,7 +33,6 @@
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <string.h>
-#include <strings.h>
 #include <netdb.h>
 #include <signal.h>
 #else
--
2.30.0



More information about the MPlayer-dev-eng mailing list