aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avio.h
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-11-06 14:10:16 +0200
committerAnton Khirnov <anton@khirnov.net>2011-11-13 12:59:56 +0100
commit6aa0b98fb27ab22bd62a365de44d9f16cc07d03e (patch)
tree43e51d4cbeb1f1f74c4fa9903812005985794e3b /libavformat/avio.h
parent58b68d6b36d4c88f9250fd4f57f87fea41cc5e10 (diff)
downloadffmpeg-6aa0b98fb27ab22bd62a365de44d9f16cc07d03e.tar.gz
avio: Add AVIOInterruptCB
This is a better io interrupt callback function, which has an opaque parameter, which is given to the interrupt callback. This allows callers to precisely cancel IO for one single AVFormatContext, without interrupt other ones in the same process. Note, it's not needed in AVIOContext, at the moment. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/avio.h')
-rw-r--r--libavformat/avio.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/avio.h b/libavformat/avio.h
index be14e3c89d..a4041cb770 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -36,6 +36,22 @@
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
/**
+ * Callback for checking whether to abort blocking functions.
+ * AVERROR_EXIT is returned in this case by the interrupted
+ * function. During blocking operations, callback is called with
+ * opaque as parameter. If the callback returns 1, the
+ * blocking operation will be aborted.
+ *
+ * No members can be added to this struct without a major bump, if
+ * new elements have been added after this struct in AVFormatContext
+ * or AVIOContext.
+ */
+typedef struct {
+ int (*callback)(void*);
+ void *opaque;
+} AVIOInterruptCB;
+
+/**
* Bytestream IO Context.
* New fields can be added to the end with minor version bumps.
* Removal, reordering and changes to existing fields require a major
@@ -109,6 +125,7 @@ typedef struct URLContext {
void *priv_data;
char *filename; /**< specified URL */
int is_connected;
+ AVIOInterruptCB interrupt_callback;
} URLContext;
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */