[Mplayer-cvslog] CVS: main codec-cfg.c,1.7,1.8 codec-cfg.h,1.5,1.6

Szabolcs Berecz szabii at users.sourceforge.net
Mon Apr 9 22:21:09 CEST 2001


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

Modified Files:
	codec-cfg.c codec-cfg.h 
Log Message:
lots of changes

Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** codec-cfg.c	2001/04/08 23:42:25	1.7
--- codec-cfg.c	2001/04/09 20:21:07	1.8
***************
*** 1,8 ****
  
! //#define DEBUG
! #define PRINT_LINENUM
! //	printf("%s(%d): ", cfgfile, line_num)
  
  
  #include <stdio.h>
  #include <stdlib.h>
--- 1,18 ----
+ /*
+  * codec.conf parser
+  * by Szabolcs Berecz <szabi at inf.elte.hu>
+  * (C) 2001
+  */
  
! #define DEBUG
  
+ #ifdef DEBUG
+ #define DBG(str, args...) printf(str, ##args)
+ #else
+ #define DBG(str, args...) do {} while (0)
+ #endif
  
+ #define PRINT_LINENUM printf("%s(%d): ", cfgfile, line_num)
+ 
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 17,21 ****
  #include "codec-cfg.h"
  
! #define MALLOC_ADD	10
  
  #define MAX_LINE_LEN	1000
--- 27,31 ----
  #include "codec-cfg.h"
  
! #define MAX_NR_TOKEN	16
  
  #define MAX_LINE_LEN	1000
***************
*** 33,52 ****
  #define RET_EOF		-1
  #define RET_EOL		-2
- #define RET_OK		0
  
  static FILE *fp;
  static int line_num = 0;
  static int line_pos;	/* line pos */
- static int firstdef = 1;
  static char *line;
! static char *token;
  
  static codecs_t *codecs=NULL;
  static int nr_codecs = 0;
  
! static int get_token(void)
  {
  	static int read_nextline = 1;
  
  	if (read_nextline) {
  		if (!fgets(line, MAX_LINE_LEN, fp))
--- 43,69 ----
  #define RET_EOF		-1
  #define RET_EOL		-2
  
  static FILE *fp;
  static int line_num = 0;
  static int line_pos;	/* line pos */
  static char *line;
! static char *token[MAX_NR_TOKEN];
  
  static codecs_t *codecs=NULL;
  static int nr_codecs = 0;
  
! static int get_token(int min, int max)
  {
  	static int read_nextline = 1;
+ 	int i;
+ 	char c;
  
+ 	if (max >= MAX_NR_TOKEN) {
+ 		printf("\nget_token(): max >= MAX_NR_TOKEN!\n");
+ 		goto ret_eof;
+ 	}
+ 
+ 	memset(token, 0x00, sizeof(*token) * max);
+ 
  	if (read_nextline) {
  		if (!fgets(line, MAX_LINE_LEN, fp))
***************
*** 55,96 ****
  		++line_num;
  		read_nextline = 0;
- 	}
- 	while (isspace(line[line_pos]))
- 		++line_pos;
- 	if (line[line_pos] == '\0' || line[line_pos] == '#' ||
- 			line[line_pos] == ';') {
- 		read_nextline = 1;
- 		goto ret_eol;
  	}
! 	token = line + line_pos;
! 	if (line[line_pos] == '"') {
! 		token++;
! 		for (/* NOTHING */; line[++line_pos] != '"' && line[line_pos];)
! 			/* NOTHING */;
  		if (!line[line_pos]) {
  			read_nextline = 1;
  			goto ret_eol;
  		}
! 	} else {
! 		for (/* NOTHING */; !isspace(line[line_pos]); line_pos++)
! 			/* NOTHING */;
  	}
! 	line[line_pos] = '\0';
! 	line_pos++;
! #ifdef DEBUG
! 	printf("get_token ok\n");
! #endif
! 	return RET_OK;
  ret_eof:
- #ifdef DEBUG
- 	printf("get_token EOF\n");
- #endif
- 	token = NULL;
  	return RET_EOF;
  ret_eol:
- #ifdef DEBUG
- 	printf("get_token EOL\n");
- #endif
- 	token = NULL;
  	return RET_EOL;
  }
--- 72,111 ----
  		++line_num;
  		read_nextline = 0;
  	}
! 	for (i = 0; i < max; i++) {
! 		while (isspace(line[line_pos]))
! 			++line_pos;
! 		if (line[line_pos] == '\0' || line[line_pos] == '#' ||
! 				line[line_pos] == ';') {
! 			read_nextline = 1;
! 			if (i >= min)
! 				goto ret_ok;
! 			goto ret_eol;
! 		}
! 		token[i] = line + line_pos;
! 		c = line[line_pos];
! 		if (c == '"' || c == '\'') {
! 			token[i]++;
! 			while (line[++line_pos] != c && line[line_pos])
! 				/* NOTHING */;
! 		} else {
! 			for (/* NOTHING */; !isspace(line[line_pos]) &&
! 					line[line_pos]; line_pos++)
! 				/* NOTHING */;
! 		}
  		if (!line[line_pos]) {
  			read_nextline = 1;
+ 			if (i >= min - 1)
+ 				goto ret_ok;
  			goto ret_eol;
  		}
! 		line[line_pos] = '\0';
! 		line_pos++;
  	}
! ret_ok:
! 	return i;
  ret_eof:
  	return RET_EOF;
  ret_eol:
  	return RET_EOL;
  }
