From ed3073c074a4183954b5fbd9ccec02b4f65ec1a2 Mon Sep 17 00:00:00 2001 From: ranma Date: Sat, 2 Jul 2005 19:35:15 +0000 Subject: Only dump to stdout git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15892 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/avisubdump.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'TOOLS') diff --git a/TOOLS/avisubdump.c b/TOOLS/avisubdump.c index 77f914cceb..9cc6d976eb 100644 --- a/TOOLS/avisubdump.c +++ b/TOOLS/avisubdump.c @@ -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 @@ static int dumpsub_gab2(FILE *f, int size) { 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 @@ static int dumpsub_gab2(FILE *f, int size) { 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 @@ int main(int argc,char* argv[]) 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; } -- cgit v1.2.3