History

Merge remote-tracking branch 'qatar/master'

* qatar/master: rtmp: Add a new option 'rtmp_buffer', for setting the client buffer time rtmp: Set the client buffer time to 3s instead of 0.26s rtmp: Handle server bandwidth packets rtmp: Display a verbose message when an unknown packet type is received lavfi/audio: use av_samples_copy() instead of custom code. configure: add all filters hardcoded into avconv to avconv_deps avfiltergraph: remove a redundant call to avfilter_get_by_name(). lavfi: allow building without swscale. build: Do not delete tests/vsynth2 directory, which is no longer created. lavfi: replace AVFilterContext.input/output_count with nb_inputs/outputs lavfi: make AVFilterPad opaque after two major bumps. lavfi: add avfilter_pad_get_type() and avfilter_pad_get_name(). lavfi: make avfilter_get_video_buffer() private on next bump. jack: update to new latency range API as the old one has been deprecated rtmp: Tokenize the AMF connection parameters manually instead of using strtok_r ppc: Rename H.264 optimization template file for consistency. lavfi: add channelsplit audio filter. golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls() sws: fix planar RGB input conversions for 9/10/16 bpp. Conflicts: Changelog configure doc/APIchanges ffmpeg.c libavcodec/golomb.h libavcodec/v210dec.h libavfilter/Makefile libavfilter/allfilters.c libavfilter/asrc_anullsrc.c libavfilter/audio.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/buffersrc.c libavfilter/formats.c libavfilter/version.h libavfilter/vf_frei0r.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/video.h libavfilter/vsrc_color.c libavformat/rtmpproto.c libswscale/input.c tests/Makefile

Michael Niedermayer committed 14 years ago

Commit c7b9eab2 parents 4a6d790 8517e9c68 files · +757 −220Browse files

Showing the changes to libavfilter/avfiltergraph.c (1 of 68 files). Show all

Unified · Split

libavfilter/avfiltergraph.c+39−35
@@ -118,7 +118,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) · 117 unmodified lines
118 for (i = 0; i < graph->filter_count; i++) {118 for (i = 0; i < graph->filter_count; i++) {
119 filt = graph->filters[i];119 filt = graph->filters[i];
120 120
121 for (j = 0; j < filt->input_count; j++) {121 for (j = 0; j < filt->nb_inputs; j++) {
122 if (!filt->inputs[j] || !filt->inputs[j]->src) {122 if (!filt->inputs[j] || !filt->inputs[j]->src) {
123 av_log(log_ctx, AV_LOG_ERROR,123 av_log(log_ctx, AV_LOG_ERROR,
124 "Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",124 "Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",
@@ -127,7 +127,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) · 2 unmodified lines
127 }127 }
128 }128 }
129 129
130 for (j = 0; j < filt->output_count; j++) {130 for (j = 0; j < filt->nb_outputs; j++) {
131 if (!filt->outputs[j] || !filt->outputs[j]->dst) {131 if (!filt->outputs[j] || !filt->outputs[j]->dst) {
132 av_log(log_ctx, AV_LOG_ERROR,132 av_log(log_ctx, AV_LOG_ERROR,
133 "Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",133 "Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",
@@ -153,7 +153,7 @@ static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx) · 19 unmodified lines
153 for (i=0; i < graph->filter_count; i++) {153 for (i=0; i < graph->filter_count; i++) {
154 filt = graph->filters[i];154 filt = graph->filters[i];
155 155
156 if (!filt->output_count) {156 if (!filt->nb_outputs) {
157 if ((ret = avfilter_config_links(filt)))157 if ((ret = avfilter_config_links(filt)))
158 return ret;158 return ret;
159 }159 }
@@ -271,7 +271,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 111 unmodified lines
271 /* Call query_formats on sources first.271 /* Call query_formats on sources first.
272 This is a temporary workaround for amerge,272 This is a temporary workaround for amerge,
273 until format renegociation is implemented. */273 until format renegociation is implemented. */
274 if (!graph->filters[i]->input_count == j)274 if (!graph->filters[i]->nb_inputs == j)
275 continue;275 continue;
276 if (graph->filters[i]->filter->query_formats)276 if (graph->filters[i]->filter->query_formats)
277 ret = filter_query_formats(graph->filters[i]);277 ret = filter_query_formats(graph->filters[i]);
@@ -286,7 +286,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 8 unmodified lines
286 for (i = 0; i < graph->filter_count; i++) {286 for (i = 0; i < graph->filter_count; i++) {
287 AVFilterContext *filter = graph->filters[i];287 AVFilterContext *filter = graph->filters[i];
288 288
289 for (j = 0; j < filter->input_count; j++) {289 for (j = 0; j < filter->nb_inputs; j++) {
290 AVFilterLink *link = filter->inputs[j];290 AVFilterLink *link = filter->inputs[j];
291#if 0291#if 0
292 if (!link) continue;292 if (!link) continue;
@@ -348,11 +348,16 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 55 unmodified lines
348 /* couldn't merge format lists. auto-insert conversion filter */348 /* couldn't merge format lists. auto-insert conversion filter */
349 switch (link->type) {349 switch (link->type) {
350 case AVMEDIA_TYPE_VIDEO:350 case AVMEDIA_TYPE_VIDEO:
351 if (!(filter = avfilter_get_by_name("scale"))) {
352 av_log(log_ctx, AV_LOG_ERROR, "'scale' filter "
353 "not present, cannot convert pixel formats.\n");
354 return AVERROR(EINVAL);
355 }
356
351 snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",357 snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
352 scaler_count++);358 scaler_count++);
353 snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);359 snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
354 if ((ret = avfilter_graph_create_filter(&convert,360 if ((ret = avfilter_graph_create_filter(&convert, filter,
355 avfilter_get_by_name("scale"),
356 inst_name, scale_args, NULL,361 inst_name, scale_args, NULL,
357 graph)) < 0)362 graph)) < 0)
358 return ret;363 return ret;
@@ -366,8 +371,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 7 unmodified lines
366 371
367 snprintf(inst_name, sizeof(inst_name), "auto-inserted resampler %d",372 snprintf(inst_name, sizeof(inst_name), "auto-inserted resampler %d",
368 resampler_count++);373 resampler_count++);
369 if ((ret = avfilter_graph_create_filter(&convert,374 if ((ret = avfilter_graph_create_filter(&convert, filter,
370 avfilter_get_by_name("aresample"),
371 inst_name, NULL, NULL, graph)) < 0)375 inst_name, NULL, NULL, graph)) < 0)
372 return ret;376 return ret;
373 break;377 break;
@@ -464,7 +468,7 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref) · 90 unmodified lines
464 468
465#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \469#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \
466do { \470do { \
467 for (i = 0; i < filter->input_count; i++) { \471 for (i = 0; i < filter->nb_inputs; i++) { \
468 AVFilterLink *link = filter->inputs[i]; \472 AVFilterLink *link = filter->inputs[i]; \
469 fmt_type fmt; \473 fmt_type fmt; \
470 \474 \
@@ -472,7 +476,7 @@ do { \ · 1 unmodified line
472 continue; \476 continue; \
473 fmt = link->out_ ## list->var[0]; \477 fmt = link->out_ ## list->var[0]; \
474 \478 \
475 for (j = 0; j < filter->output_count; j++) { \479 for (j = 0; j < filter->nb_outputs; j++) { \
476 AVFilterLink *out_link = filter->outputs[j]; \480 AVFilterLink *out_link = filter->outputs[j]; \
477 list_type *fmts; \481 list_type *fmts; \
478 \482 \
@@ -529,19 +533,19 @@ static void swap_samplerates_on_filter(AVFilterContext *filter) · 50 unmodified lines
529 int sample_rate;533 int sample_rate;
530 int i, j;534 int i, j;
531 535
532 for (i = 0; i < filter->input_count; i++) {536 for (i = 0; i < filter->nb_inputs; i++) {
533 link = filter->inputs[i];537 link = filter->inputs[i];
534 538
535 if (link->type == AVMEDIA_TYPE_AUDIO &&539 if (link->type == AVMEDIA_TYPE_AUDIO &&
536 link->out_samplerates->format_count == 1)540 link->out_samplerates->format_count == 1)
537 break;541 break;
538 }542 }
539 if (i == filter->input_count)543 if (i == filter->nb_inputs)
540 return;544 return;
541 545
542 sample_rate = link->out_samplerates->formats[0];546 sample_rate = link->out_samplerates->formats[0];
543 547
544 for (i = 0; i < filter->output_count; i++) {548 for (i = 0; i < filter->nb_outputs; i++) {
545 AVFilterLink *outlink = filter->outputs[i];549 AVFilterLink *outlink = filter->outputs[i];
546 int best_idx, best_diff = INT_MAX;550 int best_idx, best_diff = INT_MAX;
547 551
@@ -576,19 +580,19 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter) · 28 unmodified lines
576 uint64_t chlayout;580 uint64_t chlayout;
577 int i, j;581 int i, j;
578 582
579 for (i = 0; i < filter->input_count; i++) {583 for (i = 0; i < filter->nb_inputs; i++) {
580 link = filter->inputs[i];584 link = filter->inputs[i];
581 585
582 if (link->type == AVMEDIA_TYPE_AUDIO &&586 if (link->type == AVMEDIA_TYPE_AUDIO &&
583 link->out_channel_layouts->nb_channel_layouts == 1)587 link->out_channel_layouts->nb_channel_layouts == 1)
584 break;588 break;
585 }589 }
586 if (i == filter->input_count)590 if (i == filter->nb_inputs)
587 return;591 return;
588 592
589 chlayout = link->out_channel_layouts->channel_layouts[0];593 chlayout = link->out_channel_layouts->channel_layouts[0];
590 594
591 for (i = 0; i < filter->output_count; i++) {595 for (i = 0; i < filter->nb_outputs; i++) {
592 AVFilterLink *outlink = filter->outputs[i];596 AVFilterLink *outlink = filter->outputs[i];
593 int best_idx, best_score = INT_MIN;597 int best_idx, best_score = INT_MIN;
594 598
@@ -629,20 +633,20 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter) · 34 unmodified lines
629 int format, bps;633 int format, bps;
630 int i, j;634 int i, j;
631 635
632 for (i = 0; i < filter->input_count; i++) {636 for (i = 0; i < filter->nb_inputs; i++) {
633 link = filter->inputs[i];637 link = filter->inputs[i];
634 638
635 if (link->type == AVMEDIA_TYPE_AUDIO &&639 if (link->type == AVMEDIA_TYPE_AUDIO &&
636 link->out_formats->format_count == 1)640 link->out_formats->format_count == 1)
637 break;641 break;
638 }642 }
639 if (i == filter->input_count)643 if (i == filter->nb_inputs)
640 return;644 return;
641 645
642 format = link->out_formats->formats[0];646 format = link->out_formats->formats[0];
643 bps = av_get_bytes_per_sample(format);647 bps = av_get_bytes_per_sample(format);
644 648
645 for (i = 0; i < filter->output_count; i++) {649 for (i = 0; i < filter->nb_outputs; i++) {
646 AVFilterLink *outlink = filter->outputs[i];650 AVFilterLink *outlink = filter->outputs[i];
647 int best_idx, best_score = INT_MIN;651 int best_idx, best_score = INT_MIN;
648 652
@@ -700,24 +704,24 @@ static int pick_formats(AVFilterGraph *graph) · 51 unmodified lines
700 change = 0;704 change = 0;
701 for (i = 0; i < graph->filter_count; i++) {705 for (i = 0; i < graph->filter_count; i++) {
702 AVFilterContext *filter = graph->filters[i];706 AVFilterContext *filter = graph->filters[i];
703 if (filter->input_count){707 if (filter->nb_inputs){
704 for (j = 0; j < filter->input_count; j++){708 for (j = 0; j < filter->nb_inputs; j++){
705 if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->format_count == 1) {709 if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->format_count == 1) {
706 pick_format(filter->inputs[j], NULL);710 pick_format(filter->inputs[j], NULL);
707 change = 1;711 change = 1;
708 }712 }
709 }713 }
710 }714 }
711 if (filter->output_count){715 if (filter->nb_outputs){
712 for (j = 0; j < filter->output_count; j++){716 for (j = 0; j < filter->nb_outputs; j++){
713 if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->format_count == 1) {717 if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->format_count == 1) {
714 pick_format(filter->outputs[j], NULL);718 pick_format(filter->outputs[j], NULL);
715 change = 1;719 change = 1;
716 }720 }
717 }721 }
718 }722 }
719 if (filter->input_count && filter->output_count && filter->inputs[0]->format>=0) {723 if (filter->nb_inputs && filter->nb_outputs && filter->inputs[0]->format>=0) {
720 for (j = 0; j < filter->output_count; j++) {724 for (j = 0; j < filter->nb_outputs; j++) {
721 if(filter->outputs[j]->format<0) {725 if(filter->outputs[j]->format<0) {
722 pick_format(filter->outputs[j], filter->inputs[0]);726 pick_format(filter->outputs[j], filter->inputs[0]);
723 change = 1;727 change = 1;
@@ -730,10 +734,10 @@ static int pick_formats(AVFilterGraph *graph) · 6 unmodified lines
730 for (i = 0; i < graph->filter_count; i++) {734 for (i = 0; i < graph->filter_count; i++) {
731 AVFilterContext *filter = graph->filters[i];735 AVFilterContext *filter = graph->filters[i];
732 736
733 for (j = 0; j < filter->input_count; j++)737 for (j = 0; j < filter->nb_inputs; j++)
734 if ((ret = pick_format(filter->inputs[j], NULL)) < 0)738 if ((ret = pick_format(filter->inputs[j], NULL)) < 0)
735 return ret;739 return ret;
736 for (j = 0; j < filter->output_count; j++)740 for (j = 0; j < filter->nb_outputs; j++)
737 if ((ret = pick_format(filter->outputs[j], NULL)) < 0)741 if ((ret = pick_format(filter->outputs[j], NULL)) < 0)
738 return ret;742 return ret;
739 }743 }
@@ -778,18 +782,18 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph, · 38 unmodified lines
778 782
779 for (i = 0; i < graph->filter_count; i++) {783 for (i = 0; i < graph->filter_count; i++) {
780 f = graph->filters[i];784 f = graph->filters[i];
781 for (j = 0; j < f->input_count; j++) {785 for (j = 0; j < f->nb_inputs; j++) {
782 f->inputs[j]->graph = graph;786 f->inputs[j]->graph = graph;
783 f->inputs[j]->age_index = -1;787 f->inputs[j]->age_index = -1;
784 }788 }
785 for (j = 0; j < f->output_count; j++) {789 for (j = 0; j < f->nb_outputs; j++) {
786 f->outputs[j]->graph = graph;790 f->outputs[j]->graph = graph;
787 f->outputs[j]->age_index= -1;791 f->outputs[j]->age_index= -1;
788 }792 }
789 if (!f->output_count) {793 if (!f->nb_outputs) {
790 if (f->input_count > INT_MAX - sink_links_count)794 if (f->nb_inputs > INT_MAX - sink_links_count)
791 return AVERROR(EINVAL);795 return AVERROR(EINVAL);
792 sink_links_count += f->input_count;796 sink_links_count += f->nb_inputs;
793 }797 }
794 }798 }
795 sinks = av_calloc(sink_links_count, sizeof(*sinks));799 sinks = av_calloc(sink_links_count, sizeof(*sinks));
@@ -797,8 +801,8 @@ static int ff_avfilter_graph_config_pointers(AVFilterGraph *graph, · 1 unmodified line
797 return AVERROR(ENOMEM);801 return AVERROR(ENOMEM);
798 for (i = 0; i < graph->filter_count; i++) {802 for (i = 0; i < graph->filter_count; i++) {
799 f = graph->filters[i];803 f = graph->filters[i];
800 if (!f->output_count) {804 if (!f->nb_outputs) {
801 for (j = 0; j < f->input_count; j++) {805 for (j = 0; j < f->nb_inputs; j++) {
802 sinks[n] = f->inputs[j];806 sinks[n] = f->inputs[j];
803 f->inputs[j]->age_index = n++;807 f->inputs[j]->age_index = n++;
804 }808 }

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