[FFmpeg-devel] [PATCH] avformat/tty: add probe function
Paul B Mahol
onemda at gmail.com
Tue Jan 28 00:42:56 EET 2020
On 1/27/20, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 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.
disagree
>
> Thank you, Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list