summaryrefslogtreecommitdiffstats
path: root/codec-cfg.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-07 01:03:24 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-04-07 01:03:24 +0000
commit19dc8c9568fd9687b31a02511803108f7cfd2524 (patch)
tree7149fec91d10845535ac3e962cfaa609ef3ec0a0 /codec-cfg.c
parent43b27845ac21f14ccf07eee9a8c95574c51bab6c (diff)
downloadmpv-19dc8c9568fd9687b31a02511803108f7cfd2524.tar.bz2
mpv-19dc8c9568fd9687b31a02511803108f7cfd2524.tar.xz
get_driver() implemented
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@302 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'codec-cfg.c')
-rw-r--r--codec-cfg.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/codec-cfg.c b/codec-cfg.c
index fa139d5f2f..6e56589f02 100644
--- a/codec-cfg.c
+++ b/codec-cfg.c
@@ -229,24 +229,38 @@ int add_to_out(char *sfmt, char *sflags, unsigned int *outfmt,
return 1;
}
-short get_driver(char *s)
+short get_driver(char *s,int audioflag)
{
+ static char *audiodrv[] = {
+ "mp3lib",
+ "pcm",
+ "libac3",
+ "acm",
+ "alaw",
+ "msgsm",
+ "dshow",
+ NULL
+ };
+ static char *videodrv[] = {
+ "libmpeg2",
+ "vfw",
+ "odivx",
+ "dshow",
+ NULL
+ };
+ char **drv=audioflag?audiodrv:videodrv;
+ int i;
+
+ for(i=0;drv[i];i++) if(!strcmp(s,drv[i])) return i+1;
+
return 0;
}
-#define DEBUG
+//#define DEBUG
codecs_t *parse_codec_cfg(char *cfgfile)
{
#define PRINT_LINENUM printf("%s(%d): ", cfgfile, line_num)
-#define GET_MEM\
- do {\
- if (!(codecs = (codecs_t *) realloc(codecs,\
- sizeof(codecs_t) * (nr_codecs + 1)))) {\
- perror("parse_codec_cfg: can't realloc 'codecs'");\
- goto err_out;\
- }\
- } while (0)
codecs_t *codecs = NULL; // array of codecs
codecs_t *codec = NULL; // currect codec
@@ -261,14 +275,13 @@ codecs_t *parse_codec_cfg(char *cfgfile)
printf("Reading codec config file: %s\n", cfgfile);
- if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
- perror("parse_codec_cfg: can't get memory for 'line'");
+ if ((fp = fopen(cfgfile, "r")) == NULL) {
+ printf("parse_codec_cfg: can't open '%s': %s\n", cfgfile, strerror(errno));
return NULL;
}
- if ((fp = fopen(cfgfile, "r")) == NULL) {
- printf("parse_codec_cfg: can't open '%s': %s\n", cfgfile, strerror(errno));
- free(line);
+ if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
+ perror("parse_codec_cfg: can't get memory for 'line'");
return NULL;
}
line_pos = 0;
@@ -377,7 +390,7 @@ codecs_t *parse_codec_cfg(char *cfgfile)
printf("driver");
if (get_token() < 0)
goto parse_error_out;
- if ((codec->driver = get_driver(token)) == -1)
+ if ((codec->driver = get_driver(token,codec->flags&CODECS_FLAG_AUDIO)) == -1)
goto err_out;
printf(" %s\n", token);
} else if (!strcmp(token, "dll")) {