[Mplayer-cvslog] CVS: main codec-cfg.c,1.95,1.96

Arpi of Ize arpi at mplayerhq.hu
Thu Oct 17 02:20:47 CEST 2002


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

Modified Files:
	codec-cfg.c 
Log Message:
- rgb1, rgb4 support
- format mapping support
- memleak fix


Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- codec-cfg.c	26 Sep 2002 01:28:32 -0000	1.95
+++ codec-cfg.c	17 Oct 2002 00:20:44 -0000	1.96
@@ -74,7 +74,7 @@
 		goto err_out_parse_error;
 	return 1;
 err_out_duplicated:
-	mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated fourcc/format");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated fourcc");
 	return 0;
 err_out_too_many:
 	mp_msg(MSGT_CODECCFG,MSGL_ERR,"too many fourcc/format...");
@@ -84,7 +84,7 @@
 	return 0;
 }
 
-static int add_to_format(char *s, unsigned int *fourcc, unsigned int *fourccmap)
+static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int *fourccmap)
 {
 	int i, j;
 	char *endptr;
@@ -97,14 +97,24 @@
 		return 0;
 	}
 
-        fourcc[i]=fourccmap[i]=strtoul(s,&endptr,0);
+        fourcc[i]=strtoul(s,&endptr,0);
 	if (*endptr != '\0') {
-		mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error (format ID not number?)");
 		return 0;
 	}
+
+	if(alias){
+	    fourccmap[i]=strtoul(alias,&endptr,0);
+	    if (*endptr != '\0') {
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error (format ID alias not number?)");
+		return 0;
+	    }
+	} else
+	    fourccmap[i]=fourcc[i];
+
 	for (j = 0; j < i; j++)
 		if (fourcc[j] == fourcc[i]) {
-			mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated fourcc/format");
+			mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated format ID");
 			return 0;
 		}
 
@@ -128,16 +138,20 @@
 		{"UYVY",  IMGFMT_UYVY},
 		{"YVYU",  IMGFMT_YVYU},
 
+	        {"RGB4",  IMGFMT_RGB|4},
 	        {"RGB8",  IMGFMT_RGB|8},
 		{"RGB15", IMGFMT_RGB|15}, 
 		{"RGB16", IMGFMT_RGB|16},
 		{"RGB24", IMGFMT_RGB|24},
 		{"RGB32", IMGFMT_RGB|32},
+		{"BGR4",  IMGFMT_BGR|4},
 		{"BGR8",  IMGFMT_BGR|8},
 		{"BGR15", IMGFMT_BGR|15},
 		{"BGR16", IMGFMT_BGR|16},
 		{"BGR24", IMGFMT_BGR|24},
 		{"BGR32", IMGFMT_BGR|32},
+	        {"RGB1",  IMGFMT_RGB|1},
+		{"BGR1",  IMGFMT_BGR|1},
 
 		{"MPES",  IMGFMT_MPEGPES},
 		{NULL,    0}
@@ -284,7 +298,7 @@
 static int validate_codec(codecs_t *c, int type)
 {
 	unsigned int i;
-	char *tmp_name = strdup(c->name);
+	char *tmp_name = c->name;
 
 	for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++)
 		/* NOTHING */;
@@ -576,9 +590,10 @@
 						codec->fourccmap))
 				goto err_out_print_linenum;
 		} else if (!strcmp(token[0], "format")) {
-			if (get_token(1, 1) < 0)
+			if (get_token(1, 2) < 0)
 				goto err_out_parse_error;
-			if (!add_to_format(token[0], codec->fourcc,codec->fourccmap))
+			if (!add_to_format(token[0], token[1],
+					codec->fourcc,codec->fourccmap))
 				goto err_out_print_linenum;
 		} else if (!strcmp(token[0], "driver")) {
 			if (get_token(1, 1) < 0)




More information about the MPlayer-cvslog mailing list