kopia lustrzana https://github.com/F5OEO/tstools
Amendments suggested by alexw, to whom thanks:
1. Fix some print_msg to be print_err 2. Rename the function to make error messages go to stderr to redirect_output_stderr, which is more sensible. 3. Make the -stdout switch always force error messages to stderr 4. Add the "-err" switch to all programs, which allows the user to choose whether they prefer errors to go to stdout or stderr That last is something I meant to do as part of the stdout/stderr changes - thanks again to alexw for causing me to get round to it. This now allows: cat data/ed24p_11.ts | ts2ps -stdin -stdout | ps2ts -stdin -stdout | mplayer - to work -- it didn't before. --HG-- extra : convert_revision : svn%3Aeff31bef-be4a-0410-a8fe-e47997df2690/trunk%40145issue20
rodzic
9e6331dba8
commit
32fec829b2
21
es2ts.c
21
es2ts.c
|
@ -159,9 +159,11 @@ static void print_usage()
|
|||
" -verbose, -v Output summary information about each ES packet\n"
|
||||
" as it is read\n"
|
||||
" -quiet, -q Only output error messages\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Take input from <stdin>, instead of a named file\n"
|
||||
" -stdout Write output to <stdout>, instead of a named file\n"
|
||||
" Forces -quiet.\n"
|
||||
" Forces -quiet and -err stderr.\n"
|
||||
" -host <host>, -host <host>:<port>\n"
|
||||
" Writes output (over TCP/IP) to the named <host>,\n"
|
||||
" instead of to a named file. If <port> is not\n"
|
||||
|
@ -254,6 +256,23 @@ int main(int argc, char **argv)
|
|||
{
|
||||
had_output_name = TRUE; // more or less
|
||||
use_stdout = TRUE;
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("es2ts",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### es2ts: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-host",argv[ii]))
|
||||
{
|
||||
|
|
18
esdots.c
18
esdots.c
|
@ -688,6 +688,8 @@ static void print_usage()
|
|||
"Switches:\n"
|
||||
" -verbose, -v Preface the output with an explanation of the\n"
|
||||
" characters being used.\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Take input from <stdin>, instead of a named file\n"
|
||||
" -max <n>, -m <n> Maximum number of entities to read\n"
|
||||
" -pes, -ts The input file is TS or PS, to be read via the\n"
|
||||
|
@ -757,6 +759,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("esdots",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### esdots: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-stdin",argv[ii]))
|
||||
{
|
||||
had_input_name = TRUE; // more or less
|
||||
|
|
21
esfilter.c
21
esfilter.c
|
@ -802,9 +802,11 @@ static void print_usage()
|
|||
"Switches:\n"
|
||||
" -verbose, -v Output extra (debugging) messages\n"
|
||||
" -quiet, -q Only output error messages\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Take input from <stdin>, instead of a named file\n"
|
||||
" -stdout Write output to <stdout>, instead of a named file\n"
|
||||
" Forces -quiet.\n"
|
||||
" Forces -quiet and -err stderr.\n"
|
||||
" -host <host>, -host <host>:<port>\n"
|
||||
" Writes output (over TCP/IP) to the named <host>,\n"
|
||||
" instead of to a named file. If <port> is not\n"
|
||||
|
@ -922,6 +924,23 @@ int main(int argc, char **argv)
|
|||
{
|
||||
had_output_name = TRUE; // more or less
|
||||
use_stdout = TRUE;
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("esfilter",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### esfilter: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-host",argv[ii]))
|
||||
{
|
||||
|
|
18
esmerge.c
18
esmerge.c
|
@ -602,6 +602,8 @@ static void print_usage()
|
|||
" <output-file> is the resultant TS file.\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -quiet, -q Only output error messages.\n"
|
||||
" -verbose, -v Output information about each audio/video frame.\n"
|
||||
" -x Output diagnostic information.\n"
|
||||
|
@ -679,6 +681,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("esmerge",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### esmerge: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-verbose",argv[ii]) || !strcmp("-v",argv[ii]))
|
||||
{
|
||||
verbose = TRUE;
|
||||
|
|
18
esreport.c
18
esreport.c
|
@ -997,6 +997,8 @@ static void print_usage()
|
|||
" (in fact, both of these imply -frame).\n"
|
||||
"\n"
|
||||
"Other switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -verbose, -v For H.262 data, output information about the data\n"
|
||||
" in each MPEG-2 item. For ES units, output information\n"
|
||||
" about the data in each ES unit. Ignored for H.264 data.\n"
|
||||
|
@ -1071,6 +1073,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("esreport",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### esreport: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-avc",argv[ii]) || !strcmp("-h264",argv[ii]))
|
||||
{
|
||||
force_stream_type = TRUE;
|
||||
|
|
21
esreverse.c
21
esreverse.c
|
@ -404,9 +404,11 @@ static void print_usage()
|
|||
"\n"
|
||||
"Switches:\n"
|
||||
" -verbose, -v Output additional (debugging) messages\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -quiet, -q Only output error messages\n"
|
||||
" -stdout Write output to <stdout>, instead of a named file\n"
|
||||
" Forces -quiet.\n"
|
||||
" Forces -quiet and -err stderr.\n"
|
||||
" -host <host>, -host <host>:<port>\n"
|
||||
" Writes output (over TCP/IP) to the named <host>,\n"
|
||||
" instead of to a named file. If <port> is not\n"
|
||||
|
@ -509,6 +511,23 @@ int main(int argc, char **argv)
|
|||
{
|
||||
had_output_name = TRUE; // more or less
|
||||
use_stdout = TRUE;
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("esreverse",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### esreverse: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-host",argv[ii]))
|
||||
{
|
||||
|
|
20
m2ts2ts.c
20
m2ts2ts.c
|
@ -286,8 +286,11 @@ static void print_usage(void)
|
|||
" <outfile> is an H.222 Transport Stream file (but see -stdout)\n"
|
||||
"\n"
|
||||
"General Switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Input from standard input instead of a file\n"
|
||||
" -stdout Output to standard output instead of a file\n"
|
||||
" Forces -quiet and -err stderr.\n"
|
||||
" -verbose, -v Output informational/diagnostic messages\n"
|
||||
" -quiet, -q Only output error messages\n"
|
||||
" -buffer <n>, -b <n> Number of TS packets to buffer for reordering\n"
|
||||
|
@ -358,6 +361,23 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
use_stdout = TRUE;
|
||||
had_output_name = TRUE; // ish
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("m2ts2ts",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### m2ts2ts: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
19
pcapreport.c
19
pcapreport.c
|
@ -361,6 +361,9 @@ static void print_usage()
|
|||
" -skew-discontinuity-threshold <number>\n"
|
||||
" -skew <number> Gives the skew discontinuity threshold in 90kHz units.\n"
|
||||
"\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
"\n"
|
||||
" Specifying 0.0.0.0 for destination IP will capture all hosts, specifying 0 destination\n"
|
||||
" port will capture all ports on the destination host.\n"
|
||||
"\n"
|
||||
|
@ -396,6 +399,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("pcapreport",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### pcapreport: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("--output", argv[ii]) ||
|
||||
!strcmp("-output", argv[ii]) || !strcmp("-o", argv[ii]))
|
||||
{
|
||||
|
|
20
pes.c
20
pes.c
|
@ -1037,16 +1037,20 @@ static int determine_TS_program_info(PES_reader_p reader)
|
|||
print_err("### Error finding TS program information\n");
|
||||
return 1;
|
||||
}
|
||||
err = seek_using_TS_reader(reader->tsreader,0);
|
||||
if (err)
|
||||
// It's only possible to rewind if we're not reading from standard
|
||||
// input. If it's not feasible, don't try.
|
||||
if (reader->tsreader->file != STDIN_FILENO)
|
||||
{
|
||||
print_err("### Error rewinding TS stream after finding initial"
|
||||
" program information\n");
|
||||
return 1;
|
||||
if (err)
|
||||
{
|
||||
print_err("### Error rewinding TS stream after finding initial"
|
||||
" program information\n");
|
||||
return 1;
|
||||
}
|
||||
// Having rewound, we mustn't forget to reset our notion of the TS packet
|
||||
// position
|
||||
reader->posn = 0;
|
||||
}
|
||||
// Having rewound, we mustn't forget to reset our notion of the TS packet
|
||||
// position
|
||||
reader->posn = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ extern void flush_msg(void)
|
|||
* to go to stdout. This is the "traditional" mechanism used by
|
||||
* Unices.
|
||||
*/
|
||||
extern void redirect_output_traditional(void)
|
||||
extern void redirect_output_stderr(void)
|
||||
{
|
||||
fns.print_message_fn = &print_message_to_stdout;
|
||||
fns.print_error_fn = &print_message_to_stderr;
|
||||
|
|
|
@ -68,7 +68,7 @@ extern void flush_msg(void);
|
|||
* to go to stdout. This is the "traditional" mechanism used by
|
||||
* Unices.
|
||||
*/
|
||||
extern void redirect_output_traditional(void);
|
||||
extern void redirect_output_stderr(void);
|
||||
/*
|
||||
* Calling this causes all output to go to stdout. This is simpler,
|
||||
* and is likely to be more use to most users.
|
||||
|
|
16
ps.c
16
ps.c
|
@ -168,13 +168,17 @@ extern int build_PS_reader(int input,
|
|||
return 1;
|
||||
}
|
||||
|
||||
// But we don't *really* want to have read its start yet
|
||||
err = seek_using_PS_reader(new,new->start);
|
||||
if (err)
|
||||
// Seeking won't work on standard input, so don't even try
|
||||
if (input != STDIN_FILENO)
|
||||
{
|
||||
print_err("### Error seeking to start of first pack header\n");
|
||||
free(new);
|
||||
return 1;
|
||||
// But we don't *really* want to have read its start yet
|
||||
err = seek_using_PS_reader(new,new->start);
|
||||
if (err)
|
||||
{
|
||||
print_err("### Error seeking to start of first pack header\n");
|
||||
free(new);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!quiet && new->start != 0)
|
||||
|
|
21
ps2ts.c
21
ps2ts.c
|
@ -98,8 +98,10 @@ static void print_usage()
|
|||
" e.g., using psreport)\n"
|
||||
"\n"
|
||||
"Output switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdout Write output to <stdout>, instead of a named file\n"
|
||||
" Forces -quiet.\n"
|
||||
" Forces -quiet and -err stderr.\n"
|
||||
" -host <host>, -host <host>:<port>\n"
|
||||
" Writes output (over TCP/IP) to the named <host>,\n"
|
||||
" instead of to a named file. If <port> is not\n"
|
||||
|
@ -256,6 +258,23 @@ int main(int argc, char **argv)
|
|||
{
|
||||
had_output_name = TRUE; // more or less
|
||||
use_stdout = TRUE;
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("ps2ts",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### ps2ts: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-dvd",argv[ii]))
|
||||
{
|
||||
|
|
18
psdots.c
18
psdots.c
|
@ -257,6 +257,8 @@ static void print_usage()
|
|||
" <infile> is an H.222 Program Stream file (but see -stdin)\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Input from standard input, instead of a file\n"
|
||||
" -verbose, -v Output a description of the characters used\n"
|
||||
" -max <n>, -m <n> Maximum number of PS packets to read\n"
|
||||
|
@ -292,6 +294,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("psdots",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### psdots: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-verbose",argv[ii]) || !strcmp("-v",argv[ii]))
|
||||
{
|
||||
verbose = TRUE;
|
||||
|
|
18
psreport.c
18
psreport.c
|
@ -471,6 +471,8 @@ static void print_usage()
|
|||
" <infile> is an H.222 Program Stream file (but see -stdin)\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Input from standard input, instead of a file\n"
|
||||
" -verbose, -v Output packet data as well.\n"
|
||||
" -max <n>, -m <n> Maximum number of PS packets to read\n"
|
||||
|
@ -512,6 +514,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("psreport",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### psreport: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-verbose",argv[ii]) || !strcmp("-v",argv[ii]))
|
||||
{
|
||||
verbose = TRUE;
|
||||
|
|
|
@ -377,6 +377,8 @@ static void print_usage()
|
|||
" <infile> is the file to analyse\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -verbose, -v Output more detailed information about how it is\n"
|
||||
" making its decision\n"
|
||||
" -quiet, -q Only output error messages\n"
|
||||
|
@ -416,6 +418,22 @@ int main(int argc, char **argv)
|
|||
verbose = TRUE;
|
||||
quiet = FALSE;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("stream_type",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### stream_type: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-quiet",argv[ii]) || !strcmp("-q",argv[ii]))
|
||||
{
|
||||
verbose = FALSE;
|
||||
|
|
|
@ -89,7 +89,7 @@ int main(int argc, char **argv)
|
|||
printf("-------------------------------------------\n");
|
||||
printf("Choosing 'traditional' output and repeating\n");
|
||||
printf("-------------------------------------------\n");
|
||||
redirect_output_traditional();
|
||||
redirect_output_stderr();
|
||||
print_msg("1. Printing a normal message\n");
|
||||
print_err("2. Printing an error message\n");
|
||||
fprint_msg("3. Printing a formatted '%s'\n","message");
|
||||
|
|
21
ts2es.c
21
ts2es.c
|
@ -432,9 +432,11 @@ static void print_usage()
|
|||
" named in the (first) PMT\n"
|
||||
"\n"
|
||||
"General switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Input from standard input, instead of a file\n"
|
||||
" -stdout Output to standard output, instead of a file\n"
|
||||
" Forces -quiet.\n"
|
||||
" Forces -quiet and -err stderr.\n"
|
||||
" -verbose, -v Output informational/diagnostic messages\n"
|
||||
" -quiet, -q Only output error messages\n"
|
||||
" -max <n>, -m <n> Maximum number of TS packets to read\n"
|
||||
|
@ -530,6 +532,23 @@ int main(int argc, char **argv)
|
|||
{
|
||||
use_stdout = TRUE;
|
||||
had_output_name = TRUE; // so to speak
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("ts2es",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### ts2es: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
29
ts2ps.c
29
ts2ps.c
|
@ -186,14 +186,14 @@ static int extract_data(int input,
|
|||
#define MAX_LENGTH 0xFFFF
|
||||
if (PES_packet_length > MAX_LENGTH)
|
||||
{
|
||||
fprint_msg("PES packet of 'zero' length is really %6d - too long for one packet\n",
|
||||
fprint_err("PES packet of 'zero' length is really %6d - too long for one packet\n",
|
||||
PES_packet_length);
|
||||
// Output what we can of the original packet
|
||||
reader->packet->data[4] = (MAX_LENGTH & 0xFF00) >> 8;
|
||||
reader->packet->data[5] = (MAX_LENGTH & 0x00FF);
|
||||
// Remember that we also write out the 6 bytes preceding those
|
||||
// MAX_LENGTH bytes...
|
||||
fprint_msg(".. writing out %5d (%5d total)\n",MAX_LENGTH,MAX_LENGTH+6);
|
||||
fprint_err(".. writing out %5d (%5d total)\n",MAX_LENGTH,MAX_LENGTH+6);
|
||||
count = fwrite(reader->packet->data,MAX_LENGTH+6,1,output);
|
||||
if (count != 1)
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ static int extract_data(int input,
|
|||
// we can write is three less than the (otherwise) maximum.
|
||||
int this_length = min(MAX_LENGTH-3,PES_packet_length);
|
||||
int err;
|
||||
fprint_msg(".. writing out %5d\n",this_length);
|
||||
fprint_err(".. writing out %5d\n",this_length);
|
||||
err = write_PES_packet(output,start,this_length,
|
||||
reader->packet->data[3]);
|
||||
if (err)
|
||||
|
@ -229,7 +229,7 @@ static int extract_data(int input,
|
|||
}
|
||||
else
|
||||
{
|
||||
fprint_msg("PES packet of 'zero' length, adjusting to %6d-6=%6d"
|
||||
fprint_err("PES packet of 'zero' length, adjusting to %6d-6=%6d"
|
||||
" (stream id %02x, 'length' %d)\n",
|
||||
reader->packet->data_len,PES_packet_length,
|
||||
reader->packet->data[3],reader->packet->length);
|
||||
|
@ -286,9 +286,11 @@ static void print_usage()
|
|||
" <outfile> is an H.222 Program Stream file (but see -stdout)\n"
|
||||
"\n"
|
||||
"General switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Input from standard input, instead of a file\n"
|
||||
" -stdout Output to standard output, instead of a file\n"
|
||||
" Forces -quiet.\n"
|
||||
" Forces -quiet and -err stderr.\n"
|
||||
" -verbose, -v Output informational/diagnostic messages\n"
|
||||
" -quiet, -q Only output error messages\n"
|
||||
" -max <n>, -m <n> Maximum number of TS packets to read\n"
|
||||
|
@ -368,6 +370,23 @@ int main(int argc, char **argv)
|
|||
{
|
||||
use_stdout = TRUE;
|
||||
had_output_name = TRUE; // so to speak
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("ts2ps",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### ts2ps: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -175,6 +175,8 @@ static void print_usage()
|
|||
" <infile> An H.222 Transport Stream file.\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -p <positions> This a a colon (':') delimited string of numbers\n"
|
||||
" between 0 and 1, representing how far through to put \n"
|
||||
" each TS packet. E.g., -p 0.1:0.4:0.7:0.9 will insert\n"
|
||||
|
@ -290,6 +292,22 @@ int main(int argc, char **argv)
|
|||
assert(pos_index == n_pos);
|
||||
|
||||
}
|
||||
else if (!strcmp("-err",argv[argno]))
|
||||
{
|
||||
CHECKARG("ts_packet_insert",argno);
|
||||
if (!strcmp(argv[argno+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[argno+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### ts_packet_insert: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[argno+1]);
|
||||
return 1;
|
||||
}
|
||||
argno++;
|
||||
}
|
||||
else if (!strcmp("-pid",argv[argno]))
|
||||
{
|
||||
int err;
|
||||
|
|
18
tsinfo.c
18
tsinfo.c
|
@ -296,6 +296,8 @@ static void print_usage()
|
|||
" <infile> is an H.222 Transport Stream file (but see -stdin)\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdin Input from standard input, instead of a file\n"
|
||||
" -verbose, -v Output extra information about packets\n"
|
||||
" -max <n>, -m <n> Number of TS packets to scan. Defaults to 10000.\n"
|
||||
|
@ -333,6 +335,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("tsinfo",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### tsinfo: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-verbose",argv[ii]) || !strcmp("-v",argv[ii]))
|
||||
{
|
||||
verbose = TRUE;
|
||||
|
|
24
tsplay.c
24
tsplay.c
|
@ -865,12 +865,14 @@ static void print_usage(int summary)
|
|||
);
|
||||
if (summary)
|
||||
print_msg(
|
||||
" -stdout Output is to standard output. Forces -quiet.\n"
|
||||
" -stdout Output is to standard output. Forces -quiet and -err stderr.\n"
|
||||
);
|
||||
else
|
||||
print_msg(
|
||||
" -stdout Output is to standard output. This does not\n"
|
||||
" make sense with -tcp or -udp. This forces -quiet.\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -stdout Output is to standard output. This does not make sense\n"
|
||||
" with -tcp or -udp. This forces -quiet and -err stderr.\n"
|
||||
);
|
||||
print_msg(
|
||||
"\n"
|
||||
|
@ -1229,6 +1231,22 @@ int main(int argc, char **argv)
|
|||
use_network = FALSE;
|
||||
how = TS_W_STDOUT;
|
||||
output_name = NULL;
|
||||
redirect_output_stderr();
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("tsplay",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### tsplay: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-tcp",argv[ii]))
|
||||
|
|
18
tsreport.c
18
tsreport.c
|
@ -1022,6 +1022,8 @@ static void print_usage()
|
|||
" By default, normal operation just reports the number of TS packets.\n"
|
||||
" -timing, -t Report timing information based on the PCRs.\n"
|
||||
" -data Show TS packet/payload data as bytes\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -verbose, -v Also output (fairly detailed) information on each TS packet.\n"
|
||||
" -quiet, -q Only output summary information (this is the default)\n"
|
||||
" -max <n>, -m <n> Maximum number of TS packets to read\n"
|
||||
|
@ -1111,6 +1113,22 @@ int main(int argc, char **argv)
|
|||
verbose = TRUE;
|
||||
quiet = FALSE;
|
||||
}
|
||||
else if (!strcmp("-err",argv[ii]))
|
||||
{
|
||||
CHECKARG("tsreport",ii);
|
||||
if (!strcmp(argv[ii+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[ii+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### tsreport: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[ii+1]);
|
||||
return 1;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
else if (!strcmp("-timing",argv[ii]) || !strcmp("-t",argv[ii]))
|
||||
{
|
||||
report_timing = TRUE;
|
||||
|
|
18
tsserve.c
18
tsserve.c
|
@ -3325,6 +3325,8 @@ static void print_usage()
|
|||
"General Switches:\n"
|
||||
" -details Print out more detailed help information,\n"
|
||||
" including some less common options.\n"
|
||||
" -err stdout Write error messages to standard output (the default)\n"
|
||||
" -err stderr Write error messages to standard error (Unix traditional)\n"
|
||||
" -quiet, -q Suppress informational and warning messages.\n"
|
||||
" -verbose, -v Output additional diagnostic messages\n"
|
||||
" -port <n> Listen for a client on port <n> (default 88)\n"
|
||||
|
@ -3607,6 +3609,22 @@ int main(int argc, char **argv)
|
|||
print_usage();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp("-err",argv[argno]))
|
||||
{
|
||||
CHECKARG("tsserve",argno);
|
||||
if (!strcmp(argv[argno+1],"stderr"))
|
||||
redirect_output_stderr();
|
||||
else if (!strcmp(argv[argno+1],"stdout"))
|
||||
redirect_output_stdout();
|
||||
else
|
||||
{
|
||||
fprint_err("### tsserve: "
|
||||
"Unrecognised option '%s' to -err (not 'stdout' or"
|
||||
" 'stderr')\n",argv[argno+1]);
|
||||
return 1;
|
||||
}
|
||||
argno++;
|
||||
}
|
||||
else if (!strcmp("-details",argv[argno]))
|
||||
{
|
||||
print_detailed_usage();
|
||||
|
|
Ładowanie…
Reference in New Issue