Skip to content

Commit a272c9c

Browse files
committed
avfilter: Add a header for internal generic-layer APIs
This commit moves the generic-layer stuff (that is not used by filters) to a new header of its own, similarly to 5e7b5b0 for libavcodec. thread.h and link_internal.h are merged into this header. Signed-off-by: Andreas Rheinhardt <[email protected]>
1 parent db98b0e commit a272c9c

File tree

10 files changed

+132
-154
lines changed

10 files changed

+132
-154
lines changed

libavfilter/avfilter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636

3737
#include "audio.h"
3838
#include "avfilter.h"
39+
#include "avfilter_internal.h"
3940
#include "filters.h"
4041
#include "formats.h"
4142
#include "framequeue.h"
4243
#include "framepool.h"
4344
#include "internal.h"
44-
#include "link_internal.h"
4545
#include "video.h"
4646

4747
static void tlog_ref(void *ctx, AVFrame *ref, int end)

libavfilter/avfilter_internal.h

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
* This file is part of FFmpeg.
3+
*
4+
* FFmpeg is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU Lesser General Public
6+
* License as published by the Free Software Foundation; either
7+
* version 2.1 of the License, or (at your option) any later version.
8+
*
9+
* FFmpeg is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public
15+
* License along with FFmpeg; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
/*
20+
* APIs internal to the generic filter(graph) layer.
21+
*
22+
* MUST NOT be included by individual filters.
23+
*/
24+
25+
#ifndef AVFILTER_AVFILTER_INTERNAL_H
26+
#define AVFILTER_AVFILTER_INTERNAL_H
27+
28+
#include <stdint.h>
29+
30+
#include "avfilter.h"
31+
#include "framequeue.h"
32+
33+
typedef struct FilterLinkInternal {
34+
AVFilterLink l;
35+
36+
/**
37+
* Queue of frames waiting to be filtered.
38+
*/
39+
FFFrameQueue fifo;
40+
41+
/**
42+
* If set, the source filter can not generate a frame as is.
43+
* The goal is to avoid repeatedly calling the request_frame() method on
44+
* the same link.
45+
*/
46+
int frame_blocked_in;
47+
48+
/**
49+
* Link input status.
50+
* If not zero, all attempts of filter_frame will fail with the
51+
* corresponding code.
52+
*/
53+
int status_in;
54+
55+
/**
56+
* Timestamp of the input status change.
57+
*/
58+
int64_t status_in_pts;
59+
60+
/**
61+
* Link output status.
62+
* If not zero, all attempts of request_frame will fail with the
63+
* corresponding code.
64+
*/
65+
int status_out;
66+
} FilterLinkInternal;
67+
68+
static inline FilterLinkInternal *ff_link_internal(AVFilterLink *link)
69+
{
70+
return (FilterLinkInternal*)link;
71+
}
72+
73+
typedef struct AVFilterCommand {
74+
double time; ///< time expressed in seconds
75+
char *command; ///< command
76+
char *arg; ///< optional argument for the command
77+
int flags;
78+
struct AVFilterCommand *next;
79+
} AVFilterCommand;
80+
81+
struct AVFilterGraphInternal {
82+
void *thread;
83+
avfilter_execute_func *thread_execute;
84+
FFFrameQueueGlobal frame_queues;
85+
};
86+
87+
/**
88+
* Update the position of a link in the age heap.
89+
*/
90+
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link);
91+
92+
/**
93+
* Allocate a new filter context and return it.
94+
*
95+
* @param filter what filter to create an instance of
96+
* @param inst_name name to give to the new filter context
97+
*
98+
* @return newly created filter context or NULL on failure
99+
*/
100+
AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name);
101+
102+
/**
103+
* Remove a filter from a graph;
104+
*/
105+
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter);
106+
107+
int ff_filter_activate(AVFilterContext *filter);
108+
109+
/**
110+
* Parse filter options into a dictionary.
111+
*
112+
* @param logctx context for logging
113+
* @param priv_class a filter's private class for shorthand options or NULL
114+
* @param options dictionary to store parsed options in
115+
* @param args options string to parse
116+
*
117+
* @return a non-negative number on success, a negative error code on failure
118+
*/
119+
int ff_filter_opt_parse(void *logctx, const AVClass *priv_class,
120+
AVDictionary **options, const char *args);
121+
122+
int ff_graph_thread_init(AVFilterGraph *graph);
123+
124+
void ff_graph_thread_free(AVFilterGraph *graph);
125+
126+
#endif /* AVFILTER_AVFILTER_INTERNAL_H */

libavfilter/avfiltergraph.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@
3434

3535

3636
#include "avfilter.h"
37+
#include "avfilter_internal.h"
3738
#include "buffersink.h"
3839
#include "formats.h"
3940
#include "framequeue.h"
4041
#include "internal.h"
41-
#include "link_internal.h"
42-
#include "thread.h"
4342

4443
#define OFFSET(x) offsetof(AVFilterGraph, x)
4544
#define F AV_OPT_FLAG_FILTERING_PARAM

libavfilter/buffersink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232

3333
#include "audio.h"
3434
#include "avfilter.h"
35+
#include "avfilter_internal.h"
3536
#include "buffersink.h"
3637
#include "filters.h"
3738
#include "formats.h"
3839
#include "framequeue.h"
3940
#include "internal.h"
40-
#include "link_internal.h"
4141
#include "video.h"
4242

4343
typedef struct BufferSinkContext {

libavfilter/graphparser.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "libavutil/opt.h"
3030

3131
#include "avfilter.h"
32+
#include "avfilter_internal.h"
3233
#include "internal.h"
3334

3435
#define WHITESPACES " \n\t\r"

libavfilter/internal.h

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,6 @@
2626

2727
#include "libavutil/internal.h"
2828
#include "avfilter.h"
29-
#include "framequeue.h"
30-
31-
typedef struct AVFilterCommand {
32-
double time; ///< time expressed in seconds
33-
char *command; ///< command
34-
char *arg; ///< optional argument for the command
35-
int flags;
36-
struct AVFilterCommand *next;
37-
} AVFilterCommand;
38-
39-
/**
40-
* Update the position of a link in the age heap.
41-
*/
42-
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link);
4329

4430
/**
4531
* A filter pad used for either input or output.
@@ -127,12 +113,6 @@ struct AVFilterPad {
127113
int (*config_props)(AVFilterLink *link);
128114
};
129115

130-
struct AVFilterGraphInternal {
131-
void *thread;
132-
avfilter_execute_func *thread_execute;
133-
FFFrameQueueGlobal frame_queues;
134-
};
135-
136116
typedef struct FFFilterContext {
137117
/**
138118
* The public AVFilterContext. See avfilter.h for it.
@@ -356,23 +336,6 @@ int ff_request_frame(AVFilterLink *link);
356336
*/
357337
int ff_filter_frame(AVFilterLink *link, AVFrame *frame);
358338

359-
/**
360-
* Allocate a new filter context and return it.
361-
*
362-
* @param filter what filter to create an instance of
363-
* @param inst_name name to give to the new filter context
364-
*
365-
* @return newly created filter context or NULL on failure
366-
*/
367-
AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name);
368-
369-
int ff_filter_activate(AVFilterContext *filter);
370-
371-
/**
372-
* Remove a filter from a graph;
373-
*/
374-
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter);
375-
376339
/**
377340
* The filter is aware of hardware frames, and any hardware frame context
378341
* should not be automatically propagated through it.
@@ -415,17 +378,4 @@ int ff_filter_process_command(AVFilterContext *ctx, const char *cmd,
415378
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link,
416379
int default_pool_size);
417380

418-
/**
419-
* Parse filter options into a dictionary.
420-
*
421-
* @param logctx context for logging
422-
* @param priv_class a filter's private class for shorthand options or NULL
423-
* @param options dictionary to store parsed options in
424-
* @param args options string to parse
425-
*
426-
* @return a non-negative number on success, a negative error code on failure
427-
*/
428-
int ff_filter_opt_parse(void *logctx, const AVClass *priv_class,
429-
AVDictionary **options, const char *args);
430-
431381
#endif /* AVFILTER_INTERNAL_H */

libavfilter/link_internal.h

Lines changed: 0 additions & 69 deletions
This file was deleted.

libavfilter/pthread.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
#include "libavutil/slicethread.h"
3030

3131
#include "avfilter.h"
32-
#include "internal.h"
33-
#include "thread.h"
32+
#include "avfilter_internal.h"
3433

3534
typedef struct ThreadContext {
3635
AVFilterGraph *graph;

libavfilter/tests/filtfmts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
#include "libavutil/samplefmt.h"
2727

2828
#include "libavfilter/avfilter.h"
29+
#include "libavfilter/avfilter_internal.h"
2930
#include "libavfilter/formats.h"
3031
#include "libavfilter/framequeue.h"
3132
#include "libavfilter/internal.h"
32-
#include "libavfilter/link_internal.h"
3333

3434
static void print_formats_internal(AVFilterLink **links, const AVFilterPad *pads,
3535
unsigned nb, size_t fmts_cfg_offset,

libavfilter/thread.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)