[MPlayer-cvslog] r37834 - in trunk: codec-cfg.c codec-cfg.h command.c gui/interface.c libmpcodecs/ad_acm.c libmpcodecs/ad_dmo.c libmpcodecs/ad_dshow.c libmpcodecs/ad_ffmpeg.c libmpcodecs/ad_realaud.c libmpcodecs/ad...

reimar subversion at mplayerhq.hu
Sun Mar 6 14:00:49 CET 2016


Author: reimar
Date: Sun Mar  6 14:00:49 2016
New Revision: 37834

Log:
codec-cfg: Optimize built-in codecs format.

Lookup strings via index in an array instead of
using direct pointers.
The two main advantages are
1) No data relocations that pointers would otherwise cause
2) Smaller size on 64 bit systems

Modified:
   trunk/codec-cfg.c
   trunk/codec-cfg.h
   trunk/command.c
   trunk/gui/interface.c
   trunk/libmpcodecs/ad_acm.c
   trunk/libmpcodecs/ad_dmo.c
   trunk/libmpcodecs/ad_dshow.c
   trunk/libmpcodecs/ad_ffmpeg.c
   trunk/libmpcodecs/ad_realaud.c
   trunk/libmpcodecs/ad_spdif.c
   trunk/libmpcodecs/ad_twin.c
   trunk/libmpcodecs/dec_audio.c
   trunk/libmpcodecs/dec_video.c
   trunk/libmpcodecs/vd_dmo.c
   trunk/libmpcodecs/vd_dshow.c
   trunk/libmpcodecs/vd_ffmpeg.c
   trunk/libmpcodecs/vd_realvid.c
   trunk/libmpcodecs/vd_vfw.c
   trunk/libmpcodecs/vd_xanim.c
   trunk/mplayer.c

Modified: trunk/codec-cfg.c
==============================================================================
--- trunk/codec-cfg.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/codec-cfg.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -402,28 +402,29 @@ static short get_driver(char *s,int audi
 static int validate_codec(codecs_t *c, int type)
 {
     unsigned int i;
-    char *tmp_name = c->name;
+    const char *name = codec_idx2str(c->name_idx);
+    const char *tmp_name = name;
 
     for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++)
         /* NOTHING */;
 
     if (i < strlen(tmp_name)) {
-        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_InvalidCodecName, c->name);
+        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_InvalidCodecName, name);
         return 0;
     }
 
-    if (!c->info)
-        c->info = strdup(c->name);
+    if (!c->info_idx)
+        c->info_idx = c->name_idx;
 
 #if 0
     if (c->fourcc[0] == 0xffffffff) {
-        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksFourcc, c->name);
+        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksFourcc, name);
         return 0;
     }
 #endif
 
-    if (!c->drv) {
-        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksDriver, c->name);
+    if (!c->drv_idx) {
+        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksDriver, name);
         return 0;
     }
 
@@ -432,7 +433,7 @@ static int validate_codec(codecs_t *c, i
 //FIXME: Where are they defined ????????????
     if (!c->dll && (c->driver == 4 ||
                 (c->driver == 2 && type == TYPE_VIDEO))) {
-        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsDLL, c->name);
+        mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsDLL, name);
         return 0;
     }
 // FIXME: Can guid.f1 be 0? How does one know that it was not given?
@@ -440,7 +441,7 @@ static int validate_codec(codecs_t *c, i
 
     if (type == TYPE_VIDEO)
         if (c->outfmt[0] == 0xffffffff) {
-            mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsOutfmt, c->name);
+            mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsOutfmt, name);
             return 0;
         }
 #endif
@@ -561,14 +562,55 @@ out_eol:
 
 static codecs_t *video_codecs=NULL;
 static codecs_t *audio_codecs=NULL;
+static char *codec_strs = NULL;
+static unsigned codec_strs_len = 0;
 static int nr_vcodecs = 0;
 static int nr_acodecs = 0;
 
+const char *codec_idx2str(unsigned idx)
+{
+    if (idx >= codec_strs_len) return NULL;
+    if (idx > 0 && codec_strs[idx - 1]) return NULL;
+    return codec_strs + idx;
+}
+
+static unsigned codec_addstr(const char *s)
+{
+#ifdef CODECS2HTML
+    int i;
+#endif
+    int len;
+    char *newstr;
+    if (!s || !s[0]) return 0;
+    len = strlen(s) + 1;
+#ifdef CODECS2HTML
+    // try to de-duplicate
+    for (i = 1; i < codec_strs_len; ) {
+        int curlen = strlen(codec_strs + i) + 1;
+        if (len == curlen && !strcmp(s, codec_strs + i))
+            return i;
+        i += curlen;
+    }
+#endif
+    if (codec_strs_len) {
+        newstr = realloc(codec_strs, codec_strs_len + len);
+    } else {
+        codec_strs_len = 1;
+        newstr = calloc(1, 1 + len);
+    }
+    if (!newstr) return 0;
+    codec_strs = newstr;
+    memcpy(codec_strs + codec_strs_len, s, len);
+    codec_strs_len += len;
+    return codec_strs_len - len;
+}
+
 int parse_codec_cfg(const char *cfgfile)
 {
     codecs_t *codec = NULL; // current codec
     codecs_t **codecsp = NULL;// points to audio_codecs or to video_codecs
     char *endptr;   // strtoul()...
+    char *comment = NULL;
     int *nr_codecsp;
     int codec_type;     /* TYPE_VIDEO/TYPE_AUDIO */
     int tmp, i;
@@ -587,6 +629,8 @@ int parse_codec_cfg(const char *cfgfile)
         audio_codecs = builtin_audio_codecs;
         nr_vcodecs = sizeof(builtin_video_codecs)/sizeof(codecs_t);
         nr_acodecs = sizeof(builtin_audio_codecs)/sizeof(codecs_t);
+        codec_strs = builtin_codec_strs;
+        codec_strs_len = sizeof(builtin_codec_strs);
         return 1;
 #endif
     }
@@ -639,6 +683,9 @@ int parse_codec_cfg(const char *cfgfile)
             continue;
         if (!strcmp(token[0], "audiocodec") ||
             !strcmp(token[0], "videocodec")) {
+            codec->comment_idx = codec_addstr(comment);
+            free(comment);
+            comment = NULL;
             if (!validate_codec(codec, codec_type))
                 goto err_out_not_valid;
         loop_enter:
@@ -671,27 +718,27 @@ int parse_codec_cfg(const char *cfgfile)
             if (get_token(1, 1) < 0)
                 goto err_out_parse_error;
             for (i = 0; i < *nr_codecsp - 1; i++) {
-                if(( (*codecsp)[i].name!=NULL) &&
-                   (!strcmp(token[0], (*codecsp)[i].name)) ) {
+                if(( (*codecsp)[i].name_idx) &&
+                   (!strcmp(token[0], codec_idx2str((*codecsp)[i].name_idx))) ) {
                     mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNameNotUnique, token[0]);
                     goto err_out_print_linenum;
                 }
             }
-            if (!(codec->name = strdup(token[0]))) {
+            if (!(codec->name_idx = codec_addstr(token[0]))) {
                 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupName, strerror(errno));
                 goto err_out;
             }
         } else if (!strcmp(token[0], "info")) {
-            if (codec->info || get_token(1, 1) < 0)
+            if (codec->info_idx || get_token(1, 1) < 0)
                 goto err_out_parse_error;
-            if (!(codec->info = strdup(token[0]))) {
+            if (!(codec->info_idx = codec_addstr(token[0]))) {
                 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupInfo, strerror(errno));
                 goto err_out;
             }
         } else if (!strcmp(token[0], "comment")) {
             if (get_token(1, 1) < 0)
                 goto err_out_parse_error;
-            add_comment(token[0], &codec->comment);
+            add_comment(token[0], &comment);
         } else if (!strcmp(token[0], "fourcc")) {
             if (get_token(1, 2) < 0)
                 goto err_out_parse_error;
@@ -708,14 +755,14 @@ int parse_codec_cfg(const char *cfgfile)
         } else if (!strcmp(token[0], "driver")) {
             if (get_token(1, 1) < 0)
                 goto err_out_parse_error;
-            if (!(codec->drv = strdup(token[0]))) {
+            if (!(codec->drv_idx = codec_addstr(token[0]))) {
                 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDriver, strerror(errno));
                 goto err_out;
             }
         } else if (!strcmp(token[0], "dll")) {
             if (get_token(1, 1) < 0)
                 goto err_out_parse_error;
-            if (!(codec->dll = strdup(token[0]))) {
+            if (!(codec->dll_idx = codec_addstr(token[0]))) {
                 mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDLL, strerror(errno));
                 goto err_out;
             }
@@ -789,8 +836,8 @@ int parse_codec_cfg(const char *cfgfile)
     if (!validate_codec(codec, codec_type))
         goto err_out_not_valid;
     mp_msg(MSGT_CODECCFG,MSGL_INFO,MSGTR_AudioVideoCodecTotals, nr_acodecs, nr_vcodecs);
-    if(video_codecs) video_codecs[nr_vcodecs].name = NULL;
-    if(audio_codecs) audio_codecs[nr_acodecs].name = NULL;
+    if(video_codecs) video_codecs[nr_vcodecs].name_idx = 0;
+    if(audio_codecs) audio_codecs[nr_acodecs].name_idx = 0;
 out:
     free(line);
     line=NULL;
@@ -817,26 +864,14 @@ err_out_release_num:
     goto err_out_print_linenum;
 }
 
-static void codecs_free(codecs_t* codecs,int count) {
-    int i;
-    for ( i = 0; i < count; i++)
-        if ( codecs[i].name ) {
-            free(codecs[i].name);
-            free(codecs[i].info);
-            free(codecs[i].comment);
-            free(codecs[i].dll);
-            free(codecs[i].drv);
-        }
-    free(codecs);
-}
-
 void codecs_uninit_free(void) {
-    if (video_codecs)
-    codecs_free(video_codecs,nr_vcodecs);
+    free(video_codecs);
     video_codecs=NULL;
-    if (audio_codecs)
-    codecs_free(audio_codecs,nr_acodecs);
+    free(audio_codecs);
     audio_codecs=NULL;
+    free(codec_strs);
+    codec_strs=NULL;
+    codec_strs_len = 0;
 }
 
 codecs_t *find_audio_codec(unsigned int fourcc, unsigned int *fourccmap,
@@ -944,16 +979,21 @@ void list_codecs(int audioflag){
         case CODECS_STATUS_NOT_WORKING: s="crashing";break;
         case CODECS_STATUS_UNTESTED:    s="untested";break;
         }
-        if(c->dll)
-            mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-9s %s  %s  [%s]\n",c->name,c->drv,s,c->info,c->dll);
+        if(c->dll_idx)
+            mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-9s %s  %s  [%s]\n",
+                   codec_idx2str(c->name_idx),
+                   codec_idx2str(c->drv_idx),s,codec_idx2str(c->info_idx),
+                   codec_idx2str(c->dll_idx));
         else
-            mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-9s %s  %s\n",c->name,c->drv,s,c->info);
+            mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-9s %s  %s\n",
+                   codec_idx2str(c->name_idx),
+                   codec_idx2str(c->drv_idx),s,codec_idx2str(c->info_idx));
         }
 }
 
 
 #ifdef CODECS2HTML
-static void wrapline(FILE *f2,char *s){
+static void wrapline(FILE *f2,const char *s){
     int c;
     if(!s){
         fprintf(f2,"-");
@@ -977,15 +1017,15 @@ static void parsehtml(FILE *f1,FILE *f2,
         case '.':
         return; // end of section
         case 'n':
-            wrapline(f2,codec->name); break;
+            wrapline(f2,codec_idx2str(codec->name_idx)); break;
         case 'i':
-            wrapline(f2,codec->info); break;
+            wrapline(f2,codec_idx2str(codec->info_idx)); break;
         case 'c':
-            wrapline(f2,codec->comment); break;
+            wrapline(f2,codec_idx2str(codec->comment_idx)); break;
         case 'd':
-            wrapline(f2,codec->dll); break;
+            wrapline(f2,codec_idx2str(codec->dll_idx)); break;
         case 'D':
-            fprintf(f2,"%c",!strcmp(codec->drv,"dshow")?'+':'-'); break;
+            fprintf(f2,"%c",!strcmp(codec_idx2str(codec->drv_idx),"dshow")?'+':'-'); break;
         case 'F':
             for(d=0;d<CODECS_MAX_FOURCC;d++)
                 if(!d || codec->fourcc[d]!=0xFFFFFFFF)
@@ -1045,12 +1085,6 @@ static void print_char_array(const unsig
     printf(" }");
 }
 
-static void print_string(const char* s)
-{
-    if (!s) printf("NULL");
-    else printf("\"%s\"", s);
-}
-
 int main(int argc, char* argv[])
 {
     codecs_t *cl;
@@ -1115,11 +1149,10 @@ int main(int argc, char* argv[])
                 print_char_array(cod[i][j].inflags, CODECS_MAX_INFMT);
                 printf(", /* inflags */\n");
 
-                print_string(cod[i][j].name);    printf(", /* name */\n");
-                print_string(cod[i][j].info);    printf(", /* info */\n");
-                print_string(cod[i][j].comment); printf(", /* comment */\n");
-                print_string(cod[i][j].dll);     printf(", /* dll */\n");
-                print_string(cod[i][j].drv);     printf(", /* drv */\n");
+                printf("%i, /* name */\n%i, /* info */\n"
+                       "%i, /* comment */\n%i, /* dll */\n%i, /* drv */\n",
+                       cod[i][j].name_idx, cod[i][j].info_idx,
+                       cod[i][j].comment_idx, cod[i][j].dll_idx, cod[i][j].drv_idx);
 
                 printf("{ 0x%08lx, %hu, %hu,",
                        cod[i][j].guid.f1,
@@ -1135,6 +1168,9 @@ int main(int argc, char* argv[])
             }
             printf("};\n\n");
         }
+        printf("const char builtin_codec_strs[] = ");
+        print_char_array(codec_strs, codec_strs_len);
+        printf(";\n");
         exit(0);
     }
 
@@ -1239,10 +1275,10 @@ next:
         for(i=0;i<nr_codecs;i++, c++){
             printf("\n============== %scodec %02d ===============\n",
                    state==0?"video":"audio",i);
-            printf("name='%s'\n",c->name);
-            printf("info='%s'\n",c->info);
-            printf("comment='%s'\n",c->comment);
-            printf("dll='%s'\n",c->dll);
+            printf("name='%s'\n",codec_idx2str(c->name_idx));
+            printf("info='%s'\n",codec_idx2str(c->info_idx));
+            printf("comment='%s'\n",codec_idx2str(c->comment_idx));
+            printf("dll='%s'\n",codec_idx2str(c->dll_idx));
             /* printf("flags=%X  driver=%d status=%d cpuflags=%d\n",
                       c->flags, c->driver, c->status, c->cpuflags); */
             printf("flags=%X status=%d cpuflags=%d\n",

Modified: trunk/codec-cfg.h
==============================================================================
--- trunk/codec-cfg.h	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/codec-cfg.h	Sun Mar  6 14:00:49 2016	(r37834)
@@ -65,11 +65,11 @@ typedef struct codecs {
     unsigned char outflags[CODECS_MAX_OUTFMT];
     unsigned int infmt[CODECS_MAX_INFMT];
     unsigned char inflags[CODECS_MAX_INFMT];
-    char *name;
-    char *info;
-    char *comment;
-    char *dll;
-    char* drv;
+    unsigned name_idx;
+    unsigned info_idx;
+    unsigned comment_idx;
+    unsigned dll_idx;
+    unsigned drv_idx;
     GUID guid;
 //    short driver;
     short flags;
@@ -86,6 +86,7 @@ codecs_t* find_codec(unsigned int fourcc
                      codecs_t *start, int audioflag, int force);
 void list_codecs(int audioflag);
 void codecs_uninit_free(void);
+const char *codec_idx2str(unsigned idx);
 
 typedef char ** stringset_t;
 void stringset_init(stringset_t *set);

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/command.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -787,7 +787,7 @@ static int mp_property_audio_codec(m_opt
 {
     if (!mpctx->sh_audio || !mpctx->sh_audio->codec)
         return M_PROPERTY_UNAVAILABLE;
-    return m_property_string_ro(prop, action, arg, mpctx->sh_audio->codec->name);
+    return m_property_string_ro(prop, action, arg, codec_idx2str(mpctx->sh_audio->codec->name_idx));
 }
 
 /// Audio bitrate (RO)
@@ -1373,7 +1373,7 @@ static int mp_property_video_codec(m_opt
 {
     if (!mpctx->sh_video || !mpctx->sh_video->codec)
         return M_PROPERTY_UNAVAILABLE;
-    return m_property_string_ro(prop, action, arg, mpctx->sh_video->codec->name);
+    return m_property_string_ro(prop, action, arg, codec_idx2str(mpctx->sh_video->codec->name_idx));
 }
 
 

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/gui/interface.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -869,7 +869,7 @@ int gui(int what, void *data)
         nfree(guiInfo.CodecName);
 
         if (guiInfo.sh_video)
-            guiInfo.CodecName = strdup(guiInfo.sh_video->codec->name);
+            guiInfo.CodecName = strdup(codec_idx2str(guiInfo.sh_video->codec->name_idx));
 
         state = (isSeekableStreamtype ? btnReleased : btnDisabled);
         btnSet(evForward10sec, state);

Modified: trunk/libmpcodecs/ad_acm.c
==============================================================================
--- trunk/libmpcodecs/ad_acm.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/ad_acm.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -96,7 +96,7 @@ static int preinit(sh_audio_t *sh_audio)
 	print_wave_header(priv->o_wf, MSGL_V);
     }
 
-    MSACM_RegisterDriver((const char *)sh_audio->codec->dll, in_fmt->wFormatTag, 0);
+    MSACM_RegisterDriver(codec_idx2str(sh_audio->codec->dll_idx), in_fmt->wFormatTag, 0);
     ret = acmStreamOpen(&priv->handle, (HACMDRIVER)NULL, in_fmt,
 			priv->o_wf, NULL, 0, 0, 0);
     if (ret)

Modified: trunk/libmpcodecs/ad_dmo.c
==============================================================================
--- trunk/libmpcodecs/ad_dmo.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/ad_dmo.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -51,9 +51,9 @@ static int preinit(sh_audio_t *sh_audio)
   DMO_AudioDecoder* ds_adec;
   int chans=(audio_output_channels==sh_audio->wf->nChannels) ?
       audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1);
-  if(!(ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf,chans)))
+  if(!(ds_adec=DMO_AudioDecoder_Open(codec_idx2str(sh_audio->codec->dll_idx),&sh_audio->codec->guid,sh_audio->wf,chans)))
   {
-    mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_audio->codec->dll);
+    mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,codec_idx2str(sh_audio->codec->dll_idx));
     return 0;
   }
     sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;

Modified: trunk/libmpcodecs/ad_dshow.c
==============================================================================
--- trunk/libmpcodecs/ad_dshow.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/ad_dshow.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -47,9 +47,9 @@ static int init(sh_audio_t *sh)
 static int preinit(sh_audio_t *sh_audio)
 {
   DS_AudioDecoder* ds_adec;
-  if(!(ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf)))
+  if(!(ds_adec=DS_AudioDecoder_Open(codec_idx2str(sh_audio->codec->dll_idx),&sh_audio->codec->guid,sh_audio->wf)))
   {
-    mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_audio->codec->dll);
+    mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,codec_idx2str(sh_audio->codec->dll_idx));
     return 0;
   }
     sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;

Modified: trunk/libmpcodecs/ad_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/ad_ffmpeg.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/ad_ffmpeg.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -106,9 +106,9 @@ static int init(sh_audio_t *sh_audio)
     mp_msg(MSGT_DECAUDIO,MSGL_V,"FFmpeg's libavcodec audio codec\n");
     init_avcodec();
 
-    lavc_codec = avcodec_find_decoder_by_name(sh_audio->codec->dll);
+    lavc_codec = avcodec_find_decoder_by_name(codec_idx2str(sh_audio->codec->dll_idx));
     if(!lavc_codec){
-	mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_audio->codec->dll);
+	mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingLAVCcodec,codec_idx2str(sh_audio->codec->dll_idx));
 	return 0;
     }
 

