| OLD | NEW |
| 1 /* | 1 /* |
| 2 * filter layer | 2 * filter layer |
| 3 * copyright (c) 2007 Bobby Bingham | 3 * copyright (c) 2007 Bobby Bingham |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 * FFmpeg is distributed in the hope that it will be useful, | 12 * FFmpeg is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Lesser General Public License for more details. | 15 * Lesser General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Lesser General Public | 17 * You should have received a copy of the GNU Lesser General Public |
| 18 * License along with FFmpeg; if not, write to the Free Software | 18 * License along with FFmpeg; if not, write to the Free Software |
| 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 /* #define DEBUG */ | 22 /* #define DEBUG */ |
| 23 | 23 |
| 24 #include "libavcodec/audioconvert.c" | 24 #include "libavcodec/audioconvert.c" |
| 25 #include "libavutil/pixdesc.h" | 25 #include "libavutil/pixdesc.h" |
| 26 #include "libavutil/rational.h" |
| 26 #include "libavcore/imgutils.h" | 27 #include "libavcore/imgutils.h" |
| 27 #include "avfilter.h" | 28 #include "avfilter.h" |
| 28 #include "internal.h" | 29 #include "internal.h" |
| 29 | 30 |
| 30 unsigned avfilter_version(void) { | 31 unsigned avfilter_version(void) { |
| 31 return LIBAVFILTER_VERSION_INT; | 32 return LIBAVFILTER_VERSION_INT; |
| 32 } | 33 } |
| 33 | 34 |
| 34 const char *avfilter_configuration(void) | 35 const char *avfilter_configuration(void) |
| 35 { | 36 { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 avfilter_formats_changeref(&link->out_formats, | 150 avfilter_formats_changeref(&link->out_formats, |
| 150 &filt->outputs[filt_dstpad_idx]->out_formats)
; | 151 &filt->outputs[filt_dstpad_idx]->out_formats)
; |
| 151 | 152 |
| 152 return 0; | 153 return 0; |
| 153 } | 154 } |
| 154 | 155 |
| 155 int avfilter_config_links(AVFilterContext *filter) | 156 int avfilter_config_links(AVFilterContext *filter) |
| 156 { | 157 { |
| 157 int (*config_link)(AVFilterLink *); | 158 int (*config_link)(AVFilterLink *); |
| 158 unsigned i; | 159 unsigned i; |
| 160 int ret; |
| 159 | 161 |
| 160 for (i = 0; i < filter->input_count; i ++) { | 162 for (i = 0; i < filter->input_count; i ++) { |
| 161 AVFilterLink *link = filter->inputs[i]; | 163 AVFilterLink *link = filter->inputs[i]; |
| 162 | 164 |
| 163 if (!link) continue; | 165 if (!link) continue; |
| 164 | 166 |
| 165 switch (link->init_state) { | 167 switch (link->init_state) { |
| 166 case AVLINK_INIT: | 168 case AVLINK_INIT: |
| 167 continue; | 169 continue; |
| 168 case AVLINK_STARTINIT: | 170 case AVLINK_STARTINIT: |
| 169 av_log(filter, AV_LOG_INFO, "circular filter chain detected\n"); | 171 av_log(filter, AV_LOG_INFO, "circular filter chain detected\n"); |
| 170 return 0; | 172 return 0; |
| 171 case AVLINK_UNINIT: | 173 case AVLINK_UNINIT: |
| 172 link->init_state = AVLINK_STARTINIT; | 174 link->init_state = AVLINK_STARTINIT; |
| 173 | 175 |
| 174 if (avfilter_config_links(link->src)) | 176 if ((ret = avfilter_config_links(link->src)) < 0) |
| 175 return -1; | 177 return ret; |
| 176 | 178 |
| 177 if (!(config_link = link->srcpad->config_props)) | 179 if (!(config_link = link->srcpad->config_props)) |
| 178 config_link = avfilter_default_config_output_link; | 180 config_link = avfilter_default_config_output_link; |
| 179 if (config_link(link)) | 181 if ((ret = config_link(link)) < 0) |
| 180 return -1; | 182 return ret; |
| 183 |
| 184 if (link->time_base.num == 0 && link->time_base.den == 0) |
| 185 link->time_base = link->src && link->src->input_count ? |
| 186 link->src->inputs[0]->time_base : AV_TIME_BASE_Q; |
| 181 | 187 |
| 182 if ((config_link = link->dstpad->config_props)) | 188 if ((config_link = link->dstpad->config_props)) |
| 183 if (config_link(link)) | 189 if ((ret = config_link(link)) < 0) |
| 184 return -1; | 190 return ret; |
| 185 | 191 |
| 186 link->init_state = AVLINK_INIT; | 192 link->init_state = AVLINK_INIT; |
| 187 } | 193 } |
| 188 } | 194 } |
| 189 | 195 |
| 190 return 0; | 196 return 0; |
| 191 } | 197 } |
| 192 | 198 |
| 193 char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) | 199 char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) |
| 194 { | 200 { |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 566 |
| 561 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
) | 567 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
) |
| 562 { | 568 { |
| 563 int ret=0; | 569 int ret=0; |
| 564 | 570 |
| 565 if (filter->filter->init) | 571 if (filter->filter->init) |
| 566 ret = filter->filter->init(filter, args, opaque); | 572 ret = filter->filter->init(filter, args, opaque); |
| 567 return ret; | 573 return ret; |
| 568 } | 574 } |
| 569 | 575 |
| OLD | NEW |