***************
*** 99,149 ****
  		unsigned int *map)
  {
! 	int i;
  	char **aliasp;
  
  	/* find first unused slot */
  	for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++)
  		/* NOTHING */;
! 	if (i == CODECS_MAX_FOURCC) {
! 		printf("too many fourcc...\n");
! 		return 0;
! 	}
! #if 1
! 	if (alias) {
! 		do {
! 			fourcc[i] = *((unsigned int *) s);
! 			map[i] = *((unsigned int *) alias);
! 			s += 4;
! 			i++;
! 		} while (*(s++) == ',');
! 	} else {
! 		do {
! 			fourcc[i] = *((unsigned int *) s);
! 			map[i] = *((unsigned int *) s);
! 			s += 4;
! 			i++;
! 		} while (*(s++) == ',');
! 	}
! #else
! 	if (alias)
! 		aliasp = &alias;
! 	else
! 		aliasp = &s;
  	do {
! 		fourcc[i] = *((unsigned int *) s);
! 		map[i++] = *((unsigned int *) (*aliasp));
  		s += 4;
! 	} while (*(s++) == ',');
! #endif
  	if (*(--s) != '\0')
  		return 0;
  	return 1;
  }
  
  static int add_to_format(char *s, unsigned int *fourcc, unsigned int *fourccmap)
  {
! //        printf("\n-----[%s][%s]-----\n",s,format);
  
! 	int i;
  
  	/* find first unused slot */
--- 114,158 ----
  		unsigned int *map)
  {
! 	int i, j, freeslots;
  	char **aliasp;
+ 	unsigned int tmp;
  
  	/* find first unused slot */
  	for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++)
  		/* NOTHING */;
! 	freeslots = CODECS_MAX_FOURCC - i;
! 	if (!freeslots)
! 		goto too_many_error_out;
! 
! 	aliasp = (alias) ? &alias : &s;
  	do {
! 		tmp = *((unsigned int *) s);
! 		for (j = 0; j < i; j++)
! 			if (tmp == fourcc[j])
! 				goto duplicated_error_out;
! 		fourcc[i] = tmp;
! 		map[i] = *((unsigned int *) (*aliasp));
  		s += 4;
! 		i++;
! 	} while ((*(s++) == ',') && --freeslots);
! 
! 	if (!freeslots)
! 		goto too_many_error_out;
  	if (*(--s) != '\0')
  		return 0;
  	return 1;
