ossia/score

AVFormatContext interrupt_callback support

Open

#1,792 opened on May 27, 2025

 (0 comments) (0 reactions) (0 assignees)C++ (126 forks)auto 404
ODHack14easygood first issue

Repository metrics

Stars
 (2,035 stars)
PR merge metrics
 (PR metrics pending)

Description

needed to handle proper camera unplugging:

+++ b/src/plugins/score-plugin-media/Video/CameraInput.cpp
@@ -71,6 +71,9 @@ bool CameraInput::start() noexcept
   m_formatContext->flags |= AVFMT_FLAG_NOBUFFER;
   m_formatContext->flags |= AVFMT_FLAG_FLUSH_PACKETS;
 
+  m_formatContext->interrupt_callback.callback = +[](void*) -> int { return 1; };
+  m_formatContext->interrupt_callback.opaque = 0;
+
   AVDictionary* options = nullptr;

Contributor guide