comparison codec-cfg.c @ 3408:725b3de963eb

enabled validate_codec with some restrictions
author alex
date Sun, 09 Dec 2001 18:25:09 +0000
parents c91d9c4512c5
children fb9fd7e2dd35
comparison
equal deleted inserted replaced
3407:b33d04167063 3408:725b3de963eb
241 return -1; 241 return -1;
242 } 242 }
243 243
244 static int validate_codec(codecs_t *c, int type) 244 static int validate_codec(codecs_t *c, int type)
245 { 245 {
246 int i;
247 char *tmp_name = strdup(c->name);
248
249 for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++)
250 /* NOTHING */;
251
252 if (i < strlen(tmp_name)) {
253 printf("\ncodec(%s) name is not valid!\n", c->name);
254 return 0;
255 }
256
257 if (!c->info)
258 c->info = strdup(c->name);
259
246 #if 0 260 #if 0
247 int i;
248
249 for (i = 0; i < strlen(c->name) && isalnum(c->name[i]); i++)
250 /* NOTHING */;
251 if (i < strlen(c->name)) {
252 printf("\ncodec(%s)->name is not valid!\n", c->name);
253 return 0;
254 }
255 #warning codec->info = codec->name; ez ok, vagy strdup()?
256 if (!c->info)
257 c->info = c->name;
258 if (c->fourcc[0] == 0xffffffff) { 261 if (c->fourcc[0] == 0xffffffff) {
259 printf("\ncodec(%s) does not have fourcc/format!\n", c->name); 262 printf("\ncodec(%s) does not have fourcc/format!\n", c->name);
260 return 0; 263 return 0;
261 } 264 }
265
266 /* XXX fix this: shitty with 'null' codec */
262 if (!c->driver) { 267 if (!c->driver) {
263 printf("\ncodec(%s) does not have a driver!\n", c->name); 268 printf("\ncodec(%s) does not have a driver!\n", c->name);
264 return 0; 269 return 0;
265 } 270 }
271 #endif
272
273 #if 0
266 #warning codec->driver == 4;... <- ezt nem kellene belehegeszteni... 274 #warning codec->driver == 4;... <- ezt nem kellene belehegeszteni...
267 #warning HOL VANNAK DEFINIALVA???????????? 275 #warning HOL VANNAK DEFINIALVA????????????
268 if (!c->dll && (c->driver == 4 || 276 if (!c->dll && (c->driver == 4 ||
269 (c->driver == 2 && type == TYPE_VIDEO))) { 277 (c->driver == 2 && type == TYPE_VIDEO))) {
270 printf("\ncodec(%s) needs a 'dll'!\n", c->name); 278 printf("\ncodec(%s) needs a 'dll'!\n", c->name);
593 free(video_codecs); 601 free(video_codecs);
594 free(line); 602 free(line);
595 free(fp); 603 free(fp);
596 return NULL; 604 return NULL;
597 err_out_not_valid: 605 err_out_not_valid:
598 printf("codec is not definied correctly"); 606 printf("codec is not defined correctly");
599 goto err_out_print_linenum; 607 goto err_out_print_linenum;
600 } 608 }
601 609
602 codecs_t *find_audio_codec(unsigned int fourcc, unsigned int *fourccmap, 610 codecs_t *find_audio_codec(unsigned int fourcc, unsigned int *fourccmap,
603 codecs_t *start) 611 codecs_t *start)