changeset 299:3343fb3e4f49

outflags[] reading fixed
author arpi_esp
date Fri, 06 Apr 2001 23:56:42 +0000
parents a11ea84cc1ad
children df3f7a25584c
files codec-cfg.c codec-cfg.h
diffstat 2 files changed, 43 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Fri Apr 06 23:28:18 2001 +0000
+++ b/codec-cfg.c	Fri Apr 06 23:56:42 2001 +0000
@@ -138,12 +138,24 @@
 	return 1;
 }
 
+/*
 short get_flags(char *s)
 {
+	static char *flagstr[] = {
+		"flip",
+		"noflip",
+		"yuvhack",
+		NULL
+	};
+        int j;
+
+        printf("flags='%s'\n",s);
+
 	if (!s)
 		return 0;
 	return 1;
 }
+*/
 
 int add_to_out(char *sfmt, char *sflags, unsigned int *outfmt,
 		unsigned char *outflags)
@@ -177,6 +189,13 @@
 		IMGFMT_BGR|24,
 		IMGFMT_BGR|32
 	};
+	static char *flagstr[] = {
+		"flip",
+		"noflip",
+		"yuvhack",
+		NULL
+	};
+
 	int i, j;
 	unsigned char flags;
 
@@ -187,20 +206,30 @@
 		return 0;
 	}
 
-	flags = get_flags(sflags);
+	flags = 0; //get_flags(sflags);
+	if(sflags) do {
+		for (j = 0; flagstr[j] != NULL; j++)
+			if (!strncmp(sflags, flagstr[j], strlen(flagstr[j])))
+				break;
+		if (flagstr[j] == NULL) return 0; // error!
+		flags|=(1<<j);
+		sflags+=strlen(flagstr[j]);
+	} while (*(sflags++) == ',');
+        
 
 	do {
-		for (j = 0; fmtstr[i] != NULL; j++)
+		for (j = 0; fmtstr[j] != NULL; j++)
 			if (!strncmp(sfmt, fmtstr[j], strlen(fmtstr[j])))
 				break;
 		if (fmtstr[j] == NULL)
 			return 0;
 		outfmt[i] = fmtnum[j];
 		outflags[i] = flags;
+                ++i;
 		sfmt+=strlen(fmtstr[j]);
 	} while (*(sfmt++) == ',');
-	if (*(--sfmt) != '\0')
-		return 0;
+	if (*(--sfmt) != '\0') return 0;
+        
 	return 1;
 }
 
@@ -460,6 +489,11 @@
                   printf("fourcc %02d:  %08X (%.4s) ===> %08X (%.4s)\n",j,c->fourcc[j],&c->fourcc[j],c->fourccmap[j],&c->fourccmap[j]);
               }
             }
+            for(j=0;j<CODECS_MAX_OUTFMT;j++){
+              if(c->outfmt[j]!=0xFFFFFFFF){
+                  printf("outfmt %02d:  %08X (%.4s)  flags: %d\n",j,c->outfmt[j],&c->outfmt[j],c->outflags[j]);
+              }
+            }
         }
         
 	return 0;
--- a/codec-cfg.h	Fri Apr 06 23:28:18 2001 +0000
+++ b/codec-cfg.h	Fri Apr 06 23:56:42 2001 +0000
@@ -17,6 +17,11 @@
 
 #define CODECS_FLAG_AUDIO	(1<<0)
 
+#define CODECS_FLAG_FLIP	(1<<0)
+#define CODECS_FLAG_NOFLIP	(1<<1)
+#define CODECS_FLAG_YUVHACK	(1<<2)
+
+
 #warning nem kellene ket typedef GUID-nak...
 typedef struct {
 	long f1;