Modified: trunk/libmpcodecs/ad_realaud.c
==============================================================================
--- trunk/libmpcodecs/ad_realaud.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/ad_realaud.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -251,23 +251,24 @@ static int preinit(sh_audio_t *sh){
   // let's check if the driver is available, return 0 if not.
   // (you should do that if you use external lib(s) which is optional)
   unsigned int result;
+  const char *dll = codec_idx2str(sh->codec->dll_idx);
   char *path;
 
-  path = malloc(strlen(codec_path) + strlen(sh->codec->dll) + 2);
+  path = malloc(strlen(codec_path) + strlen(dll) + 2);
   if (!path) return 0;
-  sprintf(path, "%s/%s", codec_path, sh->codec->dll);
+  sprintf(path, "%s/%s", codec_path, dll);
 
     /* first try to load linux dlls, if failed and we're supporting win32 dlls,
        then try to load the windows ones */
 
 #ifdef HAVE_LIBDL
-    if (strstr(sh->codec->dll,".dll") || !load_syms_linux(path))
+    if (strstr(dll,".dll") || !load_syms_linux(path))
 #endif
 #ifdef CONFIG_WIN32DLL
-	if (!load_syms_windows(sh->codec->dll))
+	if (!load_syms_windows(dll))
 #endif
     {
-	mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingDLLcodec, sh->codec->dll);
+	mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingDLLcodec, dll);
 	mp_msg(MSGT_DECVIDEO, MSGL_HINT, "Read the RealAudio section of the DOCS!\n");
 	free(path);
 	return 0;

