2 #include <Media/Libav.hpp>
5 #include <Video/VideoInterface.hpp>
7 #include <ossia/detail/lockfree_queue.hpp>
9 #include <score_plugin_media_export.h>
11 #if defined(SCORE_LIBAV_FRAME_DEBUGGING)
13 #define BOOST_STACKTRACE_USE_BACKTRACE 1
14 #include <boost/stacktrace.hpp>
26 #if defined(SCORE_LIBAV_FRAME_DEBUGGING)
27 inline struct frame_counters
33 boost::stacktrace::stacktrace st;
35 std::vector<fc> allocated;
36 void allocate(AVFrame*);
37 void deallocate(AVFrame*);
39 #define SCORE_LIBAV_FRAME_ALLOC_CHECK(f) frame_counts.allocate(f)
40 #define SCORE_LIBAV_FRAME_DEALLOC_CHECK(f) frame_counts.deallocate(f)
42 #define SCORE_LIBAV_FRAME_ALLOC_CHECK(f) \
46 #define SCORE_LIBAV_FRAME_DEALLOC_CHECK(f) \
63 AVFramePointer newFrame() noexcept;
65 void enqueue_decoding_error(AVFrame* f);
66 void enqueue(AVFrame* f);
67 AVFrame* dequeue() noexcept;
68 AVFrame* dequeue_one() noexcept;
69 AVFrame* discard_and_dequeue() noexcept;
70 AVFrame* discard_and_dequeue_one() noexcept;
72 void set_discard_frame(AVFrame*);
73 void release(AVFrame* frame) noexcept;
76 std::size_t size()
const noexcept {
return available.size_approx(); }
79 ossia::mpmc_queue<AVFrame*> available;
80 ossia::mpmc_queue<AVFrame*> released;
82 std::vector<AVFrame*> m_decodeThreadFrameBuffer;
83 std::atomic<AVFrame*> m_discardUntil{};
86 SCORE_PLUGIN_MEDIA_EXPORT
87 uint8_t* initFrameBuffer(AVFrame& frame, std::size_t bytes);
Definition: FrameQueue.hpp:53