update mediatools for intended usage

This commit is contained in:
byte[] 2020-05-14 16:53:38 -04:00
parent 18401e684c
commit dad647c612
2 changed files with 11 additions and 5 deletions

View File

@ -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;

View File

@ -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;