Modified: trunk/libmpcodecs/ad_spdif.c
==============================================================================
--- trunk/libmpcodecs/ad_spdif.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/ad_spdif.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -125,7 +125,7 @@ static int init(sh_audio_t *sh)
     lavf_ctx->duration   = AV_NOPTS_VALUE;
     lavf_ctx->start_time = AV_NOPTS_VALUE;
     for (i = 0; fmt_id_type[i].name; i++) {
-        if (!strcmp(sh->codec->dll, fmt_id_type[i].name)) {
+        if (!strcmp(codec_idx2str(sh->codec->dll_idx), fmt_id_type[i].name)) {
             lavf_ctx->streams[0]->codec->codec_id = fmt_id_type[i].id;
             break;
         }

Modified: trunk/libmpcodecs/ad_twin.c
==============================================================================
--- trunk/libmpcodecs/ad_twin.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/ad_twin.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -182,7 +182,7 @@ int preinit(sh_audio_t *sh_audio)
   vqf_priv_t *priv;
   if(!(sh_audio->context=malloc(sizeof(vqf_priv_t)))) return 0;
   priv=sh_audio->context;
-  if(!load_dll(sh_audio->codec->dll))
+  if(!load_dll(codec_idx2str(sh_audio->codec->dll_idx)))
   {
     mp_msg(MSGT_DECAUDIO, MSGL_ERR, "win32.dll looks broken :(\n");
     return 0;
@@ -191,7 +191,7 @@ int preinit(sh_audio_t *sh_audio)
     mp_msg(MSGT_DECAUDIO, MSGL_ERR, "TWinVQ initialization fail\n");
     return 0;
   }
-  mp_msg(MSGT_DECAUDIO, MSGL_INFO, "INFO: TWinVQ (%s) audio codec init OK!\n",sh_audio->codec->dll);
+  mp_msg(MSGT_DECAUDIO, MSGL_INFO, "INFO: TWinVQ (%s) audio codec init OK!\n",codec_idx2str(sh_audio->codec->dll_idx));
   priv->skip_cnt = 2;
   return 1;
 }

Modified: trunk/libmpcodecs/dec_audio.c
==============================================================================
--- trunk/libmpcodecs/dec_audio.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/dec_audio.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -159,6 +159,7 @@ static int init_audio(sh_audio_t *sh_aud
     }
     sh_audio->codec = NULL;
     while (1) {
+        const char *drv;
 	const ad_functions_t *mpadec;
 	int i;
 	sh_audio->ad_driver = 0;
@@ -169,22 +170,22 @@ static int init_audio(sh_audio_t *sh_aud
 						 sh_audio->wf ? (&i) : NULL,
 						 sh_audio->codec, force)))
 	    break;
+        drv = codec_idx2str(sh_audio->codec->drv_idx);
 	if (sh_audio->wf)
 	    sh_audio->wf->wFormatTag = i;
 	// ok we found one codec
-	if (stringset_test(selected, sh_audio->codec->name))
+	if (stringset_test(selected, codec_idx2str(sh_audio->codec->name_idx)))
 	    continue;	// already tried & failed
-	if (codecname && strcmp(sh_audio->codec->name, codecname))
+	if (codecname && strcmp(codec_idx2str(sh_audio->codec->name_idx), codecname))
 	    continue;	// -ac
-	if (afm && strcmp(sh_audio->codec->drv, afm))
+	if (afm && strcmp(drv, afm))
 	    continue;	// afm doesn't match
 	if (!force && sh_audio->codec->status < status)
 	    continue;	// too unstable
-	stringset_add(selected, sh_audio->codec->name);	// tagging it
+	stringset_add(selected, codec_idx2str(sh_audio->codec->name_idx));	// tagging it
 	// ok, it matches all rules, let's find the driver!
 	for (i = 0; mpcodecs_ad_drivers[i] != NULL; i++)
-	    if (!strcmp(mpcodecs_ad_drivers[i]->info->short_name,
-		 sh_audio->codec->drv))
+	    if (!strcmp(mpcodecs_ad_drivers[i]->info->short_name, drv))
 		break;
 	mpadec = mpcodecs_ad_drivers[i];
 #ifdef CONFIG_DYNAMIC_PLUGINS
