[FFmpeg-devel] [PATCH] avformat/tty: add probe function
Carl Eugen Hoyos
ceffmpeg at gmail.com
Tue Jan 28 00:40:39 EET 2020
Am Mo., 27. Jan. 2020 um 23:16 Uhr schrieb Paul B Mahol <onemda at gmail.com>:
>
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavformat/tty.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/libavformat/tty.c b/libavformat/tty.c
> index 8d48f2c45c..75af16a6f1 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,17 @@ 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 += !!isprint(p->buf[i]);
> +
> + return (cnt * 100 / p->buf_size) * (cnt > 500) *
> + !!av_match_ext(p->filename, "ans,art,asc,diz,ice,nfo,txt,vt");
ff_tty_demuxer.extensions with a declaration above.
Thank you, Carl Eugen
More information about the ffmpeg-devel
mailing list