1 /*
2 * Copyright (c) 2013 Stefano Sabatini
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file
23 * audio and video interleaver
24 */
25
35
41
42 #define OFFSET(x) offsetof(InterleaveContext, x)
43
44 #define DEFINE_OPTIONS(filt_name, flags_) \
45 static const AVOption filt_name##_options[] = { \
46 { "nb_inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
47 { "n", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
48 { NULL } \
49 }
50
52 {
55 int i, queue_idx = -1;
56 int64_t pts_min = INT64_MAX;
57
58 /* look for oldest frame */
61
63 return 0;
66 if (frame->
pts < pts_min) {
68 queue_idx = i;
69 }
70 }
71 }
72
73 /* all inputs are closed */
74 if (queue_idx < 0)
76
81 }
82
84 {
88
91 "NOPTS value for input frame cannot be accepted, frame discarded\n");
94 }
95
96 /* queue frame */
101
103 }
104
106 {
109 int i;
110
114
117
123
124 switch (outpad->
type) {
129 default:
131 }
133 }
134
135 return 0;
136 }
137
139 {
141 int i;
142
147 }
148 }
149
151 {
154 int i;
155
158 outlink->
w = inlink0->
w;
159 outlink->
h = inlink0->
h;
165
166 if (outlink->
w != inlink->
w ||
167 outlink->
h != inlink->
h ||
171 "(size %dx%d, SAR %d:%d) do not match the corresponding "
172 "output link parameters (%dx%d, SAR %d:%d)\n",
176 outlink->
w, outlink->
h,
180 }
181 }
182 }
183
185 return 0;
186 }
187
189 {
193
199 }
200 }
201
203 }
204
205 #if CONFIG_INTERLEAVE_FILTER
206
209
211 {
216 },
218 };
219
221 .
name =
"interleave",
227 .priv_class = &interleave_class,
229 };
230
231 #endif
232
233 #if CONFIG_AINTERLEAVE_FILTER
234
237
239 {
244 },
246 };
247
249 .
name =
"ainterleave",
254 .
outputs = ainterleave_outputs,
255 .priv_class = &ainterleave_class,
257 };
258
259 #endif