From dad647c61267436dc66b232cbc52295d1b6b3998 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 14 May 2020 16:53:38 -0400 Subject: [PATCH] update mediatools for intended usage --- src/stat.c | 8 +++----- src/validation.c | 8 ++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/stat.c b/src/stat.c index 1c32b5e..f654906 100644 --- a/src/stat.c +++ b/src/stat.c @@ -35,17 +35,15 @@ int main(int argc, char *argv[]) return -1; } - if (av_seek_frame(format, -1, 0, AVSEEK_FLAG_BACKWARD) != 0) { - printf("Couldn't read file\n"); - return -1; - } - int vstream_idx = av_find_best_stream(format, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0); if (vstream_idx < 0) { printf("Couldn't read file\n"); return -1; } + // Best effort attempt to seek to beginning of file + av_seek_frame(format, -1, 0, AVSEEK_FLAG_BACKWARD); + uint64_t frames = 0; int64_t last_pts = 0; int last_stream = 0; diff --git a/src/validation.c b/src/validation.c index 87b1b02..d1a5e91 100644 --- a/src/validation.c +++ b/src/validation.c @@ -62,6 +62,14 @@ int mediatools_validate_video(AVFormatContext *format) ; } } + } else if (strstr(iformat->name, "gif")) { + switch (vpar->codec_id) { + default: + printf("Bad video codec for GIF container (must be GIF)\n"); + return false; + case AV_CODEC_ID_GIF: + ; + } } else { printf("Unknown input format\n"); return false;