+ duplicated_error_out:
+ 	printf("\nduplicated fourcc/format\n");
+ 	return 0;
+ too_many_error_out:
+ 	printf("\ntoo many fourcc/format...\n");
+ 	return 0;
  }
  
  static int add_to_format(char *s, unsigned int *fourcc, unsigned int *fourccmap)
  {
! 	//printf("\n-----[%s][%s]-----\n",s,format);
  
! 	int i, j;
  
  	/* find first unused slot */
***************
*** 151,159 ****
  		/* NOTHING */;
  	if (i == CODECS_MAX_FOURCC) {
! 		printf("too many fourcc...\n");
  		return 0;
  	}
!         
          fourcc[i]=fourccmap[i]=strtoul(s,NULL,0);
  
  	return 1;
--- 160,173 ----
  		/* NOTHING */;
  	if (i == CODECS_MAX_FOURCC) {
! 		printf("\ntoo many fourcc/format...\n");
  		return 0;
  	}
! 
          fourcc[i]=fourccmap[i]=strtoul(s,NULL,0);
+ 	for (j = 0; j < i; j++)
+ 		if (fourcc[j] == fourcc[i]) {
+ 			printf("\nduplicated fourcc/format\n");
+ 			return 0;
+ 		}
  
  	return 1;
***************
*** 200,214 ****
  	};
  
! 	int i, j;
  	unsigned char flags;
  
  	for (i = 0; i < CODECS_MAX_OUTFMT && outfmt[i] != 0xffffffff; i++)
  		/* NOTHING */;
! 	if (i == CODECS_MAX_FOURCC) {
! 		printf("too many out...\n");
! 		return 0;
! 	}
  
! 	flags = 0; //get_flags(sflags);
  	if(sflags) do {
  		for (j = 0; flagstr[j] != NULL; j++)
--- 214,227 ----
  	};
  
! 	int i, j, freeslots;
  	unsigned char flags;
  
  	for (i = 0; i < CODECS_MAX_OUTFMT && outfmt[i] != 0xffffffff; i++)
  		/* NOTHING */;
! 	freeslots = CODECS_MAX_OUTFMT - i;
! 	if (!freeslots)
! 		goto too_many_error_out;
  
! 	flags = 0;
  	if(sflags) do {
  		for (j = 0; flagstr[j] != NULL; j++)
***************
*** 219,223 ****
  		sflags+=strlen(flagstr[j]);
  	} while (*(sflags++) == ',');
-         
  
  	do {
--- 232,235 ----
***************
*** 231,238 ****
                  ++i;
  		sfmt+=strlen(fmtstr[j]);
! 	} while (*(sfmt++) == ',');
  	if (*(--sfmt) != '\0') return 0;
          
  	return 1;
  }
  
--- 243,257 ----
                  ++i;
  		sfmt+=strlen(fmtstr[j]);
! 	} while ((*(sfmt++) == ',') && --freeslots);
! 
! 	if (!freeslots)
! 		goto too_many_error_out;
! 
  	if (*(--sfmt) != '\0') return 0;
          
  	return 1;
+ too_many_error_out:
+ 	printf("\ntoo many out...\n");
+ 	return 0;
  }
  
***************
*** 264,277 ****
  }
  
  
! codecs_t *parse_codec_cfg(char *cfgfile)
  {
  
! //	codecs_t *codecs = NULL;  // array of codecs
! 	codecs_t *codec = NULL;   // currect codec
! 	int free_slots = 0;
  	int tmp, i;
  	int state = 0;
- 	char *param1;
  
  #ifdef DEBUG
--- 283,315 ----
  }
  
+ static int valid_codec(codecs_t *codec)
+ {
+ #warning FIXME mi is kell egy codec-be?
+ 	return 1;
+ }
  
! static int add_comment(char *s, char **d)
  {
+ 	int pos;
+ 
+ 	if (!*d)
+ 		pos = 0;
+ 	else {
+ 		pos = strlen(*d);
+ 		(*d)[pos++] = '\n';
+ 	}
+ 	if (!(*d = (char *) realloc(*d, pos + strlen(s) + 1))) {
+ 		printf("can't allocate mem for comment\n");
+ 		return 0;
+ 	}
+ 	strcpy(*d + pos, s);
+ 	return 1;
+ }
  
! codecs_t *parse_codec_cfg(char *cfgfile)
! {
! 	codecs_t *codec = NULL;   // current codec
  	int tmp, i;
  	int state = 0;
  
  #ifdef DEBUG
***************
*** 290,305 ****
  		return NULL;
  	}
- 	line_pos = 0;
- 	line[0] = '\0';		/* forces get_token to read next line */
  