@@ -196,37 +197,37 @@ static int init_audio(sh_audio_t *sh_aud
 	    ad_info_t *info_sym;
 
 	    buf_len =
-		strlen(MPLAYER_LIBDIR) + strlen(sh_audio->codec->drv) + 16;
+		strlen(MPLAYER_LIBDIR) + strlen(drv) + 16;
 	    buf = malloc(buf_len);
 	    if (!buf)
 		break;
-	    snprintf(buf, buf_len, "%s/mplayer/ad_%s.so", MPLAYER_LIBDIR,
-		     sh_audio->codec->drv);
+	    snprintf(buf, buf_len, "%s/mplayer/ad_%s.so", MPLAYER_LIBDIR, drv);
 	    mp_msg(MSGT_DECAUDIO, MSGL_DBG2,
 		   "Trying to open external plugin: %s\n", buf);
 	    sh_audio->dec_handle = dlopen(buf, RTLD_LAZY);
 	    if (!sh_audio->dec_handle)
 		break;
-	    snprintf(buf, buf_len, "mpcodecs_ad_%s", sh_audio->codec->drv);
+	    snprintf(buf, buf_len, "mpcodecs_ad_%s", drv);
 	    funcs_sym = dlsym(sh_audio->dec_handle, buf);
 	    if (!funcs_sym || !funcs_sym->info || !funcs_sym->preinit
 		|| !funcs_sym->init || !funcs_sym->uninit
 		|| !funcs_sym->control || !funcs_sym->decode_audio)
 		break;
 	    info_sym = funcs_sym->info;
-	    if (strcmp(info_sym->short_name, sh_audio->codec->drv))
+	    if (strcmp(info_sym->short_name, drv))
 		break;
 	    free(buf);
 	    mpadec = funcs_sym;
 	    mp_msg(MSGT_DECAUDIO, MSGL_V,
 		   "Using external decoder plugin (%s/mplayer/ad_%s.so)!\n",
-		   MPLAYER_LIBDIR, sh_audio->codec->drv);
+		   MPLAYER_LIBDIR, drv);
 	}
 #endif
 	if (!mpadec) {		// driver not available (==compiled in)
 	    mp_msg(MSGT_DECAUDIO, MSGL_ERR,
 		   MSGTR_AudioCodecFamilyNotAvailableStr,
-		   sh_audio->codec->name, sh_audio->codec->drv);
+		   codec_idx2str(sh_audio->codec->name_idx),
+                   codec_idx2str(sh_audio->codec->drv_idx));
 	    continue;
 	}
 	/* only allow dummy codecs if specified via -ac */
@@ -305,7 +306,9 @@ int init_best_audio_codec(sh_audio_t *sh
     }
 
     mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_SelectedAudioCodec,
-	   sh_audio->codec->name, sh_audio->codec->drv, sh_audio->codec->info);
+	   codec_idx2str(sh_audio->codec->name_idx),
+	   codec_idx2str(sh_audio->codec->drv_idx),
+	   codec_idx2str(sh_audio->codec->info_idx));
     return 1;   // success
 }
 
@@ -319,7 +322,7 @@ void uninit_audio(sh_audio_t *sh_audio)
     }
     if (sh_audio->initialized) {
 	mp_msg(MSGT_DECAUDIO, MSGL_V, "Uninit audio: %s\n",
-	       sh_audio->codec->drv);
+	       codec_idx2str(sh_audio->codec->drv_idx));
 	sh_audio->ad_driver->uninit(sh_audio);
 #ifdef CONFIG_DYNAMIC_PLUGINS
 	if (sh_audio->dec_handle)

Modified: trunk/libmpcodecs/dec_video.c
==============================================================================
--- trunk/libmpcodecs/dec_video.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/dec_video.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -175,7 +175,7 @@ void uninit_video(sh_video_t *sh_video)
 {
     if (!sh_video->initialized)
         return;
-    mp_msg(MSGT_DECVIDEO, MSGL_V, "Uninit video: %s\n", sh_video->codec->drv);
+    mp_msg(MSGT_DECVIDEO, MSGL_V, "Uninit video: %s\n", codec_idx2str(sh_video->codec->drv_idx));
     mpvdec->uninit(sh_video);
     mpvdec = NULL;
 #ifdef CONFIG_DYNAMIC_PLUGINS
@@ -213,6 +213,7 @@ static int init_video(sh_video_t *sh_vid
     }
 
     while (1) {
+        const char *drv;
         int i;
         int orig_w, orig_h;
         // restore original fourcc:
@@ -223,22 +224,22 @@ static int init_video(sh_video_t *sh_vid
                                sh_video->bih ? ((unsigned int *) &sh_video->bih->biCompression) : NULL,
                                sh_video->codec, force)))
             break;
+        drv = codec_idx2str(sh_video->codec->drv_idx);
         // ok we found one codec
-        if (stringset_test(selected, sh_video->codec->name))
+        if (stringset_test(selected, codec_idx2str(sh_video->codec->name_idx)))
             continue;           // already tried & failed
-        if (codecname && strcmp(sh_video->codec->name, codecname))
+        if (codecname && strcmp(codec_idx2str(sh_video->codec->name_idx), codecname))
             continue;           // -vc
-        if (vfm && strcmp(sh_video->codec->drv, vfm))
+        if (vfm && strcmp(drv, vfm))
             continue;           // vfm doesn't match
         if (!force && sh_video->codec->status < status)
             continue;           // too unstable
-        stringset_add(selected, sh_video->codec->name); // tagging it
+        stringset_add(selected, codec_idx2str(sh_video->codec->name_idx)); // tagging it
         // ok, it matches all rules, let's find the driver!
         for (i = 0; mpcodecs_vd_drivers[i] != NULL; i++)
 //          if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver) break;
             if (!strcmp
-                (mpcodecs_vd_drivers[i]->info->short_name,
-                 sh_video->codec->drv))
+                (mpcodecs_vd_drivers[i]->info->short_name, drv))
                 break;
         mpvdec = mpcodecs_vd_drivers[i];
 #ifdef CONFIG_DYNAMIC_PLUGINS
