summaryrefslogtreecommitdiff
path: root/libavcodec/thread.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2017-01-24 15:00:22 +0100
committerAnton Khirnov <anton@khirnov.net>2022-08-01 15:45:25 +0200
commita691878d1d2185856e9a7d83022f880df1473737 (patch)
treebd8c1dda1bf0702a9e0c8db8551f6e97f9837b92 /libavcodec/thread.h
parent6b12208646fc8dc6d28da4f5c5ae57ea91c29412 (diff)
lavc: convert frame threading to the receive_frame() patternthread_receive
Reorganize the code such that the frame threading code does not call the decoders directly, but instead calls back into the generic decoding code. This avoids duplicating the logic that wraps the decoder invocation and will be useful in the following commits.
Diffstat (limited to 'libavcodec/thread.h')
-rw-r--r--libavcodec/thread.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index d5673f25ea..3a1288835b 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -39,18 +39,11 @@
*/
void ff_thread_flush(AVCodecContext *avctx);
-/**
- * Submit a new frame to a decoding thread.
- * Returns the next available frame in picture. *got_picture_ptr
- * will be 0 if none is available.
- * The return value on success is the size of the consumed packet for
- * compatibility with FFCodec.decode. This means the decoder
- * has to consume the full packet.
- *
- * Parameters are the same as FFCodec.decode.
- */
-int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture,
- int *got_picture_ptr, AVPacket *avpkt);
+/*
+ * The receive_frame implementation for frame threading. Submit available
+ * packets for decoding to worker threads, return a decoded frame if available.
+*/
+int ff_thread_receive_frame(AVCodecContext *avctx, AVFrame *frame);
/**
* If the codec defines update_thread_context(), call this
@@ -99,6 +92,11 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags);
*/
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f);
+/**
+ * Get a packet for decoding. This gets invoked by the worker threads.
+ */
+int ff_thread_get_packet(AVCodecContext *avctx, AVPacket *pkt);
+
int ff_thread_init(AVCodecContext *s);
int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx,
int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr),