This will prevent seeking by bytes for formats that cannot handle this.
---
libavformat/avformat.h | 3 ++-
libavformat/utils.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 7b350f1..e38a3dd 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -274,6 +274,7 @@ typedef struct AVFormatParameters {
#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */
#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to
binary search via read_timestamp */
#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to
generic search */
+#define AVFMT_NO_SEEK_BY_BYTES 0x8000 /**< Format does not allow seeking by
bytes */
typedef struct AVOutputFormat {
const char *name;
@@ -408,7 +409,7 @@ typedef struct AVInputFormat {
/**
* Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
* AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
- * AVFMT_NOGENSEARCH.
+ * AVFMT_NOGENSEARCH, AVFMT_NO_SEEK_BY_BYTES.
*/
int flags;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f16ac7c..907a15b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1749,7 +1749,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index,
int64_t timestamp, int f
int ret;
AVStream *st;
- if (flags & AVSEEK_FLAG_BYTE) {
+ if ((flags & AVSEEK_FLAG_BYTE) && !(s->iformat->flags &
AVFMT_NO_SEEK_BY_BYTES)) {
ff_read_frame_flush(s);
return seek_frame_byte(s, stream_index, timestamp, flags);
}
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel