Line |
Branch |
Exec |
Source |
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 |
|
|
struct FFFramePool *frame_pool; |
37 |
|
|
|
38 |
|
|
/** |
39 |
|
|
* Queue of frames waiting to be filtered. |
40 |
|
|
*/ |
41 |
|
|
FFFrameQueue fifo; |
42 |
|
|
|
43 |
|
|
/** |
44 |
|
|
* If set, the source filter can not generate a frame as is. |
45 |
|
|
* The goal is to avoid repeatedly calling the request_frame() method on |
46 |
|
|
* the same link. |
47 |
|
|
*/ |
48 |
|
|
int frame_blocked_in; |
49 |
|
|
|
50 |
|
|
/** |
51 |
|
|
* Link input status. |
52 |
|
|
* If not zero, all attempts of filter_frame will fail with the |
53 |
|
|
* corresponding code. |
54 |
|
|
*/ |
55 |
|
|
int status_in; |
56 |
|
|
|
57 |
|
|
/** |
58 |
|
|
* Timestamp of the input status change. |
59 |
|
|
*/ |
60 |
|
|
int64_t status_in_pts; |
61 |
|
|
|
62 |
|
|
/** |
63 |
|
|
* Link output status. |
64 |
|
|
* If not zero, all attempts of request_frame will fail with the |
65 |
|
|
* corresponding code. |
66 |
|
|
*/ |
67 |
|
|
int status_out; |
68 |
|
|
|
69 |
|
|
/** |
70 |
|
|
* Index in the age array. |
71 |
|
|
*/ |
72 |
|
|
int age_index; |
73 |
|
|
|
74 |
|
|
/** stage of the initialization of the link properties (dimensions, etc) */ |
75 |
|
|
enum { |
76 |
|
|
AVLINK_UNINIT = 0, ///< not started |
77 |
|
|
AVLINK_STARTINIT, ///< started, but incomplete |
78 |
|
|
AVLINK_INIT ///< complete |
79 |
|
|
} init_state; |
80 |
|
|
} FilterLinkInternal; |
81 |
|
|
|
82 |
|
23358421 |
static inline FilterLinkInternal *ff_link_internal(AVFilterLink *link) |
83 |
|
|
{ |
84 |
|
23358421 |
return (FilterLinkInternal*)link; |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
typedef struct AVFilterCommand { |
88 |
|
|
double time; ///< time expressed in seconds |
89 |
|
|
char *command; ///< command |
90 |
|
|
char *arg; ///< optional argument for the command |
91 |
|
|
int flags; |
92 |
|
|
struct AVFilterCommand *next; |
93 |
|
|
} AVFilterCommand; |
94 |
|
|
|
95 |
|
|
typedef struct FFFilterGraph { |
96 |
|
|
/** |
97 |
|
|
* The public AVFilterGraph. See avfilter.h for it. |
98 |
|
|
*/ |
99 |
|
|
AVFilterGraph p; |
100 |
|
|
|
101 |
|
|
struct FilterLinkInternal **sink_links; |
102 |
|
|
int sink_links_count; |
103 |
|
|
|
104 |
|
|
unsigned disable_auto_convert; |
105 |
|
|
|
106 |
|
|
void *thread; |
107 |
|
|
avfilter_execute_func *thread_execute; |
108 |
|
|
FFFrameQueueGlobal frame_queues; |
109 |
|
|
} FFFilterGraph; |
110 |
|
|
|
111 |
|
1205881 |
static inline FFFilterGraph *fffiltergraph(AVFilterGraph *graph) |
112 |
|
|
{ |
113 |
|
1205881 |
return (FFFilterGraph*)graph; |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
/** |
117 |
|
|
* Update the position of a link in the age heap. |
118 |
|
|
*/ |
119 |
|
|
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, |
120 |
|
|
struct FilterLinkInternal *li); |
121 |
|
|
|
122 |
|
|
/** |
123 |
|
|
* Allocate a new filter context and return it. |
124 |
|
|
* |
125 |
|
|
* @param filter what filter to create an instance of |
126 |
|
|
* @param inst_name name to give to the new filter context |
127 |
|
|
* |
128 |
|
|
* @return newly created filter context or NULL on failure |
129 |
|
|
*/ |
130 |
|
|
AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name); |
131 |
|
|
|
132 |
|
|
/** |
133 |
|
|
* Remove a filter from a graph; |
134 |
|
|
*/ |
135 |
|
|
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter); |
136 |
|
|
|
137 |
|
|
int ff_filter_activate(AVFilterContext *filter); |
138 |
|
|
|
139 |
|
|
/** |
140 |
|
|
* Parse filter options into a dictionary. |
141 |
|
|
* |
142 |
|
|
* @param logctx context for logging |
143 |
|
|
* @param priv_class a filter's private class for shorthand options or NULL |
144 |
|
|
* @param options dictionary to store parsed options in |
145 |
|
|
* @param args options string to parse |
146 |
|
|
* |
147 |
|
|
* @return a non-negative number on success, a negative error code on failure |
148 |
|
|
*/ |
149 |
|
|
int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, |
150 |
|
|
AVDictionary **options, const char *args); |
151 |
|
|
|
152 |
|
|
int ff_graph_thread_init(FFFilterGraph *graph); |
153 |
|
|
|
154 |
|
|
void ff_graph_thread_free(FFFilterGraph *graph); |
155 |
|
|
|
156 |
|
|
#endif /* AVFILTER_AVFILTER_INTERNAL_H */ |
157 |
|
|
|