Opened 8 years ago
#6529 new defect
interrupt_callback not working
Reported by: | sergman | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | unspecified | Keywords: | interrupt callback |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The issue is related to the old problem described here:
https://trac.ffmpeg.org/ticket/2694#comment:14
I installed the latest version and the callback is not called if I pass non-existing/broken link to avio_open2 or avformat_open_input
Even av_dict_set(&options, "timeout", "5", 0); does not have any effect. The call just hangs.
Note that if the link exists the callback is working fine.
Here is the small code (actually copied from the mentioned ticked above). Compiled in Visual Studio 2015. Includes/libraries/DLLs are all up to date from https://ffmpeg.zeranoe.com/builds/
#include <Windows.h> #include <libavcodec\avcodec.h> #include <libavformat\avformat.h> #include <stdio.h> static int interrupt_cb(void *ctx) { printf("Interrupt callback called\n"); return 0; } int main(int argc, char *argv[]) { AVFormatContext *pFormatCtx; if (argc < 2) { printf("Please provide a movie file\n"); return -1; } // Register all formats and codecs av_register_all(); avcodec_register_all(); avformat_network_init(); // Open video file pFormatCtx = avformat_alloc_context(); pFormatCtx->interrupt_callback.callback = interrupt_cb; pFormatCtx->interrupt_callback.opaque = pFormatCtx; AVDictionary* options = NULL; AVIOContext* av = NULL; AVIOInterruptCB cb = { .callback = interrupt_cb, .opaque = NULL, }; //av_dict_set(&options, "timeout", "5", 0); // hangs int ret = avio_open2(&av, argv[1], AVIO_FLAG_READ, &cb, &options); // hangs if (avformat_open_input(&pFormatCtx, argv[1], NULL, &options) != 0) return -1; // Couldn't open file avformat_close_input(pFormatCtx); printf("Exiting\n"); return 0; }
Note:
See TracTickets
for help on using tickets.