! 	for (;;) {
! 		tmp = get_token();
! 		if (tmp == RET_EOF)
! 			goto eof_out;
  		if (tmp == RET_EOL)
  			continue;
! 		if (!strcmp(token, "audiocodec") || !strcmp(token, "videocodec")) {
! 			PRINT_LINENUM;
!                         
  		        if (!(codecs = (codecs_t *) realloc(codecs,
  				sizeof(codecs_t) * (nr_codecs + 1)))) {
--- 328,339 ----
  		return NULL;
  	}
  
! 	while ((tmp = get_token(1, 1)) != RET_EOF) {
  		if (tmp == RET_EOL)
  			continue;
! 		if (!strcmp(token[0], "audiocodec") || !strcmp(token[0], "videocodec")) {
! 			if (nr_codecs)
! 				if (!valid_codec(codec))
! 					goto not_valid_error_out;
  		        if (!(codecs = (codecs_t *) realloc(codecs,
  				sizeof(codecs_t) * (nr_codecs + 1)))) {
***************
*** 307,311 ****
  			    goto err_out;
  		        }
!                         codec=&codecs[nr_codecs];
  			nr_codecs++;
                          memset(codec,0,sizeof(codecs_t));
--- 341,345 ----
  			    goto err_out;
  		        }
! 			codec=&codecs[nr_codecs];
  			nr_codecs++;
                          memset(codec,0,sizeof(codecs_t));
***************
*** 314,322 ****
  			state = 0;
                          
! 			if (*token == 'a') {		/* audiocodec */
! 				//printf("audio");
  				codec->flags |= CODECS_FLAG_AUDIO;
! 			} else if (*token == 'v') {	/* videocodec */
! 				//printf("video");
  				codec->flags &= !CODECS_FLAG_AUDIO;
  			} else {
--- 348,354 ----
  			state = 0;
                          
! 			if (*token[0] == 'a') {		/* audiocodec */
  				codec->flags |= CODECS_FLAG_AUDIO;
! 			} else if (*token[0] == 'v') {	/* videocodec */
  				codec->flags &= !CODECS_FLAG_AUDIO;
  			} else {
***************
*** 324,461 ****
  				goto err_out;
  			}
! 			if (get_token() < 0)
  				goto parse_error_out;
! 			codec->name = strdup(token);
  			state |= GOT_NAME;
! 			//printf(" %s\n", codec->name);
! 		} else if (!strcmp(token, "info")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("info");
! 			if (state & GOT_INFO || get_token() < 0)
  				goto parse_error_out;
! 			codec->info = strdup(token);
  			state |= GOT_INFO;
! 			//printf(" %s\n", codec->info);
! 		} else if (!strcmp(token, "comment")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("comment");
! 			if (get_token() < 0)
! 				goto parse_error_out;
! #if 1
! 			if (!codec->comment)
! 				codec->comment = strdup(token);
! 			//printf(" %s\n", codec->comment);
! #else
! 			add_comment(token, &codec->comment);
! 			printf(" FIXMEEEEEEEEEEEEEEE\n");
! #endif
! 		} else if (!strcmp(token, "fourcc")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("fourcc");
! //			if (codec->flags & CODECS_FLAG_AUDIO) {
! //				printf("\n'fourcc' in audiocodec definition!\n");
! //				goto err_out;
! //			}
! 			if (get_token() < 0)
! 				goto parse_error_out;
! 			param1 = strdup(token);
! 			get_token();
! 			if (!add_to_fourcc(param1, token,
  						codec->fourcc,
  						codec->fourccmap))
! 				goto err_out;
  			state |= GOT_FOURCC;
! 			//printf(" %s: %s\n", param1, token);
! 			free(param1);
! 		} else if (!strcmp(token, "format")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("format");
! //			if (!(codec->flags & CODECS_FLAG_AUDIO)) {
! //				printf("\n'format' in videocodec definition!\n");
! //				goto err_out;
! //			}
! 			if (get_token() < 0)
  				goto parse_error_out;
! 			if (!add_to_format(token, codec->fourcc,codec->fourccmap))
! 				goto err_out;
  			state |= GOT_FORMAT;
! 			//printf(" %s\n", token);
! 		} else if (!strcmp(token, "driver")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("driver");
! 			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);
! 		} else if (!strcmp(token, "dll")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("dll");
! 			if (get_token() < 0)
! 				goto parse_error_out;
! 			codec->dll = strdup(token);
! 			//printf(" %s\n", codec->dll);
! 		} else if (!strcmp(token, "guid")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("guid");
! 			if (get_token() < 0) goto parse_error_out;
!                         //printf("'%s'",token);
!                         codec->guid.f1=strtoul(token,NULL,0);
! 			if (get_token() < 0) goto parse_error_out;
!                         codec->guid.f2=strtoul(token,NULL,0);
! 			if (get_token() < 0) goto parse_error_out;
!                         codec->guid.f3=strtoul(token,NULL,0);
  			for (i = 0; i < 8; i++) {
! 			    if (get_token() < 0) goto parse_error_out;
!                             codec->guid.f4[i]=strtoul(token,NULL,0);
  			}
! 		} else if (!strcmp(token, "out")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("out");
! 			if (get_token() < 0)
! 				goto parse_error_out;
! 			param1 = strdup(token);
! 			get_token();
! 			if (!add_to_out(param1, token, codec->outfmt,
  						codec->outflags))
  				goto err_out;
! 			//printf(" %s: %s\n", param1, token);
! 			free(param1);
! 		} else if (!strcmp(token, "flags")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			PRINT_LINENUM;
! 			//printf("flags");
! 			if (get_token() < 0)
  				goto parse_error_out;
! 			//printf(" %s\n", token);
! 		} else if (!strcmp(token, "status")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token() < 0)
  				goto parse_error_out;
! 			if (!strcasecmp(token, "rulz"))
  				codec->status = CODECS_STATUS_WORKING;
! 			else if (!strcasecmp(token, "suxx"))
  				codec->status = CODECS_STATUS_NOT_WORKING;
! 			else if (!strcasecmp(token, "checkthiz"))
  				codec->status = CODECS_STATUS_UNTESTED;
! 			else if (!strcasecmp(token, "notsogood"))
  				codec->status = CODECS_STATUS_PROBLEMS;
  			else
--- 356,458 ----
  				goto err_out;
  			}
! 			if (get_token(1, 1) < 0)
  				goto parse_error_out;
! 			for (i = 0; i < nr_codecs - 1; i++) {
! #warning audio meg videocodecnek lehet ugyanaz a neve?
! 				if ((codec->flags & CODECS_FLAG_AUDIO) !=
! 						(codecs[i].flags & CODECS_FLAG_AUDIO))
! 					continue;
! 				if (!strcmp(token[0], codecs[i].name)) {
! 					PRINT_LINENUM;
! 					printf("codec name '%s' isn't unique\n", token[0]);
! 					goto err_out;
! 				}
! 			}
! 			codec->name = strdup(token[0]);
  			state |= GOT_NAME;
! 		} else if (!strcmp(token[0], "info")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (state & GOT_INFO || get_token(1, 1) < 0)
  				goto parse_error_out;
! 			codec->info = strdup(token[0]);
  			state |= GOT_INFO;
! 		} else if (!strcmp(token[0], "comment")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token(1, 1) < 0)
! 				goto parse_error_out;
! 			if (!add_comment(token[0], &codec->comment)) {
! 				PRINT_LINENUM;
! 				printf("add_comment()-tel valami sux\n");
! 			}
! 		} else if (!strcmp(token[0], "fourcc")) {
  			if (!(state & GOT_NAME))
+ 				goto parse_error_out;
+ 			if (get_token(1, 2) < 0)
  				goto parse_error_out;
! 			if (!add_to_fourcc(token[0], token[1],
  						codec->fourcc,
  						codec->fourccmap))
! 				goto parse_error_out;
  			state |= GOT_FOURCC;
! 		} else if (!strcmp(token[0], "format")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token(1, 1) < 0)
  				goto parse_error_out;
! 			if (!add_to_format(token[0], codec->fourcc,codec->fourccmap))
! 				goto parse_error_out;
  			state |= GOT_FORMAT;
! 		} else if (!strcmp(token[0], "driver")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token(1, 1) < 0)
  				goto parse_error_out;
! 			if ((codec->driver = get_driver(token[0],codec->flags&CODECS_FLAG_AUDIO)) == -1)
  				goto err_out;
! 		} else if (!strcmp(token[0], "dll")) {
  			if (!(state & GOT_NAME))
+ 				goto parse_error_out;
+ 			if (get_token(1, 1) < 0)
  				goto parse_error_out;
! 			codec->dll = strdup(token[0]);
! 		} else if (!strcmp(token[0], "guid")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token(11, 11) < 0) goto parse_error_out;
!                         codec->guid.f1=strtoul(token[0],NULL,0);
!                         codec->guid.f2=strtoul(token[1],NULL,0);
!                         codec->guid.f3=strtoul(token[2],NULL,0);
  			for (i = 0; i < 8; i++) {
!                             codec->guid.f4[i]=strtoul(token[i + 3],NULL,0);
  			}
! 		} else if (!strcmp(token[0], "out")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token(1, 2) < 0)
! 				goto parse_error_out;
! 			if (!add_to_out(token[0], token[1], codec->outfmt,
  						codec->outflags))
  				goto err_out;