@@ -250,37 +251,36 @@ static int init_video(sh_video_t *sh_vid
             vd_info_t *info_sym;
 
             buf_len = strlen(MPLAYER_LIBDIR) +
-                      strlen(sh_video->codec->drv) + 16;
+                      strlen(drv) + 16;
             buf = malloc(buf_len);
             if (!buf)
                 break;
-            snprintf(buf, buf_len, "%s/mplayer/vd_%s.so", MPLAYER_LIBDIR,
-                     sh_video->codec->drv);
+            snprintf(buf, buf_len, "%s/mplayer/vd_%s.so", MPLAYER_LIBDIR, drv);
             mp_msg(MSGT_DECVIDEO, MSGL_DBG2,
                    "Trying to open external plugin: %s\n", buf);
             sh_video->dec_handle = dlopen(buf, RTLD_LAZY);
             if (!sh_video->dec_handle)
                 break;
-            snprintf(buf, buf_len, "mpcodecs_vd_%s", sh_video->codec->drv);
+            snprintf(buf, buf_len, "mpcodecs_vd_%s", drv);
             funcs_sym = dlsym(sh_video->dec_handle, buf);
             if (!funcs_sym || !funcs_sym->info || !funcs_sym->init
                 || !funcs_sym->uninit || !funcs_sym->control
                 || !funcs_sym->decode)
                 break;
             info_sym = funcs_sym->info;
-            if (strcmp(info_sym->short_name, sh_video->codec->drv))
+            if (strcmp(info_sym->short_name, drv))
                 break;
             free(buf);
             mpvdec = funcs_sym;
             mp_msg(MSGT_DECVIDEO, MSGL_V,
                    "Using external decoder plugin (%s/mplayer/vd_%s.so)!\n",
-                   MPLAYER_LIBDIR, sh_video->codec->drv);
+                   MPLAYER_LIBDIR, drv);
         }
 #endif
         if (!mpvdec) {          // driver not available (==compiled in)
             mp_msg(MSGT_DECVIDEO, MSGL_WARN,
                    MSGTR_VideoCodecFamilyNotAvailableStr,
-                   sh_video->codec->name, sh_video->codec->drv);
+                   codec_idx2str(sh_video->codec->name_idx), drv);
             continue;
         }
         /* only allow dummy codecs if specified via -vc */
@@ -381,7 +381,9 @@ int init_best_video_codec(sh_video_t *sh
     }
 
     mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_SelectedVideoCodec,
-           sh_video->codec->name, sh_video->codec->drv, sh_video->codec->info);
+           codec_idx2str(sh_video->codec->name_idx),
+           codec_idx2str(sh_video->codec->drv_idx),
+           codec_idx2str(sh_video->codec->info_idx));
     return 1;                   // success
 }
 

