Libav
avconv_filter.c
Go to the documentation of this file.
1 /*
2  * avconv filter configuration
3  *
4  * This file is part of Libav.
5  *
6  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdint.h>
22 
23 #include "avconv.h"
24 
25 #include "libavfilter/avfilter.h"
26 #include "libavfilter/buffersrc.h"
27 
29 
30 #include "libavutil/avassert.h"
31 #include "libavutil/avstring.h"
33 #include "libavutil/display.h"
34 #include "libavutil/opt.h"
35 #include "libavutil/pixdesc.h"
36 #include "libavutil/pixfmt.h"
37 #include "libavutil/samplefmt.h"
38 
39 /* Define a function for building a string containing a list of
40  * allowed formats. */
41 #define DEF_CHOOSE_FORMAT(suffix, type, var, supported_list, none, get_name) \
42 static char *choose_ ## suffix (OutputFilter *ofilter) \
43 { \
44  if (ofilter->var != none) { \
45  get_name(ofilter->var); \
46  return av_strdup(name); \
47  } else if (ofilter->supported_list) { \
48  const type *p; \
49  AVIOContext *s = NULL; \
50  uint8_t *ret; \
51  int len; \
52  \
53  if (avio_open_dyn_buf(&s) < 0) \
54  exit(1); \
55  \
56  for (p = ofilter->supported_list; *p != none; p++) { \
57  get_name(*p); \
58  avio_printf(s, "%s|", name); \
59  } \
60  len = avio_close_dyn_buf(s, &ret); \
61  ret[len - 1] = 0; \
62  return ret; \
63  } else \
64  return NULL; \
65 }
66 
69 
72 
73 DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0,
75 
76 DEF_CHOOSE_FORMAT(channel_layouts, uint64_t, channel_layout, channel_layouts, 0,
78 
80 {
81  FilterGraph *fg = av_mallocz(sizeof(*fg));
82 
83  if (!fg)
84  exit(1);
85  fg->index = nb_filtergraphs;
86 
87  GROW_ARRAY(fg->outputs, fg->nb_outputs);
88  if (!(fg->outputs[0] = av_mallocz(sizeof(*fg->outputs[0]))))
89  exit(1);
90  fg->outputs[0]->ost = ost;
91  fg->outputs[0]->graph = fg;
92  fg->outputs[0]->format = -1;
93 
94  ost->filter = fg->outputs[0];
95 
96  GROW_ARRAY(fg->inputs, fg->nb_inputs);
97  if (!(fg->inputs[0] = av_mallocz(sizeof(*fg->inputs[0]))))
98  exit(1);
99  fg->inputs[0]->ist = ist;
100  fg->inputs[0]->graph = fg;
101  fg->inputs[0]->format = -1;
102 
103  fg->inputs[0]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
104  if (!fg->inputs[0])
105  exit_program(1);
106 
107  GROW_ARRAY(ist->filters, ist->nb_filters);
108  ist->filters[ist->nb_filters - 1] = fg->inputs[0];
109 
111  filtergraphs[nb_filtergraphs - 1] = fg;
112 
113  return 0;
114 }
115 
117 {
118  InputStream *ist = NULL;
120  int i;
121 
122  // TODO: support other filter types
123  if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) {
124  av_log(NULL, AV_LOG_FATAL, "Only video and audio filters supported "
125  "currently.\n");
126  exit(1);
127  }
128 
129  if (in->name) {
130  AVFormatContext *s;
131  AVStream *st = NULL;
132  char *p;
133  int file_idx = strtol(in->name, &p, 0);
134 
135  if (file_idx < 0 || file_idx >= nb_input_files) {
136  av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtegraph description %s.\n",
137  file_idx, fg->graph_desc);
138  exit(1);
139  }
140  s = input_files[file_idx]->ctx;
141 
142  for (i = 0; i < s->nb_streams; i++) {
143  if (s->streams[i]->codecpar->codec_type != type)
144  continue;
145  if (check_stream_specifier(s, s->streams[i], *p == ':' ? p + 1 : p) == 1) {
146  st = s->streams[i];
147  break;
148  }
149  }
150  if (!st) {
151  av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
152  "matches no streams.\n", p, fg->graph_desc);
153  exit(1);
154  }
155  ist = input_streams[input_files[file_idx]->ist_index + st->index];
156  } else {
157  /* find the first unused stream of corresponding type */
158  for (i = 0; i < nb_input_streams; i++) {
159  ist = input_streams[i];
160  if (ist->dec_ctx->codec_type == type && ist->discard)
161  break;
162  }
163  if (i == nb_input_streams) {
164  av_log(NULL, AV_LOG_FATAL, "Cannot find a matching stream for "
165  "unlabeled input pad %d on filter %s\n", in->pad_idx,
166  in->filter_ctx->name);
167  exit(1);
168  }
169  }
170  av_assert0(ist);
171 
172  ist->discard = 0;
173  ist->decoding_needed = 1;
174  ist->st->discard = AVDISCARD_NONE;
175 
176  GROW_ARRAY(fg->inputs, fg->nb_inputs);
177  if (!(fg->inputs[fg->nb_inputs - 1] = av_mallocz(sizeof(*fg->inputs[0]))))
178  exit(1);
179  fg->inputs[fg->nb_inputs - 1]->ist = ist;
180  fg->inputs[fg->nb_inputs - 1]->graph = fg;
181  fg->inputs[fg->nb_inputs - 1]->format = -1;
182 
183  fg->inputs[fg->nb_inputs - 1]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
184  if (!fg->inputs[fg->nb_inputs - 1]->frame_queue)
185  exit_program(1);
186 
187  GROW_ARRAY(ist->filters, ist->nb_filters);
188  ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1];
189 }
190 
192 {
193  AVFilterInOut *inputs, *outputs, *cur;
194  AVFilterGraph *graph;
195  int ret = 0;
196 
197  /* this graph is only used for determining the kinds of inputs
198  * and outputs we have, and is discarded on exit from this function */
199  graph = avfilter_graph_alloc();
200  if (!graph)
201  return AVERROR(ENOMEM);
202 
203  ret = avfilter_graph_parse2(graph, fg->graph_desc, &inputs, &outputs);
204  if (ret < 0)
205  goto fail;
206 
207  for (cur = inputs; cur; cur = cur->next)
208  init_input_filter(fg, cur);
209 
210  for (cur = outputs; cur;) {
211  GROW_ARRAY(fg->outputs, fg->nb_outputs);
212  fg->outputs[fg->nb_outputs - 1] = av_mallocz(sizeof(*fg->outputs[0]));
213  if (!fg->outputs[fg->nb_outputs - 1])
214  exit(1);
215 
216  fg->outputs[fg->nb_outputs - 1]->graph = fg;
217  fg->outputs[fg->nb_outputs - 1]->out_tmp = cur;
219  cur->pad_idx);
220  cur = cur->next;
221  fg->outputs[fg->nb_outputs - 1]->out_tmp->next = NULL;
222  }
223 
224 fail:
225  avfilter_inout_free(&inputs);
226  avfilter_graph_free(&graph);
227  return ret;
228 }
229 
230 static int insert_trim(int64_t start_time, int64_t duration,
231  AVFilterContext **last_filter, int *pad_idx,
232  const char *filter_name)
233 {
234  AVFilterGraph *graph = (*last_filter)->graph;
236  const AVFilter *trim;
237  enum AVMediaType type = avfilter_pad_get_type((*last_filter)->output_pads, *pad_idx);
238  const char *name = (type == AVMEDIA_TYPE_VIDEO) ? "trim" : "atrim";
239  int ret = 0;
240 
241  if (duration == INT64_MAX && start_time == AV_NOPTS_VALUE)
242  return 0;
243 
244  trim = avfilter_get_by_name(name);
245  if (!trim) {
246  av_log(NULL, AV_LOG_ERROR, "%s filter not present, cannot limit "
247  "recording time.\n", name);
249  }
250 
251  ctx = avfilter_graph_alloc_filter(graph, trim, filter_name);
252  if (!ctx)
253  return AVERROR(ENOMEM);
254 
255  if (duration != INT64_MAX) {
256  ret = av_opt_set_double(ctx, "duration", (double)duration / 1e6,
258  }
259  if (ret >= 0 && start_time != AV_NOPTS_VALUE) {
260  ret = av_opt_set_double(ctx, "start", (double)start_time / 1e6,
262  }
263  if (ret < 0) {
264  av_log(ctx, AV_LOG_ERROR, "Error configuring the %s filter", name);
265  return ret;
266  }
267 
268  ret = avfilter_init_str(ctx, NULL);
269  if (ret < 0)
270  return ret;
271 
272  ret = avfilter_link(*last_filter, *pad_idx, ctx, 0);
273  if (ret < 0)
274  return ret;
275 
276  *last_filter = ctx;
277  *pad_idx = 0;
278  return 0;
279 }
280 
281 static int insert_filter(AVFilterContext **last_filter, int *pad_idx,
282  const char *filter_name, const char *args)
283 {
284  AVFilterGraph *graph = (*last_filter)->graph;
286  int ret;
287 
288  ret = avfilter_graph_create_filter(&ctx,
289  avfilter_get_by_name(filter_name),
290  filter_name, args, NULL, graph);
291  if (ret < 0)
292  return ret;
293 
294  ret = avfilter_link(*last_filter, *pad_idx, ctx, 0);
295  if (ret < 0)
296  return ret;
297 
298  *last_filter = ctx;
299  *pad_idx = 0;
300  return 0;
301 }
302 
304 {
305  char *pix_fmts;
306  OutputStream *ost = ofilter->ost;
307  OutputFile *of = output_files[ost->file_index];
308  AVFilterContext *last_filter = out->filter_ctx;
309  int pad_idx = out->pad_idx;
310  int ret;
311  char name[255];
312 
313  snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
314  ret = avfilter_graph_create_filter(&ofilter->filter,
315  avfilter_get_by_name("buffersink"),
316  name, NULL, NULL, fg->graph);
317  if (ret < 0)
318  return ret;
319 
320  if (ofilter->width || ofilter->height) {
321  char args[255];
323 
324  snprintf(args, sizeof(args), "%d:%d:0x%X",
325  ofilter->width, ofilter->height,
326  (unsigned)ost->sws_flags);
327  snprintf(name, sizeof(name), "scaler for output stream %d:%d",
328  ost->file_index, ost->index);
329  if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
330  name, args, NULL, fg->graph)) < 0)
331  return ret;
332  if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
333  return ret;
334 
335  last_filter = filter;
336  pad_idx = 0;
337  }
338 
339  if ((pix_fmts = choose_pix_fmts(ofilter))) {
341  snprintf(name, sizeof(name), "pixel format for output stream %d:%d",
342  ost->file_index, ost->index);
343  ret = avfilter_graph_create_filter(&filter,
344  avfilter_get_by_name("format"),
345  "format", pix_fmts, NULL, fg->graph);
346  av_freep(&pix_fmts);
347  if (ret < 0)
348  return ret;
349  if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
350  return ret;
351 
352  last_filter = filter;
353  pad_idx = 0;
354  }
355 
356  if (ost->frame_rate.num) {
357  AVFilterContext *fps;
358  char args[255];
359 
360  snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num,
361  ost->frame_rate.den);
362  snprintf(name, sizeof(name), "fps for output stream %d:%d",
363  ost->file_index, ost->index);
365  name, args, NULL, fg->graph);
366  if (ret < 0)
367  return ret;
368 
369  ret = avfilter_link(last_filter, pad_idx, fps, 0);
370  if (ret < 0)
371  return ret;
372  last_filter = fps;
373  pad_idx = 0;
374  }
375 
376  snprintf(name, sizeof(name), "trim for output stream %d:%d",
377  ost->file_index, ost->index);
378  ret = insert_trim(of->start_time, of->recording_time,
379  &last_filter, &pad_idx, name);
380  if (ret < 0)
381  return ret;
382 
383 
384  if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
385  return ret;
386 
387  return 0;
388 }
389 
391 {
392  OutputStream *ost = ofilter->ost;
393  OutputFile *of = output_files[ost->file_index];
394  AVCodecContext *codec = ost->enc_ctx;
395  AVFilterContext *last_filter = out->filter_ctx;
396  int pad_idx = out->pad_idx;
397  char *sample_fmts, *sample_rates, *channel_layouts;
398  char name[255];
399  int ret;
400 
401 
402  snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
403  ret = avfilter_graph_create_filter(&ofilter->filter,
404  avfilter_get_by_name("abuffersink"),
405  name, NULL, NULL, fg->graph);
406  if (ret < 0)
407  return ret;
408 
409  if (codec->channels && !codec->channel_layout)
411 
412  sample_fmts = choose_sample_fmts(ofilter);
413  sample_rates = choose_sample_rates(ofilter);
414  channel_layouts = choose_channel_layouts(ofilter);
415  if (sample_fmts || sample_rates || channel_layouts) {
417  char args[256];
418  int len = 0;
419 
420  if (sample_fmts)
421  len += snprintf(args + len, sizeof(args) - len, "sample_fmts=%s:",
422  sample_fmts);
423  if (sample_rates)
424  len += snprintf(args + len, sizeof(args) - len, "sample_rates=%s:",
425  sample_rates);
426  if (channel_layouts)
427  len += snprintf(args + len, sizeof(args) - len, "channel_layouts=%s:",
428  channel_layouts);
429  args[len - 1] = 0;
430 
431  av_freep(&sample_fmts);
432  av_freep(&sample_rates);
433  av_freep(&channel_layouts);
434 
435  snprintf(name, sizeof(name), "audio format for output stream %d:%d",
436  ost->file_index, ost->index);
437  ret = avfilter_graph_create_filter(&format,
438  avfilter_get_by_name("aformat"),
439  name, args, NULL, fg->graph);
440  if (ret < 0)
441  return ret;
442 
443  ret = avfilter_link(last_filter, pad_idx, format, 0);
444  if (ret < 0)
445  return ret;
446 
447  last_filter = format;
448  pad_idx = 0;
449  }
450 
451  snprintf(name, sizeof(name), "trim for output stream %d:%d",
452  ost->file_index, ost->index);
453  ret = insert_trim(of->start_time, of->recording_time,
454  &last_filter, &pad_idx, name);
455  if (ret < 0)
456  return ret;
457 
458  if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
459  return ret;
460 
461  return 0;
462 }
463 
464 #define DESCRIBE_FILTER_LINK(f, inout, in) \
465 { \
466  AVFilterContext *ctx = inout->filter_ctx; \
467  AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
468  int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; \
469  AVIOContext *pb; \
470  \
471  if (avio_open_dyn_buf(&pb) < 0) \
472  exit(1); \
473  \
474  avio_printf(pb, "%s", ctx->filter->name); \
475  if (nb_pads > 1) \
476  avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
477  avio_w8(pb, 0); \
478  avio_close_dyn_buf(pb, &f->name); \
479 }
480 
482 {
483  av_freep(&ofilter->name);
484  DESCRIBE_FILTER_LINK(ofilter, out, 0);
485 
486  switch (avfilter_pad_get_type(out->filter_ctx->output_pads, out->pad_idx)) {
487  case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fg, ofilter, out);
488  case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fg, ofilter, out);
489  default: av_assert0(0);
490  }
491 }
492 
494  AVFilterInOut *in)
495 {
496  AVFilterContext *last_filter;
497  const AVFilter *buffer_filt = avfilter_get_by_name("buffer");
498  InputStream *ist = ifilter->ist;
499  InputFile *f = input_files[ist->file_index];
500  AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) :
501  ist->st->time_base;
503  char name[255];
504  int ret, pad_idx = 0;
505 
506  snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
507  ist->file_index, ist->st->index);
508 
509  ifilter->filter = avfilter_graph_alloc_filter(fg->graph, buffer_filt, name);
510  if (!ifilter->filter)
511  return AVERROR(ENOMEM);
512 
514  if (!par)
515  return AVERROR(ENOMEM);
516 
518  par->width = ifilter->width;
519  par->height = ifilter->height;
520  par->format = ifilter->format;
521  par->time_base = tb;
522  if (ist->framerate.num)
523  par->frame_rate = ist->framerate;
524  par->hw_frames_ctx = ifilter->hw_frames_ctx;
525 
526  ret = av_buffersrc_parameters_set(ifilter->filter, par);
527  av_freep(&par);
528  if (ret < 0)
529  return ret;
530 
531  ret = avfilter_init_str(ifilter->filter, NULL);
532  if (ret < 0)
533  return ret;
534 
535  last_filter = ifilter->filter;
536 
537  if (ist->autorotate) {
538  uint8_t* displaymatrix = av_stream_get_side_data(ist->st,
540  if (displaymatrix) {
541  double rot = av_display_rotation_get((int32_t*) displaymatrix);
542  if (rot < -135 || rot > 135) {
543  ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
544  if (ret < 0)
545  return ret;
546  ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
547  } else if (rot < -45) {
548  ret = insert_filter(&last_filter, &pad_idx, "transpose", "dir=clock");
549  } else if (rot > 45) {
550  ret = insert_filter(&last_filter, &pad_idx, "transpose", "dir=cclock");
551  }
552  if (ret < 0)
553  return ret;
554  }
555  }
556 
557  snprintf(name, sizeof(name), "trim for input stream %d:%d",
558  ist->file_index, ist->st->index);
559  ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
560  AV_NOPTS_VALUE : 0, f->recording_time, &last_filter, &pad_idx, name);
561  if (ret < 0)
562  return ret;
563 
564  if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
565  return ret;
566  return 0;
567 }
568 
570  AVFilterInOut *in)
571 {
572  AVFilterContext *last_filter;
573  const AVFilter *abuffer_filt = avfilter_get_by_name("abuffer");
574  InputStream *ist = ifilter->ist;
575  InputFile *f = input_files[ist->file_index];
577  char args[255], name[255];
578  int ret, pad_idx = 0;
579 
580  snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
581  ist->file_index, ist->st->index);
582 
583  ifilter->filter = avfilter_graph_alloc_filter(fg->graph, abuffer_filt, name);
584  if (!ifilter->filter)
585  return AVERROR(ENOMEM);
586 
588  if (!par)
589  return AVERROR(ENOMEM);
590 
591  par->time_base = (AVRational){ 1, ifilter->sample_rate };
592  par->sample_rate = ifilter->sample_rate;
593  par->format = ifilter->format;
594  par->channel_layout = ifilter->channel_layout;
595 
596  ret = av_buffersrc_parameters_set(ifilter->filter, par);
597  av_freep(&par);
598  if (ret < 0)
599  return ret;
600 
601  ret = avfilter_init_str(ifilter->filter, NULL);
602  if (ret < 0)
603  return ret;
604  last_filter = ifilter->filter;
605 
606  if (audio_sync_method > 0) {
607  AVFilterContext *async;
608  int len = 0;
609 
610  av_log(NULL, AV_LOG_WARNING, "-async has been deprecated. Used the "
611  "asyncts audio filter instead.\n");
612 
613  if (audio_sync_method > 1)
614  len += snprintf(args + len, sizeof(args) - len, "compensate=1:"
615  "max_comp=%d:", audio_sync_method);
616  snprintf(args + len, sizeof(args) - len, "min_delta=%f",
618 
619  snprintf(name, sizeof(name), "graph %d audio sync for input stream %d:%d",
620  fg->index, ist->file_index, ist->st->index);
621  ret = avfilter_graph_create_filter(&async,
622  avfilter_get_by_name("asyncts"),
623  name, args, NULL, fg->graph);
624  if (ret < 0)
625  return ret;
626 
627  ret = avfilter_link(last_filter, 0, async, 0);
628  if (ret < 0)
629  return ret;
630 
631  last_filter = async;
632  }
633  if (audio_volume != 256) {
634  AVFilterContext *volume;
635 
636  av_log(NULL, AV_LOG_WARNING, "-vol has been deprecated. Use the volume "
637  "audio filter instead.\n");
638 
639  snprintf(args, sizeof(args), "volume=%f", audio_volume / 256.0);
640 
641  snprintf(name, sizeof(name), "graph %d volume for input stream %d:%d",
642  fg->index, ist->file_index, ist->st->index);
643  ret = avfilter_graph_create_filter(&volume,
644  avfilter_get_by_name("volume"),
645  name, args, NULL, fg->graph);
646  if (ret < 0)
647  return ret;
648 
649  ret = avfilter_link(last_filter, 0, volume, 0);
650  if (ret < 0)
651  return ret;
652 
653  last_filter = volume;
654  }
655 
656  snprintf(name, sizeof(name), "trim for input stream %d:%d",
657  ist->file_index, ist->st->index);
658  ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
659  AV_NOPTS_VALUE : 0, f->recording_time, &last_filter, &pad_idx, name);
660  if (ret < 0)
661  return ret;
662 
663  if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
664  return ret;
665 
666  return 0;
667 }
668 
670  AVFilterInOut *in)
671 {
672  av_freep(&ifilter->name);
673  DESCRIBE_FILTER_LINK(ifilter, in, 1);
674 
675  switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) {
676  case AVMEDIA_TYPE_VIDEO: return configure_input_video_filter(fg, ifilter, in);
677  case AVMEDIA_TYPE_AUDIO: return configure_input_audio_filter(fg, ifilter, in);
678  default: av_assert0(0);
679  }
680 }
681 
683 {
684  AVFilterInOut *inputs, *outputs, *cur;
685  int ret, i, simple = filtergraph_is_simple(fg);
686  const char *graph_desc = simple ? fg->outputs[0]->ost->avfilter :
687  fg->graph_desc;
688 
690  if (!(fg->graph = avfilter_graph_alloc()))
691  return AVERROR(ENOMEM);
692 
693  if (simple) {
694  OutputStream *ost = fg->outputs[0]->ost;
695  char args[512];
696  AVDictionaryEntry *e = NULL;
697 
698  snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
699  fg->graph->scale_sws_opts = av_strdup(args);
700 
701  args[0] = '\0';
702  while ((e = av_dict_get(fg->outputs[0]->ost->resample_opts, "", e,
704  av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
705  }
706  if (strlen(args))
707  args[strlen(args) - 1] = '\0';
708  fg->graph->resample_lavr_opts = av_strdup(args);
709  }
710 
711  if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
712  return ret;
713 
714  if (hw_device_ctx) {
715  for (i = 0; i < fg->graph->nb_filters; i++) {
717  }
718  }
719 
720  if (simple && (!inputs || inputs->next || !outputs || outputs->next)) {
721  av_log(NULL, AV_LOG_ERROR, "Simple filtergraph '%s' does not have "
722  "exactly one input and output.\n", graph_desc);
723  return AVERROR(EINVAL);
724  }
725 
726  for (cur = inputs, i = 0; cur; cur = cur->next, i++)
727  if ((ret = configure_input_filter(fg, fg->inputs[i], cur)) < 0)
728  return ret;
729  avfilter_inout_free(&inputs);
730 
731  for (cur = outputs, i = 0; cur; cur = cur->next, i++) {
732  OutputFilter *ofilter = fg->outputs[i];
733  if (ofilter->ost)
734  configure_output_filter(fg, ofilter, cur);
735  }
736 
737  avfilter_inout_free(&outputs);
738 
739  if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
740  return ret;
741 
742  /* limit the lists of allowed formats to the ones selected, to
743  * make sure they stay the same if the filtergraph is reconfigured later */
744  for (i = 0; i < fg->nb_outputs; i++) {
745  OutputFilter *ofilter = fg->outputs[i];
746  AVFilterLink *link = ofilter->filter->inputs[0];
747 
748  ofilter->format = link->format;
749 
750  ofilter->width = link->w;
751  ofilter->height = link->h;
752 
753  ofilter->sample_rate = link->sample_rate;
754  ofilter->channel_layout = link->channel_layout;
755  }
756 
757  for (i = 0; i < fg->nb_inputs; i++) {
758  while (av_fifo_size(fg->inputs[i]->frame_queue)) {
759  AVFrame *tmp;
760  av_fifo_generic_read(fg->inputs[i]->frame_queue, &tmp, sizeof(tmp), NULL);
761  ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp);
762  av_frame_free(&tmp);
763  if (ret < 0)
764  return ret;
765  }
766  }
767 
768  /* send the EOFs for the finished inputs */
769  for (i = 0; i < fg->nb_inputs; i++) {
770  if (fg->inputs[i]->eof) {
771  ret = av_buffersrc_add_frame(fg->inputs[i]->filter, NULL);
772  if (ret < 0)
773  return ret;
774  }
775  }
776 
777  return 0;
778 }
779 
781 {
782  av_buffer_unref(&ifilter->hw_frames_ctx);
783 
784  ifilter->format = frame->format;
785 
786  ifilter->width = frame->width;
787  ifilter->height = frame->height;
788  ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
789 
790  ifilter->sample_rate = frame->sample_rate;
791  ifilter->channel_layout = frame->channel_layout;
792 
793  if (frame->hw_frames_ctx) {
794  ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);
795  if (!ifilter->hw_frames_ctx)
796  return AVERROR(ENOMEM);
797  }
798 
799  return 0;
800 }
801 
803 {
804  int i;
805  for (i = 0; i < fg->nb_inputs; i++)
806  if (fg->inputs[i]->ist == ist)
807  return 1;
808  return 0;
809 }
810 
812 {
813  return !fg->graph_desc;
814 }
static int insert_filter(AVFilterContext **last_filter, int *pad_idx, const char *filter_name, const char *args)
AVFilterContext ** filters
Definition: avfilter.h:605
uint64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
int nb_input_files
Definition: avconv.c:100
int width
Definition: avconv.h:230
int64_t recording_time
Definition: avconv.h:433
int nb_input_streams
Definition: avconv.c:98
uint8_t * name
Definition: avconv.h:223
int nb_outputs
Definition: avconv.h:251
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
Definition: buffer.c:106
This structure describes decoded (raw) audio or video data.
Definition: frame.h:140
AVRational frame_rate
Definition: avconv.h:374
int accurate_seek
Definition: avconv.h:330
static const char * filter_name(void *p)
Definition: avfilter.c:351
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
Definition: avfiltergraph.c:71
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:130
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:259
Main libavfilter public API header.
Memory buffer source API.
AVRational framerate
Definition: avconv.h:281
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
Definition: graphparser.c:214
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
Definition: avfilter.h:758
int height
Definition: avconv.h:208
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
Definition: cmdutils.c:1492
AVFilterInOut * out_tmp
Definition: avconv.h:226
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
Definition: avfilter.c:737
int decoding_needed
Definition: avconv.h:258
int num
numerator
Definition: rational.h:44
int index
stream index in AVFormatContext
Definition: avformat.h:706
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
static enum AVSampleFormat formats[]
Definition: avresample.c:163
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in...
Definition: avfilter.h:311
uint8_t * av_stream_get_side_data(AVStream *stream, enum AVPacketSideDataType type, int *size)
Get side information from stream.
Definition: utils.c:3265
FilterGraph ** filtergraphs
Definition: avconv.c:107
AVRational frame_rate
Video only, the frame rate of the input video.
Definition: buffersrc.h:70
int64_t start_time
Definition: avconv.h:434
int index
Definition: avconv.h:243
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
Definition: avfilter.h:608
struct FilterGraph * graph
Definition: avconv.h:200
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:202
int configure_filtergraph(FilterGraph *fg)
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame...
Definition: frame.h:365
Format I/O context.
Definition: avformat.h:940
struct InputStream * ist
Definition: avconv.h:199
AVRational sample_aspect_ratio
Video only, the sample (pixel) aspect ratio.
Definition: buffersrc.h:62
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:270
char * name
name of this filter instance
Definition: avfilter.h:267
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
AVFilterGraph * graph
Definition: avconv.h:246
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
Definition: avfilter.c:77
AVFilterPad * output_pads
array of output pads
Definition: avfilter.h:273
uint8_t
float audio_drift_threshold
Definition: avconv_opt.c:81
AVOptions.
InputFile ** input_files
Definition: avconv.c:99
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: avcodec.h:1254
AVRational time_base
The timebase to be used for the timestamps on the input frames.
Definition: buffersrc.h:52
#define DESCRIBE_FILTER_LINK(f, inout, in)
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1008
int64_t duration
Definition: movenc.c:63
int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
Definition: opt.c:312
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
Create and add a filter instance into an existing graph.
char * resample_lavr_opts
libavresample options to use for the auto-inserted resample filters
Definition: avfilter.h:609
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:38
AVDictionary * resample_opts
Definition: avconv.h:394
AVFilterContext * filter
Definition: avconv.h:220
int sample_rate
Audio only, the audio sampling rate in samples per secon.
Definition: buffersrc.h:81
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
Add a graph described by a string to a graph.
Definition: graphparser.c:418
int file_index
Definition: avconv.h:255
uint64_t channel_layout
Definition: avconv.h:234
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:269
AVRational sample_aspect_ratio
Definition: avconv.h:209
static int64_t start_time
Definition: avplay.c:245
static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
int width
width and height of the video frame
Definition: frame.h:179
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:124
#define GET_CH_LAYOUT_NAME(ch_layout)
Definition: cmdutils.h:538
int sample_rate
Definition: avconv.h:211
AVFilterContext * filter
Definition: avconv.h:198
#define AVERROR(e)
Definition: error.h:43
int format
Definition: avconv.h:206
uint64_t channel_layout
Audio only, the audio channel layout.
Definition: buffersrc.h:86
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:80
int64_t sws_flags
Definition: avconv.h:392
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
Definition: fifo.c:107
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3479
simple assert() macros that are a bit more flexible than ISO C assert().
int eof
Definition: avconv.h:216
int format
video: the pixel format, value corresponds to enum AVPixelFormat audio: the sample format...
Definition: buffersrc.h:48
static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
#define fail()
Definition: checkasm.h:80
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2203
uint64_t channel_layout
Channel layout of the audio data.
Definition: frame.h:294
AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
Definition: avfilter.c:299
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
Definition: mpegaudioenc.c:307
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:996
int nb_filtergraphs
Definition: avconv.c:108
#define DEF_CHOOSE_FORMAT(suffix, type, var, supported_list, none, get_name)
Definition: avconv_filter.c:41
const char * name
Definition: qsvenc.c:44
audio channel layout utility functions
This structure contains the parameters describing the frames that will be passed to this filter...
Definition: buffersrc.h:43
static int insert_trim(int64_t start_time, int64_t duration, AVFilterContext **last_filter, int *pad_idx, const char *filter_name)
external API header
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:383
struct OutputStream * ost
Definition: avconv.h:221
#define GET_PIX_FMT_NAME(pix_fmt)
Definition: cmdutils.h:528
int width
Definition: avconv.h:208
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
int height
Definition: avconv.h:230
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
int sample_rate
Definition: avconv.h:233
AVBufferRef * hw_device_ctx
Definition: avconv_opt.c:77
#define GET_SAMPLE_FMT_NAME(sample_fmt)
Definition: cmdutils.h:531
AVFilterContext * filter_ctx
filter context associated to this input/output
Definition: avfilter.h:752
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
Definition: cmdutils.c:94
int avfilter_init_str(AVFilterContext *filter, const char *args)
Initialize a filter with the supplied parameters.
Definition: avfilter.c:615
Stream structure.
Definition: avformat.h:705
A linked-list of the inputs/outputs of the filter chain.
Definition: avfilter.h:747
int audio_sync_method
Definition: avconv_opt.c:85
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:191
InputFilter ** filters
Definition: avconv.h:287
#define GET_SAMPLE_RATE_NAME(rate)
Definition: cmdutils.h:534
int64_t recording_time
Definition: avconv.h:326
AVBufferRef * hw_frames_ctx
Video with a hwaccel pixel format only.
Definition: buffersrc.h:76
NULL
Definition: eval.c:55
AVStream * st
Definition: avconv.h:256
int init_complex_filtergraph(FilterGraph *fg)
OutputFile ** output_files
Definition: avconv.c:104
enum AVMediaType codec_type
Definition: avcodec.h:1417
AVSampleFormat
Audio Sample Formats.
Definition: samplefmt.h:60
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:219
int ist_index
Definition: avconv.h:319
const char * graph_desc
Definition: avconv.h:244
int64_t start_time
Definition: avconv.h:325
main external API structure.
Definition: avcodec.h:1409
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:206
AVCodecContext * enc_ctx
Definition: avconv.h:366
int filtergraph_is_simple(FilterGraph *fg)
AVBufferRef * hw_frames_ctx
Definition: avconv.h:214
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
const char * format
Definition: movenc.c:47
int sample_rate
Sample rate of the audio data.
Definition: frame.h:289
Filter definition.
Definition: avfilter.h:120
static const AVFilterPad inputs[]
Definition: af_ashowinfo.c:248
int pad_idx
index of the filt_ctx pad to use for linking
Definition: avfilter.h:755
rational number numerator/denominator
Definition: rational.h:43
int file_index
Definition: avconv.h:343
AVCodecContext * dec_ctx
Definition: avconv.h:259
AVMediaType
Definition: avutil.h:192
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:99
unsigned nb_filters
Definition: avfilter.h:606
int autorotate
Definition: avconv.h:283
int attribute_align_arg av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
Add a frame to the buffer source.
Definition: buffersrc.c:152
static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:257
char * name
unique name for this input/output in the list
Definition: avfilter.h:749
int nb_filters
Definition: avconv.h:288
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:122
#define AVERROR_FILTER_NOT_FOUND
Filter not found.
Definition: error.h:53
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
int av_fifo_size(AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
Definition: fifo.c:52
struct FilterGraph * graph
Definition: avconv.h:222
InputStream ** input_streams
Definition: avconv.c:97
int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *param)
Initialize the buffersrc or abuffersrc filter with the provided parameters.
Definition: buffersrc.c:92
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:92
static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
char * key
Definition: dict.h:73
int den
denominator
Definition: rational.h:45
uint64_t channel_layout
Definition: avconv.h:212
double av_display_rotation_get(const int32_t matrix[9])
The display transformation matrix specifies an affine transformation that should be applied to video ...
Definition: display.c:34
AVFormatContext * ctx
Definition: avconv.h:316
#define GROW_ARRAY(array, nb_elems)
Definition: cmdutils.h:525
pixel format definitions
char * avfilter
Definition: avconv.h:390
uint8_t * name
Definition: avconv.h:201
char * value
Definition: dict.h:74
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
Definition: fifo.c:25
int audio_volume
Definition: avconv_opt.c:84
int len
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
int channels
number of audio channels
Definition: avcodec.h:2153
static uint8_t tmp[8]
Definition: des.c:38
OutputFilter ** outputs
Definition: avconv.h:250
int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
AVBufferSrcParameters * av_buffersrc_parameters_alloc(void)
Allocate a new AVBufferSrcParameters instance.
Definition: buffersrc.c:81
An instance of a filter.
Definition: avfilter.h:262
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:700
int height
Definition: frame.h:179
FILE * out
Definition: movenc.c:54
InputFilter ** inputs
Definition: avconv.h:248
#define AV_DICT_IGNORE_SUFFIX
Definition: dict.h:60
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:118
AVCodecParameters * codecpar
Definition: avformat.h:831
int width
Video only, the display dimensions of the input frames.
Definition: buffersrc.h:57
int format
Definition: avconv.h:232
int discard
Definition: avconv.h:257
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:742
int nb_inputs
Definition: avconv.h:249
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
Definition: avformat.h:763
int index
Definition: avconv.h:344
AVPixelFormat
Pixel format.
Definition: pixfmt.h:57
enum AVMediaType type
Definition: avconv.h:227
AVFifoBuffer * frame_queue
Definition: avconv.h:203
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:211
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:235
discard nothing
Definition: avcodec.h:684
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist)