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
7234e04e
Commit
7234e04e
authored
Nov 19, 2015
by
Clément Bœsch
Committed by
Clément Bœsch
Dec 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: enable echoing with command and debug modes
Allow seeing text when pressing 'c' or 'd'.
parent
60532348
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
ffmpeg.c
ffmpeg.c
+18
-0
No files found.
ffmpeg.c
View file @
7234e04e
...
...
@@ -3395,6 +3395,18 @@ static OutputStream *choose_output(void)
return
ost_min
;
}
static
void
set_tty_echo
(
int
on
)
{
#if HAVE_TERMIOS_H
struct
termios
tty
;
if
(
tcgetattr
(
0
,
&
tty
)
==
0
)
{
if
(
on
)
tty
.
c_lflag
|=
ECHO
;
else
tty
.
c_lflag
&=
~
ECHO
;
tcsetattr
(
0
,
TCSANOW
,
&
tty
);
}
#endif
}
static
int
check_keyboard_interaction
(
int64_t
cur_time
)
{
int
i
,
ret
,
key
;
...
...
@@ -3427,10 +3439,13 @@ static int check_keyboard_interaction(int64_t cur_time)
int
k
,
n
=
0
;
fprintf
(
stderr
,
"
\n
Enter command: <target>|all <time>|-1 <command>[ <argument>]
\n
"
);
i
=
0
;
set_tty_echo
(
1
);
while
((
k
=
read_key
())
!=
'\n'
&&
k
!=
'\r'
&&
i
<
sizeof
(
buf
)
-
1
)
if
(
k
>
0
)
buf
[
i
++
]
=
k
;
buf
[
i
]
=
0
;
set_tty_echo
(
0
);
fprintf
(
stderr
,
"
\n
"
);
if
(
k
>
0
&&
(
n
=
sscanf
(
buf
,
"%63[^ ] %lf %255[^ ] %255[^
\n
]"
,
target
,
&
time
,
command
,
arg
))
>=
3
)
{
av_log
(
NULL
,
AV_LOG_DEBUG
,
"Processing command target:%s time:%f command:%s arg:%s"
,
...
...
@@ -3469,10 +3484,13 @@ static int check_keyboard_interaction(int64_t cur_time)
char
buf
[
32
];
int
k
=
0
;
i
=
0
;
set_tty_echo
(
1
);
while
((
k
=
read_key
())
!=
'\n'
&&
k
!=
'\r'
&&
i
<
sizeof
(
buf
)
-
1
)
if
(
k
>
0
)
buf
[
i
++
]
=
k
;
buf
[
i
]
=
0
;
set_tty_echo
(
0
);
fprintf
(
stderr
,
"
\n
"
);
if
(
k
<=
0
||
sscanf
(
buf
,
"%d"
,
&
debug
)
!=
1
)
fprintf
(
stderr
,
"error parsing debug value
\n
"
);
}
...
...
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