[Mplayer-cvslog] CVS: main codec-cfg.c,1.83,1.84 codec-cfg.h,1.54,1.55

Arpi of Ize arpi at mplayerhq.hu
Mon May 27 00:40:09 CEST 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv17787

Modified Files:
	codec-cfg.c codec-cfg.h 
Log Message:
codecs.conf versioning - patch by Joey Parrish <joey at yunamusic.com>


Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- codec-cfg.c	16 May 2002 21:50:38 -0000	1.83
+++ codec-cfg.c	26 May 2002 22:39:26 -0000	1.84
@@ -368,10 +368,10 @@
 static int line_num = 0;
 static char *line;
 static char *token[MAX_NR_TOKEN];
+static int read_nextline = 1;
 
 static int get_token(int min, int max)
 {
-	static int read_nextline = 1;
 	static int line_pos;
 	int i;
 	char c;
@@ -466,15 +466,33 @@
 		mp_msg(MSGT_CODECCFG,MSGL_FATAL,"can't get memory for 'line': %s\n", strerror(errno));
 		return 0;
 	}
+	read_nextline = 1;
 
 	/*
-	 * check if the cfgfile starts with 'audiocodec' or
-	 * with 'videocodec'
+	 * this only catches release lines at the start of 
+	 * codecs.conf, before audiocodecs and videocodecs.
 	 */
 	while ((tmp = get_token(1, 1)) == RET_EOL)
 		/* NOTHING */;
 	if (tmp == RET_EOF)
 		goto out;
+	if (!strcmp(token[0], "release")) {
+		if (get_token(1, 2) < 0)
+			goto err_out_parse_error;
+		tmp = atoi(token[0]);
+		if (tmp < CODEC_CFG_MIN)
+			goto err_out_release_num;
+		while ((tmp = get_token(1, 1)) == RET_EOL)
+			/* NOTHING */;
+		if (tmp == RET_EOF)
+			goto out;
+	} else
+		goto err_out_release_num;
+
+	/*
+	 * check if the next block starts with 'audiocodec' or
+	 * with 'videocodec'
+	 */
 	if (!strcmp(token[0], "audiocodec") || !strcmp(token[0], "videocodec"))
 		goto loop_enter;
 	goto err_out_parse_error;
@@ -652,10 +670,14 @@
 
 	free(line);
 	line=NULL;
+	line_num = 0;
 	fclose(fp);
 	return 0;
 err_out_not_valid:
 	mp_msg(MSGT_CODECCFG,MSGL_ERR,"codec is not defined correctly");
+	goto err_out_print_linenum;
+err_out_release_num:
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"this codecs.conf is too old, incompatible with this mplayer release!");
 	goto err_out_print_linenum;
 }
 

Index: codec-cfg.h
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- codec-cfg.h	16 May 2002 21:50:38 -0000	1.54
+++ codec-cfg.h	26 May 2002 22:39:26 -0000	1.55
@@ -1,6 +1,8 @@
 #ifndef __CODEC_CFG_H
 #define __CODEC_CFG_H
 
+#define CODEC_CFG_MIN	20020520
+
 #define CODECS_MAX_FOURCC	32
 #define CODECS_MAX_OUTFMT	16
 #define CODECS_MAX_INFMT	16




More information about the MPlayer-cvslog mailing list