[Libav-user] AVIOInterruptCB and how to use it

Yurii Monakov monakov.y at gmail.com
Thu Nov 11 21:57:17 EET 2021


Hi,

Initial value of interrupt_callback can be cached internally somewhere
inside avformat_find_stream_info.
My code performs assignment just right after context allocation.

Regards,
Yurii


вт, 9 нояб. 2021 г. в 18:23, Simon Brown <simon.k.brown at gmail.com>:

> Hi,
> I'm trying to stop av_read_frame from blocking when the stream is stopped
> (stream over TCP, and the sender pauses sending).  Reading various forum
> posts, it would appear that I need to use the AVIOInterruptCB structure and
> assign it to my format context.  So I do this:
>
>     /* retrieve stream information */
>     if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
>         fprintf(stderr, "Could not find stream information\n");
>         exit(1);
>     }
>     static const AVIOInterruptCB int_cb = {interrupt_cb, &int_cb_ctx};
>     fmt_ctx->interrupt_callback = int_cb;
>
> where interrupt_cb and int_cb_ctx are defined as:
>
> static int interrupt_cb(void *ctx)
> {
> int *p = (int *)ctx;
> *p = 53;
> return 1;
> }
>
> int int_cb_ctx = 0;
>
> The only problem now is that av_read_frame still blocks, there's no
> evidence that interrupt_cb is being called, and I cannot restart my stream
> because my decoder gets stuck in av_read_frame.
>
> Is there anything I am doing wrong?  Or is this a feature that has been
> deprecated?  Is there a better way of getting out of av_read_frame blocking?
>
> Cheers,
> Simon
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20211111/45c43290/attachment.htm>


More information about the Libav-user mailing list