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
3bce9e9b
Commit
3bce9e9b
authored
Jan 27, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/tty: add probe function
parent
47d5d0cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
tty.c
libavformat/tty.c
+20
-1
No files found.
libavformat/tty.c
View file @
3bce9e9b
...
...
@@ -34,6 +34,13 @@
#include "internal.h"
#include "sauce.h"
static
int
isansicode
(
int
x
)
{
return
x
==
0x1B
||
x
==
0x0A
||
x
==
0x0D
||
(
x
>=
0x20
&&
x
<
0x7f
);
}
static
const
char
tty_extensions
[
31
]
=
"ans,art,asc,diz,ice,nfo,txt,vt"
;
typedef
struct
TtyDemuxContext
{
AVClass
*
class
;
int
chars_per_frame
;
...
...
@@ -42,6 +49,17 @@ typedef struct TtyDemuxContext {
AVRational
framerate
;
/**< Set by a private option. */
}
TtyDemuxContext
;
static
int
read_probe
(
const
AVProbeData
*
p
)
{
int
cnt
=
0
;
for
(
int
i
=
0
;
i
<
p
->
buf_size
;
i
++
)
cnt
+=
!!
isansicode
(
p
->
buf
[
i
]);
return
(
cnt
*
100LL
/
p
->
buf_size
)
*
(
cnt
>
400
)
*
!!
av_match_ext
(
p
->
filename
,
tty_extensions
);
}
/**
* Parse EFI header
*/
...
...
@@ -153,8 +171,9 @@ AVInputFormat ff_tty_demuxer = {
.
name
=
"tty"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Tele-typewriter"
),
.
priv_data_size
=
sizeof
(
TtyDemuxContext
),
.
read_probe
=
read_probe
,
.
read_header
=
read_header
,
.
read_packet
=
read_packet
,
.
extensions
=
"ans,art,asc,diz,ice,nfo,txt,vt"
,
.
extensions
=
tty_extensions
,
.
priv_class
=
&
tty_demuxer_class
,
};
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