History

lavc/thread: move generic-layer API to avcodec_internal.h

thread.h currently contains both API for decoder use and functions internal to lavc generic layer. Move the latter to avcodec_internal.h, which is a more appropriate place for them.

Anton Khirnov committed 2 years ago

Commit d94cfd41 parent 8d5efc24 files · +26 −32Browse files

Showing the changes to libavcodec (4 of 4 files). Show all

Unified · Split

4 files
  1. libavcodec/avcodec_internal.h +24 −0
  2. libavcodec/pthread.c +1 −0
  3. libavcodec/thread.h +1 −24
  4. libavcodec/utils.c +0 −8
libavcodec/avcodec_internal.h+24−0
@@ -72,4 +72,28 @@ struct AVCodecInternal *ff_encode_internal_alloc(void); · 71 unmodified lines
72 72
73void ff_codec_close(struct AVCodecContext *avctx);73void ff_codec_close(struct AVCodecContext *avctx);
74 74
75int ff_thread_init(struct AVCodecContext *s);
76void ff_thread_free(struct AVCodecContext *s);
77
78/**
79 * Wait for decoding threads to finish and reset internal state.
80 * Called by avcodec_flush_buffers().
81 *
82 * @param avctx The context.
83 */
84void ff_thread_flush(struct AVCodecContext *avctx);
85
86/**
87 * Submit a new frame to a decoding thread.
88 * Returns the next available frame in picture. *got_picture_ptr
89 * will be 0 if none is available.
90 * The return value on success is the size of the consumed packet for
91 * compatibility with FFCodec.decode. This means the decoder
92 * has to consume the full packet.
93 *
94 * Parameters are the same as FFCodec.decode.
95 */
96int ff_thread_decode_frame(struct AVCodecContext *avctx, struct AVFrame *frame,
97 int *got_picture_ptr, struct AVPacket *avpkt);
98
75#endif // AVCODEC_AVCODEC_INTERNAL_H99#endif // AVCODEC_AVCODEC_INTERNAL_H
libavcodec/pthread.c+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
32#include "libavutil/thread.h"32#include "libavutil/thread.h"
33 33
34#include "avcodec.h"34#include "avcodec.h"
35#include "avcodec_internal.h"
35#include "codec_internal.h"36#include "codec_internal.h"
36#include "pthread_internal.h"37#include "pthread_internal.h"
37#include "thread.h"38#include "thread.h"
libavcodec/thread.h+1−24
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 20
21/**21/**
22 * @file22 * @file
23 * Multithreading support functions23 * Multithreading API for decoders
24 * @author Alexander Strange <astrange@ithinksw.com>24 * @author Alexander Strange <astrange@ithinksw.com>
25 */25 */
26 26
@@ -31,27 +31,6 @@ · 4 unmodified lines
31 31
32#include "avcodec.h"32#include "avcodec.h"
33 33
34/**
35 * Wait for decoding threads to finish and reset internal state.
36 * Called by avcodec_flush_buffers().
37 *
38 * @param avctx The context.
39 */
40void ff_thread_flush(AVCodecContext *avctx);
41
42/**
43 * Submit a new frame to a decoding thread.
44 * Returns the next available frame in picture. *got_picture_ptr
45 * will be 0 if none is available.
46 * The return value on success is the size of the consumed packet for
47 * compatibility with FFCodec.decode. This means the decoder
48 * has to consume the full packet.
49 *
50 * Parameters are the same as FFCodec.decode.
51 */
52int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture,
53 int *got_picture_ptr, AVPacket *avpkt);
54
55int ff_thread_can_start_frame(AVCodecContext *avctx);34int ff_thread_can_start_frame(AVCodecContext *avctx);
56 35
57/**36/**
@@ -74,11 +53,9 @@ void ff_thread_finish_setup(AVCodecContext *avctx); · 16 unmodified lines
74 */53 */
75int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags);54int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags);
76 55
77int ff_thread_init(AVCodecContext *s);
78int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx,56int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx,
79 int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr),57 int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr),
80 int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count);58 int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count);
81void ff_thread_free(AVCodecContext *s);
82int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count);59int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count);
83int ff_slice_thread_init_progress(AVCodecContext *avctx);60int ff_slice_thread_init_progress(AVCodecContext *avctx);
84void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n);61void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n);
libavcodec/utils.c+0−8
@@ -809,14 +809,6 @@ int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes) · 808 unmodified lines
809 return FFMAX(0, duration);809 return FFMAX(0, duration);
810}810}
811 811
812#if !HAVE_THREADS
813int ff_thread_init(AVCodecContext *s)
814{
815 return -1;
816}
817
818#endif
819
820unsigned int av_xiphlacing(unsigned char *s, unsigned int v)812unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
821{813{
822 unsigned int n = 0;814 unsigned int n = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t