1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avformat/dhav: Fix check for seekability

AVIOContext.seekable is a bitfield. Also check for seekability
earlier.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-06-08 00:52:46 +02:00
parent 93987c03ec
commit e3ba364c5e

View File

@ -237,6 +237,9 @@ static void get_timeinfo(unsigned date, struct tm *timeinfo)
static int64_t get_duration(AVFormatContext *s) static int64_t get_duration(AVFormatContext *s)
{ {
if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL))
return 0;
int64_t start_pos = avio_tell(s->pb); int64_t start_pos = avio_tell(s->pb);
int64_t end_pos = -1; int64_t end_pos = -1;
int64_t start = 0, end = 0; int64_t start = 0, end = 0;
@ -248,9 +251,6 @@ static int64_t get_duration(AVFormatContext *s)
unsigned date; unsigned date;
int64_t size = avio_size(s->pb); int64_t size = avio_size(s->pb);
if (!s->pb->seekable)
return 0;
if (start_pos + 16 > size) if (start_pos + 16 > size)
return 0; return 0;