| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Filter layer - default implementations | 2  * Filter layer - default implementations | 
| 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. | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 152 | 152 | 
| 153 fail: | 153 fail: | 
| 154     av_free(buf); | 154     av_free(buf); | 
| 155     if (ref && ref->audio) | 155     if (ref && ref->audio) | 
| 156         av_free(ref->audio); | 156         av_free(ref->audio); | 
| 157     av_free(ref); | 157     av_free(ref); | 
| 158     av_free(samples); | 158     av_free(samples); | 
| 159     return NULL; | 159     return NULL; | 
| 160 } | 160 } | 
| 161 | 161 | 
| 162 void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | 162 void avfilter_default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picre
     f) | 
| 163 { | 163 { | 
| 164     AVFilterLink *out = NULL; | 164     AVFilterLink *outlink = NULL; | 
| 165 | 165 | 
| 166     if (link->dst->output_count) | 166     if (inlink->dst->output_count) | 
| 167         out = link->dst->outputs[0]; | 167         outlink = inlink->dst->outputs[0]; | 
| 168 | 168 | 
| 169     if (out) { | 169     if (outlink) { | 
| 170         out->out_buf      = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w
     , out->h); | 170         outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, out
     link->w, outlink->h); | 
| 171         avfilter_copy_buffer_ref_props(out->out_buf, picref); | 171         avfilter_copy_buffer_ref_props(outlink->out_buf, picref); | 
| 172         avfilter_start_frame(out, avfilter_ref_buffer(out->out_buf, ~0)); | 172         avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0))
     ; | 
| 173     } | 173     } | 
| 174 } | 174 } | 
| 175 | 175 | 
| 176 void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir
     ) | 176 void avfilter_default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_d
     ir) | 
| 177 { | 177 { | 
| 178     AVFilterLink *out = NULL; | 178     AVFilterLink *outlink = NULL; | 
| 179 | 179 | 
| 180     if (link->dst->output_count) | 180     if (inlink->dst->output_count) | 
| 181         out = link->dst->outputs[0]; | 181         outlink = inlink->dst->outputs[0]; | 
| 182 | 182 | 
| 183     if (out) | 183     if (outlink) | 
| 184         avfilter_draw_slice(out, y, h, slice_dir); | 184         avfilter_draw_slice(outlink, y, h, slice_dir); | 
| 185 } | 185 } | 
| 186 | 186 | 
| 187 void avfilter_default_end_frame(AVFilterLink *link) | 187 void avfilter_default_end_frame(AVFilterLink *inlink) | 
| 188 { | 188 { | 
| 189     AVFilterLink *out = NULL; | 189     AVFilterLink *outlink = NULL; | 
| 190 | 190 | 
| 191     if (link->dst->output_count) | 191     if (inlink->dst->output_count) | 
| 192         out = link->dst->outputs[0]; | 192         outlink = inlink->dst->outputs[0]; | 
| 193 | 193 | 
| 194     avfilter_unref_buffer(link->cur_buf); | 194     avfilter_unref_buffer(inlink->cur_buf); | 
| 195     link->cur_buf = NULL; | 195     inlink->cur_buf = NULL; | 
| 196 | 196 | 
| 197     if (out) { | 197     if (outlink) { | 
| 198         if (out->out_buf) { | 198         if (outlink->out_buf) { | 
| 199             avfilter_unref_buffer(out->out_buf); | 199             avfilter_unref_buffer(outlink->out_buf); | 
| 200             out->out_buf = NULL; | 200             outlink->out_buf = NULL; | 
| 201         } | 201         } | 
| 202         avfilter_end_frame(out); | 202         avfilter_end_frame(outlink); | 
| 203     } | 203     } | 
| 204 } | 204 } | 
| 205 | 205 | 
| 206 /* FIXME: samplesref is same as link->cur_buf. Need to consider removing the red
     undant parameter. */ | 206 /* FIXME: samplesref is same as link->cur_buf. Need to consider removing the red
     undant parameter. */ | 
| 207 void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samp
     lesref) | 207 void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *sa
     mplesref) | 
