[Mplayer-cvslog] CVS: main codec-cfg.c,1.3,1.4 codec-cfg.h,1.2,1.3
GEREOFFY
arpi_esp at users.sourceforge.net
Sat Apr 7 02:51:41 CEST 2001
Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv14722
Modified Files:
codec-cfg.c codec-cfg.h
Log Message:
audio format support, realloc() cleanup
Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** codec-cfg.c 2001/04/06 23:56:42 1.3
--- codec-cfg.c 2001/04/07 00:51:38 1.4
***************
*** 134,161 ****
}
! int add_to_format(char *s, unsigned int *format)
{
! 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)
--- 134,157 ----
}
! 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 */
! for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++)
! /* NOTHING */;
! if (i == CODECS_MAX_FOURCC) {
! printf("too many fourcc...\n");
return 0;
+ }
+
+ fourcc[i]=fourccmap[i]=strtoul(s,NULL,0);
+
return 1;
}
+
int add_to_out(char *sfmt, char *sflags, unsigned int *outfmt,
unsigned char *outflags)
***************
*** 253,257 ****
} while (0)
! codecs_t *codecs = NULL;
int free_slots = 0;
int tmp, i;
--- 249,254 ----
} while (0)
! codecs_t *codecs = NULL; // array of codecs
! codecs_t *codec = NULL; // currect codec
int free_slots = 0;
int tmp, i;
***************
*** 285,313 ****
continue;
if (!strcmp(token, "audiocodec") || !strcmp(token, "videocodec")) {
- if (codecs) {
- // tmp = ~state & STATE_MASK;
- // if (tmp != GOT_FOURCC && tmp != GOT_FORMAT)
- // goto parse_error_out;
- nr_codecs++;
- }
PRINT_LINENUM;
! GET_MEM;
state = 0;
! codecs[nr_codecs].comment = NULL;
! memset(codecs[nr_codecs].fourcc, 0xff,
! sizeof(codecs[nr_codecs].fourcc) );
! /*
! memset(codecs[nr_codecs].fourccmap, 0xff,
! sizeof(codecs[nr_codecs].fourccmap) *
! CODECS_MAX_FOURCC);
! */
! memset(codecs[nr_codecs].outfmt, 0xff,
! sizeof(codecs[nr_codecs].outfmt) );
if (*token == 'a') { /* audiocodec */
printf("audio");
! codecs[nr_codecs].flags |= CODECS_FLAG_AUDIO;
} else if (*token == 'v') { /* videocodec */
printf("video");
! codecs[nr_codecs].flags &= !CODECS_FLAG_AUDIO;
} else {
printf("itt valami nagyon el van baszva\n");
--- 282,305 ----
continue;
if (!strcmp(token, "audiocodec") || !strcmp(token, "videocodec")) {
PRINT_LINENUM;
!
! if (!(codecs = (codecs_t *) realloc(codecs,
! sizeof(codecs_t) * (nr_codecs + 1)))) {
! perror("parse_codec_cfg: can't realloc 'codecs'");
! goto err_out;
! }
! codec=&codecs[nr_codecs];
! nr_codecs++;
! memset(codec,0,sizeof(codecs_t));
! memset(codec->fourcc, 0xff, sizeof(codec->fourcc));
! memset(codec->outfmt, 0xff, sizeof(codec->outfmt));
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 {
printf("itt valami nagyon el van baszva\n");
***************
*** 316,322 ****
if (get_token() < 0)
goto parse_error_out;
! codecs[nr_codecs].name = strdup(token);
state |= GOT_NAME;
! printf(" %s\n", codecs[nr_codecs].name);
} else if (!strcmp(token, "info")) {
if (!(state & GOT_NAME))
--- 308,314 ----
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))
***************
*** 326,332 ****
if (state & GOT_INFO || get_token() < 0)
goto parse_error_out;
! codecs[nr_codecs].info = strdup(token);
state |= GOT_INFO;
! printf(" %s\n", codecs[nr_codecs].info);
} else if (!strcmp(token, "comment")) {
if (!(state & GOT_NAME))
--- 318,324 ----
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))
***************
*** 337,345 ****
goto parse_error_out;
#if 1
! if (!codecs[nr_codecs].comment)
! codecs[nr_codecs].comment = strdup(token);
! printf(" %s\n", codecs[nr_codecs].comment);
#else
! add_comment(token, &codecs[nr_codecs].comment);
printf(" FIXMEEEEEEEEEEEEEEE\n");
#endif
--- 329,337 ----
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
***************
*** 349,353 ****
PRINT_LINENUM;
printf("fourcc");
! if (codecs[nr_codecs].flags & CODECS_FLAG_AUDIO) {
printf("\n'fourcc' in audiocodec definition!\n");
goto err_out;
--- 341,345 ----
PRINT_LINENUM;
printf("fourcc");
! if (codec->flags & CODECS_FLAG_AUDIO) {
printf("\n'fourcc' in audiocodec definition!\n");
goto err_out;
***************
*** 358,363 ****
get_token();
if (!add_to_fourcc(param1, token,
! codecs[nr_codecs].fourcc,
! codecs[nr_codecs].fourccmap))
goto err_out;
state |= GOT_FOURCC;
--- 350,355 ----
get_token();
if (!add_to_fourcc(param1, token,
! codec->fourcc,
! codec->fourccmap))
goto err_out;
state |= GOT_FOURCC;
***************
*** 369,373 ****
PRINT_LINENUM;
printf("format");
! if (!(codecs[nr_codecs].flags & CODECS_FLAG_AUDIO)) {
printf("\n'format' in videocodec definition!\n");
goto err_out;
--- 361,365 ----
PRINT_LINENUM;
printf("format");
! if (!(codec->flags & CODECS_FLAG_AUDIO)) {
printf("\n'format' in videocodec definition!\n");
goto err_out;
***************
*** 375,379 ****
if (get_token() < 0)
goto parse_error_out;
! if (!add_to_format(token, codecs[nr_codecs].fourcc))
goto err_out;
state |= GOT_FORMAT;
--- 367,371 ----
if (get_token() < 0)
goto parse_error_out;
! if (!add_to_format(token, codec->fourcc,codec->fourccmap))
goto err_out;
state |= GOT_FORMAT;
***************
*** 386,390 ****
if (get_token() < 0)
goto parse_error_out;
! if ((codecs[nr_codecs].driver = get_driver(token)) == -1)
goto err_out;
printf(" %s\n", token);
--- 378,382 ----
if (get_token() < 0)
goto parse_error_out;
! if ((codec->driver = get_driver(token)) == -1)
goto err_out;
printf(" %s\n", token);
***************
*** 396,401 ****
if (get_token() < 0)
goto parse_error_out;
! codecs[nr_codecs].dll = strdup(token);
! printf(" %s\n", codecs[nr_codecs].dll);
} else if (!strcmp(token, "guid")) {
if (!(state & GOT_NAME))
--- 388,393 ----
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))
***************
*** 403,428 ****
PRINT_LINENUM;
printf("guid");
! if (get_token() < 0)
! goto parse_error_out;
! sscanf(token, "%ld,", &codecs[nr_codecs].guid.f1);
! if (get_token() < 0)
! goto parse_error_out;
! sscanf(token, "%d,", &tmp);
! codecs[nr_codecs].guid.f2 = tmp;
! if (get_token() < 0)
! goto parse_error_out;
! sscanf(token, "%d,", &tmp);
! codecs[nr_codecs].guid.f3 = tmp;
! for (i = 0; i < 7; i++) {
! if (get_token() < 0)
! goto parse_error_out;
! sscanf(token, "%d,", &tmp);
! codecs[nr_codecs].guid.f4[i] = tmp;
}
- if (get_token() < 0)
- goto parse_error_out;
- sscanf(token, "%d", &tmp);
- codecs[nr_codecs].guid.f4[7] = tmp;
- printf(" %s\n", token);
} else if (!strcmp(token, "out")) {
if (!(state & GOT_NAME))
--- 395,409 ----
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))
***************
*** 434,439 ****
param1 = strdup(token);
get_token();
! if (!add_to_out(param1, token, codecs[nr_codecs].outfmt,
! codecs[nr_codecs].outflags))
goto err_out;
printf(" %s: %s\n", param1, token);
--- 415,420 ----
param1 = strdup(token);
get_token();
! if (!add_to_out(param1, token, codec->outfmt,
! codec->outflags))
goto err_out;
printf(" %s: %s\n", param1, token);
***************
*** 485,488 ****
--- 466,470 ----
printf("dll='%s'\n",c->dll);
printf("flags=%X driver=%d\n",c->flags,c->driver);
+
for(j=0;j<CODECS_MAX_FOURCC;j++){
if(c->fourcc[j]!=0xFFFFFFFF){
***************
*** 490,493 ****
--- 472,476 ----
}
}
+
for(j=0;j<CODECS_MAX_OUTFMT;j++){
if(c->outfmt[j]!=0xFFFFFFFF){
***************
*** 495,498 ****
--- 478,487 ----
}
}
+
+ 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");
+
+
}
Index: codec-cfg.h
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** codec-cfg.h 2001/04/06 23:56:42 1.2
--- codec-cfg.h 2001/04/07 00:51:38 1.3
***************
*** 25,32 ****
#warning nem kellene ket typedef GUID-nak...
typedef struct {
! long f1;
! short f2;
! short f3;
! char f4[8];
} GUID;
--- 25,32 ----
#warning nem kellene ket typedef GUID-nak...
typedef struct {
! unsigned long f1;
! unsigned short f2;
! unsigned short f3;
! unsigned char f4[8];
} GUID;
_______________________________________________
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