Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
337ce558
Commit
337ce558
authored
Dec 08, 2011
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fftools: add -report option.
parent
5207f959
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
0 deletions
+99
-0
Changelog
Changelog
+1
-0
cmdutils.c
cmdutils.c
+85
-0
cmdutils.h
cmdutils.h
+2
-0
cmdutils_common_opts.h
cmdutils_common_opts.h
+1
-0
avtools-common-opts.texi
doc/avtools-common-opts.texi
+10
-0
No files found.
Changelog
View file @
337ce558
...
...
@@ -131,6 +131,7 @@ easier to use. The changes are:
- life source
- PCM format support in OMA demuxer
- CLJR encoder
- new option: -report
version 0.8:
...
...
cmdutils.c
View file @
337ce558
...
...
@@ -55,6 +55,8 @@ AVDictionary *format_opts, *codec_opts;
static
const
int
this_year
=
2011
;
static
FILE
*
report_file
;
void
init_opts
(
void
)
{
#if CONFIG_SWSCALE
...
...
@@ -77,6 +79,20 @@ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
vfprintf
(
stdout
,
fmt
,
vl
);
}
static
void
log_callback_report
(
void
*
ptr
,
int
level
,
const
char
*
fmt
,
va_list
vl
)
{
va_list
vl2
;
char
line
[
1024
];
static
int
print_prefix
=
1
;
va_copy
(
vl2
,
vl
);
av_log_default_callback
(
ptr
,
level
,
fmt
,
vl
);
av_log_format_line
(
ptr
,
level
,
fmt
,
vl2
,
line
,
sizeof
(
line
),
&
print_prefix
);
va_end
(
vl2
);
fputs
(
line
,
report_file
);
fflush
(
report_file
);
}
double
parse_number_or_die
(
const
char
*
context
,
const
char
*
numstr
,
int
type
,
double
min
,
double
max
)
{
char
*
tail
;
...
...
@@ -344,6 +360,30 @@ static int locate_option(int argc, char **argv, const OptionDef *options, const
return
0
;
}
static
void
dump_argument
(
const
char
*
a
)
{
const
unsigned
char
*
p
;
for
(
p
=
a
;
*
p
;
p
++
)
if
(
!
((
*
p
>=
'+'
&&
*
p
<=
':'
)
||
(
*
p
>=
'@'
&&
*
p
<=
'Z'
)
||
*
p
==
'_'
||
(
*
p
>=
'a'
&&
*
p
<=
'z'
)))
break
;
if
(
!*
p
)
{
fputs
(
a
,
report_file
);
return
;
}
fputc
(
'"'
,
report_file
);
for
(
p
=
a
;
*
p
;
p
++
)
{
if
(
*
p
==
'\\'
||
*
p
==
'"'
||
*
p
==
'$'
||
*
p
==
'`'
)
fprintf
(
report_file
,
"
\\
%c"
,
*
p
);
else
if
(
*
p
<
' '
||
*
p
>
'~'
)
fprintf
(
report_file
,
"
\\
x%02x"
,
*
p
);
else
fputc
(
*
p
,
report_file
);
}
fputc
(
'"'
,
report_file
);
}
void
parse_loglevel
(
int
argc
,
char
**
argv
,
const
OptionDef
*
options
)
{
int
idx
=
locate_option
(
argc
,
argv
,
options
,
"loglevel"
);
...
...
@@ -351,6 +391,19 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
idx
=
locate_option
(
argc
,
argv
,
options
,
"v"
);
if
(
idx
&&
argv
[
idx
+
1
])
opt_loglevel
(
"loglevel"
,
argv
[
idx
+
1
]);
idx
=
locate_option
(
argc
,
argv
,
options
,
"report"
);
if
(
idx
||
getenv
(
"FFREPORT"
))
{
opt_report
(
"report"
);
if
(
report_file
)
{
int
i
;
fprintf
(
report_file
,
"Command line:
\n
"
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
dump_argument
(
argv
[
i
]);
fputc
(
i
<
argc
-
1
?
' '
:
'\n'
,
report_file
);
}
fflush
(
report_file
);
}
}
}
#define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
...
...
@@ -424,6 +477,38 @@ int opt_loglevel(const char *opt, const char *arg)
return
0
;
}
int
opt_report
(
const
char
*
opt
)
{
char
filename
[
64
];
time_t
now
;
struct
tm
*
tm
;
if
(
report_file
)
/* already opened */
return
0
;
time
(
&
now
);
tm
=
localtime
(
&
now
);
snprintf
(
filename
,
sizeof
(
filename
),
"%s-%04d%02d%02d-%02d%02d%02d.log"
,
program_name
,
tm
->
tm_year
+
1900
,
tm
->
tm_mon
+
1
,
tm
->
tm_mday
,
tm
->
tm_hour
,
tm
->
tm_min
,
tm
->
tm_sec
);
report_file
=
fopen
(
filename
,
"w"
);
if
(
!
report_file
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Failed to open report
\"
%s
\"
: %s
\n
"
,
filename
,
strerror
(
errno
));
return
AVERROR
(
errno
);
}
av_log_set_callback
(
log_callback_report
);
av_log
(
NULL
,
AV_LOG_INFO
,
"%s started on %04d-%02d-%02d at %02d:%02d:%02d
\n
"
"Report written to
\"
%s
\"\n
"
,
program_name
,
tm
->
tm_year
+
1900
,
tm
->
tm_mon
+
1
,
tm
->
tm_mday
,
tm
->
tm_hour
,
tm
->
tm_min
,
tm
->
tm_sec
,
filename
);
av_log_set_level
(
FFMAX
(
av_log_get_level
(),
AV_LOG_VERBOSE
));
return
0
;
}
int
opt_codec_debug
(
const
char
*
opt
,
const
char
*
arg
)
{
av_log_set_level
(
AV_LOG_DEBUG
);
...
...
cmdutils.h
View file @
337ce558
...
...
@@ -76,6 +76,8 @@ int opt_default(const char *opt, const char *arg);
*/
int
opt_loglevel
(
const
char
*
opt
,
const
char
*
arg
);
int
opt_report
(
const
char
*
opt
);
int
opt_codec_debug
(
const
char
*
opt
,
const
char
*
arg
);
/**
...
...
cmdutils_common_opts.h
View file @
337ce558
...
...
@@ -14,3 +14,4 @@
{
"loglevel"
,
HAS_ARG
,
{(
void
*
)
opt_loglevel
},
"set libav* logging level"
,
"loglevel"
},
{
"v"
,
HAS_ARG
,
{(
void
*
)
opt_loglevel
},
"set libav* logging level"
,
"loglevel"
},
{
"debug"
,
HAS_ARG
,
{(
void
*
)
opt_codec_debug
},
"set debug flags"
,
"flags"
},
{
"report"
,
0
,
{(
void
*
)
opt_report
},
"generate a report"
},
doc/avtools-common-opts.texi
View file @
337ce558
...
...
@@ -123,6 +123,16 @@ the environment variable @env{FFMPEG_FORCE_COLOR}.
The use of the environment variable @env{NO_COLOR} is deprecated and
will be dropped in a following FFmpeg version.
@item -report
Dump full command line and console output to a file named
@code{@var{program}-@var{YYYYMMDD}-@var{HHMMSS}.log} in the current
directory.
This file can be useful for bug reports.
It also implies @code{-loglevel verbose}.
Note: setting the environment variable @code{FFREPORT} to any value has the
same effect.
@end table
@section AVOptions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment