代码拉取完成,页面将自动刷新
同步操作将从 guoxiaoqi/ffmpeg 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 3bce9e9b3ea35c54bacccc793d7da99ea5157532 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Mon, 27 Jan 2020 21:53:08 +0100
Subject: [PATCH] avformat/tty: add probe function
---
libavformat/tty.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 8d48f2c45c12..60f7e9f87ee7 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -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,
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。