Modified: trunk/libmpcodecs/vd_dmo.c
==============================================================================
--- trunk/libmpcodecs/vd_dmo.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/vd_dmo.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -58,8 +58,8 @@ static int init(sh_video_t *sh){
     unsigned int out_fmt=sh->codec->outfmt[0];
     struct context *ctx;
     void *decoder;
-    if(!(decoder=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
-        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
+    if(!(decoder=DMO_VideoDecoder_Open(codec_idx2str(sh->codec->dll_idx),&sh->codec->guid, sh->bih, 0, 0))){
+        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,codec_idx2str(sh->codec->dll_idx));
         mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_DownloadCodecPackage);
 	return 0;
     }

Modified: trunk/libmpcodecs/vd_dshow.c
==============================================================================
--- trunk/libmpcodecs/vd_dshow.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/vd_dshow.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -68,16 +68,17 @@ static int control(sh_video_t *sh,int cm
 // init driver
 static int init(sh_video_t *sh){
     unsigned int out_fmt=sh->codec->outfmt[0];
+    const char *dll = codec_idx2str(sh->codec->dll_idx);
 
     /* Hack for VSSH codec: new dll can't decode old files
      * In my samples old files have no extradata, so use that info
      * to decide what dll should be used (here and in vd_vfw).
      */
-    if (!strcmp(sh->codec->dll, "vsshdsd.dll") && (sh->bih->biSize == 40))
+    if (!strcmp(dll, "vsshdsd.dll") && (sh->bih->biSize == 40))
       return 0;
 
-    if(!(sh->context=DS_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
-        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
+    if(!(sh->context=DS_VideoDecoder_Open(dll,&sh->codec->guid, sh->bih, 0, 0))){
+        mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,dll);
         mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_DownloadCodecPackage);
 	return 0;
     }

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -337,9 +337,9 @@ static int init(sh_video_t *sh){
     if (!ctx)
         return 0;
 
-    lavc_codec = avcodec_find_decoder_by_name(sh->codec->dll);
+    lavc_codec = avcodec_find_decoder_by_name(codec_idx2str(sh->codec->dll_idx));
     if(!lavc_codec){
-        mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingLAVCcodec, sh->codec->dll);
+        mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingLAVCcodec, codec_idx2str(sh->codec->dll_idx));
         uninit(sh);
         return 0;
     }

Modified: trunk/libmpcodecs/vd_realvid.c
==============================================================================
--- trunk/libmpcodecs/vd_realvid.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/vd_realvid.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -265,6 +265,7 @@ static int init(sh_video_t *sh){
 	unsigned char* extrahdr=(unsigned char*)(sh->bih+1);
 	unsigned int extrahdr_size = sh->bih->biSize - sizeof(*sh->bih);
 	struct rv_init_t init_data;
+	const char *dll = codec_idx2str(sh->codec->dll_idx);
 
 	if(extrahdr_size < 8) {
 	    mp_msg(MSGT_DECVIDEO,MSGL_ERR,"realvideo: extradata too small (%u)\n", extrahdr_size);
@@ -274,20 +275,20 @@ static int init(sh_video_t *sh){
 
 	mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X  sub-id: 0x%08X\n",init_data.format,init_data.subformat);
 
-	path = malloc(strlen(codec_path) + strlen(sh->codec->dll) + 2);
+	path = malloc(strlen(codec_path) + strlen(dll) + 2);
 	if (!path) return 0;
-	sprintf(path, "%s/%s", codec_path, sh->codec->dll);
+	sprintf(path, "%s/%s", codec_path, dll);
 
 	/* first try to load linux dlls, if failed and we're supporting win32 dlls,
 	   then try to load the windows ones */
 #ifdef HAVE_LIBDL
-	if(strstr(sh->codec->dll,".dll") || !load_syms_linux(path))
+	if(strstr(dll,".dll") || !load_syms_linux(path))
 #endif
 #ifdef CONFIG_WIN32DLL
-	    if (!load_syms_windows(sh->codec->dll))
+	    if (!load_syms_windows(dll))
 #endif
 	{
-		mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
+		mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,dll);
 		mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Read the RealVideo section of the DOCS!\n");
 		free(path);
 		return 0;

Modified: trunk/libmpcodecs/vd_vfw.c
==============================================================================
--- trunk/libmpcodecs/vd_vfw.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/vd_vfw.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -157,12 +157,13 @@ static int init(sh_video_t *sh){
 //    unsigned int outfmt=sh->codec->outfmt[sh->outfmtidx];
     int i, o_bih_len;
     vd_vfw_ctx *priv;
+    const char *dll = codec_idx2str(sh->codec->dll_idx);
 
     /* Hack for VSSH codec: new dll can't decode old files
      * In my samples old files have no extradata, so use that info
      * to decide what dll should be used (here and in vd_dshow).
      */
-    if (!strcmp(sh->codec->dll, "vssh264.dll") && (sh->bih->biSize > 40))
+    if (!strcmp(dll, "vssh264.dll") && (sh->bih->biSize > 40))
       return 0;
 
     priv = malloc(sizeof(vd_vfw_ctx));
@@ -174,10 +175,10 @@ static int init(sh_video_t *sh){
     mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Codec init =======\n");
 
 
-//    win32_codec_name = sh->codec->dll;
+//    win32_codec_name = dll;
 //    sh->hic = ICOpen( 0x63646976, sh->bih->biCompression, ICMODE_FASTDECOMPRESS);
 //    priv->handle = ICOpen( 0x63646976, sh->bih->biCompression, ICMODE_DECOMPRESS);
-    priv->handle = ICOpen( (long)(sh->codec->dll), sh->bih->biCompression, ICMODE_DECOMPRESS);
+    priv->handle = ICOpen( (long)(dll), sh->bih->biCompression, ICMODE_DECOMPRESS);
     if(!priv->handle){
 	mp_msg(MSGT_WIN32,MSGL_ERR,"ICOpen failed! unknown codec / wrong parameters?\n");
 	return 0;

Modified: trunk/libmpcodecs/vd_xanim.c
==============================================================================
--- trunk/libmpcodecs/vd_xanim.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/libmpcodecs/vd_xanim.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -698,13 +698,13 @@ static int init(sh_video_t *sh)
     for (i=0; i < XA_CLOSE_FUNCS; i++)
 	xa_close_func[i] = NULL;
 
-    snprintf(dll, 1024, "%s/%s", codec_path, sh->codec->dll);
+    snprintf(dll, 1024, "%s/%s", codec_path, codec_idx2str(sh->codec->dll_idx));
     if (xacodec_load(sh, dll) == 0)
 	return 0;
 
     codec_hdr.xapi_rev = XAVID_API_REV;
     codec_hdr.anim_hdr = malloc(4096);
-    codec_hdr.description = sh->codec->info;
+    codec_hdr.description = codec_idx2str(sh->codec->info_idx);
     codec_hdr.compression = bswap_32(sh->bih->biCompression);
     codec_hdr.decoder = NULL;
     codec_hdr.x = sh->bih->biWidth; /* ->disp_w */

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Sun Mar  6 13:53:04 2016	(r37833)
+++ trunk/mplayer.c	Sun Mar  6 14:00:49 2016	(r37834)
@@ -467,8 +467,8 @@ char *get_metadata(metadata_t type)
         return mp_asprintf("%d x %d", sh_video->disp_w, sh_video->disp_h);
 
     case META_AUDIO_CODEC:
-        if (sh_audio->codec && sh_audio->codec->name)
-            return strdup(sh_audio->codec->name);
+        if (sh_audio->codec && sh_audio->codec->name_idx)
+            return strdup(codec_idx2str(sh_audio->codec->name_idx));
         break;
 
     case META_AUDIO_BITRATE:
@@ -2407,7 +2407,7 @@ int reinit_video_chain(void)
     initialized_flags |= INITIALIZED_VCODEC;
 
     if (sh_video->codec)
-        mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_CODEC=%s\n", sh_video->codec->name);
+        mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_CODEC=%s\n", codec_idx2str(sh_video->codec->name_idx));
 
     sh_video->last_pts = MP_NOPTS_VALUE;
     sh_video->num_buffered_pts = 0;
@@ -3648,7 +3648,7 @@ goto_enable_cache:
         if (mpctx->sh_audio) {
             reinit_audio_chain();
             if (mpctx->sh_audio && mpctx->sh_audio->codec)
-                mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_CODEC=%s\n", mpctx->sh_audio->codec->name);
+                mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_CODEC=%s\n", codec_idx2str(mpctx->sh_audio->codec->name_idx));
             if (mpctx->audio_out)
                 mpctx->audio_out->control(AOCONTROL_FILENAME, (void *)(vo_wintitle ? vo_wintitle : mp_basename(filename)));
         }


More information about the MPlayer-cvslog mailing list