Signed-off-by: Paul B Mahol <[email protected]>
---
libavformat/tty.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 8d48f2c45c..acc6da27cc 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -24,6 +24,8 @@
* Tele-typewriter demuxer
*/
+#include <ctype.h>
+
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
#include "libavutil/log.h"
@@ -42,6 +44,16 @@ typedef struct TtyDemuxContext {
AVRational framerate; /**< Set by a private option. */
} TtyDemuxContext;
+static int read_probe(const AVProbeData *p)
+{
+ int64_t cnt = 0;
+
+ for (int i = 0; i < p->buf_size; i++)
+ cnt += !!isalnum(p->buf[i]);
+
+ return cnt * 100 / p->buf_size;
+}
+
/**
* Parse EFI header
*/
@@ -153,6 +165,7 @@ 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",
--
2.17.1
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".