# HG changeset patch # User ranma # Date 1120332915 0 # Node ID 451c9ca8fd47b210fef6a6539f6ffcfa9ad48209 # Parent 7b06396ac8b3359e34a6798dce49c56b4f25f940 Only dump to stdout diff -r 7b06396ac8b3 -r 451c9ca8fd47 TOOLS/avisubdump.c --- a/TOOLS/avisubdump.c Sat Jul 02 19:19:41 2005 +0000 +++ b/TOOLS/avisubdump.c Sat Jul 02 19:35:15 2005 +0000 @@ -4,7 +4,7 @@ * avi vobsub subtitle stream dumper (c) 2004 Tobias Diedrich * Licensed under GNU GPLv2 or (at your option) any later version. * - * Compile with "make avisubdump" + * The subtitles are dumped to stdout. */ #define _LARGEFILE_SOURCE @@ -30,8 +30,6 @@ #define GAB_ENTRY_UNICODE 3 #define GAB_RAWTEXTSUBTITLE 4 -static char *subfile; - static unsigned int getle16(FILE* f){ unsigned int res; @@ -83,7 +81,7 @@ while (ret + 6 <= size) { unsigned int len, id; char *buf; - int i, fd; + int i; id = getle16(f); ret += 2; len = getle(f); ret += 4; @@ -93,22 +91,18 @@ ret += fread(buf, 1, len, f); switch (id) { - case GAB_LANGUAGE_UNICODE: + case GAB_LANGUAGE_UNICODE: /* FIXME: convert to utf-8; endianness */ for (i=0; i\n", argv[0]); exit(1); } - f=fopen(argv[argc-1],"rb"); + if (strcmp(argv[argc-1], "-") == 0) f=stdin; + else f=fopen(argv[argc-1],"rb"); if (!f) { fprintf(stderr, "Could not open '%s': %s\n", @@ -184,16 +178,8 @@ exit(-errno); } - subfile = malloc(strlen(argv[1]) + 4); - strcpy(subfile, argv[1]); - for (i=strlen(subfile); i>0 && subfile[i] != '.'; i--); - subfile[i] = 0; - strcat(subfile, ".ssa"); - dump(f); - free(subfile); - return 0; }