| 208 { | 208 { | 
| 209     AVFilterLink *outlink = NULL; | 209     AVFilterLink *outlink = NULL; | 
| 210 | 210 | 
| 211     if (link->dst->output_count) | 211     if (inlink->dst->output_count) | 
| 212         outlink = link->dst->outputs[0]; | 212         outlink = inlink->dst->outputs[0]; | 
| 213 | 213 | 
| 214     if (outlink) { | 214     if (outlink) { | 
| 215         outlink->out_buf = avfilter_default_get_audio_buffer(link, AV_PERM_WRITE
     , samplesref->format, | 215         outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRI
     TE, samplesref->format, | 
| 216                                                              samplesref->audio->
     size, | 216                                                              samplesref->audio->
     size, | 
| 217                                                              samplesref->audio->
     channel_layout, | 217                                                              samplesref->audio->
     channel_layout, | 
| 218                                                              samplesref->audio->
     planar); | 218                                                              samplesref->audio->
     planar); | 
| 219         outlink->out_buf->pts                = samplesref->pts; | 219         outlink->out_buf->pts                = samplesref->pts; | 
| 220         outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate; | 220         outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate; | 
| 221         avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~
     0)); | 221         avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~
     0)); | 
| 222         avfilter_unref_buffer(outlink->out_buf); | 222         avfilter_unref_buffer(outlink->out_buf); | 
| 223         outlink->out_buf = NULL; | 223         outlink->out_buf = NULL; | 
| 224     } | 224     } | 
| 225     avfilter_unref_buffer(samplesref); | 225     avfilter_unref_buffer(samplesref); | 
| 226     link->cur_buf = NULL; | 226     inlink->cur_buf = NULL; | 
| 227 } | 227 } | 
| 228 | 228 | 
| 229 /** | 229 /** | 
| 230  * default config_link() implementation for output video links to simplify | 230  * default config_link() implementation for output video links to simplify | 
| 231  * the implementation of one input one output video filters */ | 231  * the implementation of one input one output video filters */ | 
| 232 int avfilter_default_config_output_link(AVFilterLink *link) | 232 int avfilter_default_config_output_link(AVFilterLink *link) | 
| 233 { | 233 { | 
| 234     if (link->src->input_count && link->src->inputs[0]) { | 234     if (link->src->input_count && link->src->inputs[0]) { | 
| 235         if (link->type == AVMEDIA_TYPE_VIDEO) { | 235         if (link->type == AVMEDIA_TYPE_VIDEO) { | 
| 236             link->w = link->src->inputs[0]->w; | 236             link->w = link->src->inputs[0]->w; | 
| 237             link->h = link->src->inputs[0]->h; | 237             link->h = link->src->inputs[0]->h; | 
|  | 238             link->time_base = link->src->inputs[0]->time_base; | 
| 238         } else if (link->type == AVMEDIA_TYPE_AUDIO) { | 239         } else if (link->type == AVMEDIA_TYPE_AUDIO) { | 
| 239             link->channel_layout = link->src->inputs[0]->channel_layout; | 240             link->channel_layout = link->src->inputs[0]->channel_layout; | 
| 240             link->sample_rate    = link->src->inputs[0]->sample_rate; | 241             link->sample_rate    = link->src->inputs[0]->sample_rate; | 
| 241         } | 242         } | 
| 242     } else { | 243     } else { | 
| 243         /* XXX: any non-simple filter which would cause this branch to be taken | 244         /* XXX: any non-simple filter which would cause this branch to be taken | 
| 244          * really should implement its own config_props() for this link. */ | 245          * really should implement its own config_props() for this link. */ | 
| 245         return -1; | 246         return -1; | 
| 246     } | 247     } | 
| 247 | 248 | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 316 } | 317 } | 
| 317 | 318 | 
| 318 AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, | 319 AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, | 
| 319                                                   enum SampleFormat sample_fmt, 
     int size, | 320                                                   enum SampleFormat sample_fmt, 
     int size, | 
| 320                                                   int64_t channel_layout, int pa
     cked) | 321                                                   int64_t channel_layout, int pa
     cked) | 
| 321 { | 322 { | 
| 322     return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt, | 323     return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt, | 
| 323                                      size, channel_layout, packed); | 324                                      size, channel_layout, packed); | 
| 324 } | 325 } | 
| 325 | 326 | 
| OLD | NEW | 
|---|