[Mplayer-cvslog] CVS: main codec-cfg.c,1.4,1.5

GEREOFFY arpi_esp at users.sourceforge.net
Sat Apr 7 03:03:26 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv16519

Modified Files:
	codec-cfg.c 
Log Message:
get_driver() implemented

Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** codec-cfg.c	2001/04/07 00:51:38	1.4
--- codec-cfg.c	2001/04/07 01:03:24	1.5
***************
*** 230,251 ****
  }
  
! short get_driver(char *s)
  {
  	return 0;
  }
  
! #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
--- 230,265 ----
  }
  
! 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
  
  codecs_t *parse_codec_cfg(char *cfgfile)
  {
  #define PRINT_LINENUM	printf("%s(%d): ", cfgfile, line_num)
  
  	codecs_t *codecs = NULL;  // array of codecs
***************
*** 262,273 ****
  	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'");
  		return NULL;
  	}
  
! 	if ((fp = fopen(cfgfile, "r")) == NULL) {
! 		printf("parse_codec_cfg: can't open '%s': %s\n", cfgfile, strerror(errno));
! 		free(line);
  		return NULL;
  	}
--- 276,286 ----
  	printf("Reading codec config file: %s\n", cfgfile);
  
! 	if ((fp = fopen(cfgfile, "r")) == NULL) {
! 		printf("parse_codec_cfg: can't open '%s': %s\n", cfgfile, strerror(errno));
  		return NULL;
  	}
  
! 	if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
! 		perror("parse_codec_cfg: can't get memory for 'line'");
  		return NULL;
  	}
***************
*** 378,382 ****
  			if (get_token() < 0)
  				goto parse_error_out;
! 			if ((codec->driver = get_driver(token)) == -1)
  				goto err_out;
  			printf(" %s\n", token);
--- 391,395 ----
  			if (get_token() < 0)
  				goto parse_error_out;
! 			if ((codec->driver = get_driver(token,codec->flags&CODECS_FLAG_AUDIO)) == -1)
  				goto err_out;
  			printf(" %s\n", token);


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list