! 		} else if (!strcmp(token[0], "flags")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token(1, 1) < 0)
  				goto parse_error_out;
! #warning FIXME flags meg nincs implementalva...
! 			printf("\n\nUssetek!!!\n\n");
! 		} else if (!strcmp(token[0], "status")) {
  			if (!(state & GOT_NAME))
  				goto parse_error_out;
! 			if (get_token(1, 1) < 0)
  				goto parse_error_out;
! 			if (!strcasecmp(token[0], "rulz"))
  				codec->status = CODECS_STATUS_WORKING;
! 			else if (!strcasecmp(token[0], "suxx"))
  				codec->status = CODECS_STATUS_NOT_WORKING;
! 			else if (!strcasecmp(token[0], "checkthiz"))
  				codec->status = CODECS_STATUS_UNTESTED;
! 			else if (!strcasecmp(token[0], "notsogood"))
  				codec->status = CODECS_STATUS_PROBLEMS;
  			else
***************
*** 464,467 ****
--- 461,466 ----
  			goto parse_error_out;
  	}
+ 	if (!valid_codec(codec))
+ 		goto not_valid_error_out;
  out:
  	free(line);
***************
*** 476,483 ****
  		free(codecs);
  	codecs = NULL;
- 	goto out;
- eof_out:
- 	/* FIXME teljes az utolso config?? */
  	goto out;
  }
  
--- 475,483 ----
  		free(codecs);
  	codecs = NULL;
  	goto out;
+ not_valid_error_out:
+ 	PRINT_LINENUM;
+ 	printf("codec is not definied correctly\n");
+ 	goto err_out;
  }
  
***************
*** 505,509 ****
          int i,j;
  
! 	codecs = parse_codec_cfg("DOCS/codecs.conf");
          
          printf("total %d codecs parsed\n",nr_codecs);
--- 505,510 ----
          int i,j;
  
! 	if (!(codecs = parse_codec_cfg("DOCS/codecs.conf")))
! 		return 0;
          
          printf("total %d codecs parsed\n",nr_codecs);
***************
*** 529,533 ****
              }
  
!             printf("GUID: %08X %04X %04X",c->guid.f1,c->guid.f2,c->guid.f3);
              for(j=0;j<8;j++) printf(" %02X",c->guid.f4[j]);
              printf("\n");
--- 530,534 ----
              }
  
!             printf("GUID: %08lX %04X %04X",c->guid.f1,c->guid.f2,c->guid.f3);
              for(j=0;j<8;j++) printf(" %02X",c->guid.f4[j]);
              printf("\n");

Index: codec-cfg.h
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** codec-cfg.h	2001/04/08 23:42:25	1.5
--- codec-cfg.h	2001/04/09 20:21:07	1.6
***************
*** 2,7 ****
  #define __CODEC_CFG_H
  
- //#include <inttypes.h>
- 
  #ifndef IMGFMT_YV12
  #define IMGFMT_YV12 0x32315659
--- 2,5 ----
***************
*** 31,35 ****
  
  
- //#warning nem kellene ket typedef GUID-nak...
  typedef struct {
  	unsigned long f1;
--- 29,32 ----
***************
*** 39,43 ****
  } GUID;
  
- /* I just rearranged, to use less memory... */
  typedef struct {
  	unsigned int fourcc[CODECS_MAX_FOURCC];
--- 36,39 ----


_______________________________________________
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